Thinking in Java 3-(Introduction to objects :)

Source: Internet
Author: User
Introduction to objects:
The progress of your action:
. 1 all of the programming language privide your action. Since all kinds of imperative
Language is base on the assembly language, and, the assembly language is
Define action 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 wrongly acted
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 wocould not
Constrained to any participant 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 particle
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 wowould like to solve.
What's interface: We know to make a objects to work we shoshould send the message
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
Interface. So we can say the interface is the type that the message that this kinds
The object can receive.
An object provides services
Thinking of an object as a service provider has an additional benefit: it helps
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 shoshould 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
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
Client programmer and keeps everything else hidden.
Composition & aggregation: Your new class can be made up of any number and type
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
Cocould 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.