Thinking in JAVA 3 – (Introduction to Objects:)

來源:互聯網
上載者:User
Introduction to Objects:
The Progress of abstraction:
.1 All of the programming language privide abstraction.Since all kinds of imperative
language is base on the assembly language , and, the assembly language is a
abstraction of the underlying machine,and the thinking model of assembly is machine
model or (solution space),then,the imperative language such as C,which is abstracted
from the Assembly, so that they also are machine model. So the programmer must
establish the assosiation between the machine model (solution space) and the model
of the problem (problem space).
.2 The OOP allows you to describe the problem in terms of the problem,rather than in
term of the computer where the solution will run. In my understanding, the programmer
use the lingo of problem to decribe the problem itself.So there would not
constrained to any particular type of problem for a programmer because while he write
the program he is express the problem itself. And the problem's representation in
problem (solution)space is as "objects".
.3 Then what's object:1. Everything is an object.2. A program is a bunch of objects
telling each other what to do by sending messages.3. Each object has its own memory
made up of other objects.4. Every object has a type.5. All objects of a particular
type can receive the same messages. -- by Alan Kay ; An object has state, behavior
and identity. -- by Booch.
A Objects has a interface:
.1 what is class:a class is really a data type.And the most important,the writer
said that the diff between the float pointer member and class is the type is fit or
not the problem which we would like to solve.
what's interface:We know to make a objects to work we should send the message to
this objects,but each object can satisfy only certain requests.The requests you can
make of an object are defined by its interface, and the type is what determines the
interface.So we can say the interface is the type that the message that this kinds of
the object can receive.
An object provides services
Thinking of an object as a service provider has an additional benefit: it helps to
improve the cohesiveness of the object.In a good object-oriented design, each object
does one thing well,but doesn’t try to do too much.
hidden implementation:
The author suggesion that we should break up the playing field into class creators
(those who create new data types) and client programmers(the class consumers who use

the data types in their applications). The goal of the client programmer is to
collect a toolbox full of classes to use for rapid application development. The goal
of the class creator is to build a class that exposes only what’s necessary to the
client programmer and keeps everything else hidden.
composition & aggregation:Your new class can be made up of any number and type of
other objects, in any combination that you need to achieve the functionality desired
in your new class. Because you are composing a new class from existing classes, this
concept is called composition (if the composition happens dynamically, it’s usually
called aggregation).
Inheritance:reusing the interface,as author had suggestion,a class is a type which
could send out or receive some kinds of messages(by the interface).the inheritance
which exactly means that get the same interface from the base class.
overriding:change the behavior of an existing base-class method.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.