img Miracle04

TIJ swot_JAVA的初学者(一)

发表于2004/9/15 5:36:00  845人阅读




Struggling with JAVA for a while now, still haven't got the big picture of concepts. Although stuffed with all the words, like polymorphism, inheritance, inner class, abstract, etc. I feel bogged down everytime I?try to use?them in my program. This makes me feel so frustrated. I heard people talk about TIJ, it is like a philosophy book in JAVA. Hopefully, I will get everything I need from it.

Chapter 1


All programming languages provide abbstractions.

?Assembly language is a small abstraction of the underlying machine.?Many so-called?"imperative" language(Fortran, BASIC, and C) were abstractions of assembly language. The primary abstraction of these languages require you to think in terms of the structure of the computer rather than the structure of the problem you are trying to solve.The programmer must establish the association between the "solution space" and the "problem space".

The altrenative to? modeling the machine is to model the problem you're trying to solve. Early languages such as LISP and APL chose particular views of the world. PROLOG casts all problems into chins of decisions. Each of these approaches is a good solution to the?particular class of problem they're designed to solve, but when you step outside that domain they become awkward.

The Object-Oriented approach provides the programmer tools to represent elements in the problem space, thus the approach is not constrained to any particular type of problem. We refer to the elements in the problem and their representations in the solution space as "objects".For those objects, which has no problem-space analogs, the porgram is allowed to adapt itself to the lingo of the problem by adding new types of objects. Thus, OOP allows us to describe the problem in terms of problem, rather than in terms of the computer where the solution will run.

Some designer advocate the combination of various approaches into multiparadigm programming language.

Alan Kay summarized five basic characteristics of SmallTalk, the first successful object-oriented language and one of the languages upon which Java is based.

1. Everything is an object.A class is an object, an integer is an object...everything is an object.

2. A program is a bunch of objects telling each other what to do by sending messages. No matter inherit or extend, or simply?instantiate another object/class, all the work is about the interraction of objects.

3.Each object has its own memory made up of other objects. "create a new object by making a package containing existing objects." To build a complex program while hiding it behind the simplicity of objects. Does this mean inheritence?Probably not.

4.Every object has a type.

5.All objects of a particular type can receive the same messages.


0 0



取 消