Getting started with reading tij-1 objects

Source: Internet
Author: User

Thinking in Java chapter 1st object Introduction

Chapter 2, about 20 pages, is an overview of Object-Oriented Programming (OOP. According to his preface: "This includes answers to basic questions such as" what is an object, it also describes interfaces and implementations, abstraction and encapsulation, messages and functions, inheritance and synthesis, and very important concepts of polymorphism. This chapter will ask you some basic questions about object creation, for example, the builder, where objects exist, where they are placed after creation, and the magic garbage collector (which can clear unnecessary objects ). Other problems to be introduced include the Error Control Mechanism Implemented by violation, the multi-thread processing of Responsive user interfaces, and the connection between the network and the Internet. We will also learn what makes Java so special, why it has achieved such great success, and problems related to Object-Oriented Analysis and Design ."

As a whole, 1. Introduction to various OOP concepts; 2. Object lifecycle; 3. Other issues.

[Object-Oriented Programming (OOP) is attractive in many aspects .......] In fact, it means the benefits of object-oriented technology or the object-oriented programming paradigm, covering OOA, OOD and so on.

[When thinking about objects, we need to useImage Thinking, not procedural thinking.......] In Introduction to programming 1. in Object Oriented 1.3, metaphor is used, which is in line with people's daily life's habits, as well as serving customers and servers, and emphasizes the basic desire of object-oriented technology:We hope that in software development, the modeling of problem domains and the construction of domain can meet the thinking habits and living habits developed by humans in daily life. Programmers can develop software based on their daily life experience.".

1.1 abstract progress/Evolution

I don't have to worry about translation. It's best not to read the Chinese version. I just issued tij3rd.

This section is quite well written by the author. If tij focuses on introducing Object-Oriented "ideas", I think this section is quite similar! In addition, because this section is 1.1, the reader will think it will be later. In fact, tij stops suddenly. Some people say that the first word to learn object-oriented technology should beAbstraction, Agree. However, what is abstraction?

[P93 abstraction occurs in all aspects of programming, roughly dividedFunction abstraction (functional/process abstraction action)AndData abstraction action), AndObject abstraction action).] Therefore, chapter 1 of Introduction to programming is functional abstraction and Chapter 2 is data abstraction.

Abstract:1.1.1 problem domain and solution domain.


Figure 1-1 objects in the problem domain and solution domain

[P24

Figure 1-1 briefly expresses the relationship between the problem domain and the solution domain. Abstract is used twice.
 
Abstraction is used as both a process/activity and a result/entity.
As an activity (verb), abstraction means from one or more facts, data, and phenomenaExtract (V. Extract/abstract)The main details rather than the main details. Abstract is a common technology used by humans to cope with/control complexity. For example, to abstract a group of dogs, you may only care about the name and age of a dog as needed, and ignore the place of birth, appearance, and eating habits. The most typical example is a particle in Newton's physics. Instead of considering the shape and size of an object, the mass is regarded as a point, such as a point, line, or triangle in the ry. In short, abstraction is simplified or idealized. In an image, abstraction is the willingness to give up.
As a (theoretical) entity (TERM), abstraction means to be obtained from many facts, data, and phenomena of the same nature.Concepts of classification, regular conclusions, mathematical formulas, models, and other expressions. The most basic example is the concept/term,Class is the abstraction of a specific object. For another example, through induction or refinement (or proof), various statements of the program can be abstracted into three basic process structures.

]

Therefore, when it comes to "abstraction, inheritance, and polymorphism", this abstraction and class, concept, and Noun are synonyms.

[Alan Kay summarized the five basic features of Smalltalk] I don't care much about these five basic features, but I'm in Figure 1-5 Alan? Before Kai's father of object-oriented (one)★, And in the title 1.1, he emphasized his famous saying: computing is a simulation.

[This feature is called the "alternative" of objects and is one of the most important concepts of OOP .] Well, yes. I use LSP as the three cornerstones of object-oriented, 2.1.1's replacement principle, 2.1.4 access modifier and inheritance · 3. Inheritance classification, and inheritance polymorphism are all centered around LSP. I don't know if tij will be expanded later.

1.2 object interfaces (an object has an interface)

[Some people further differentiate, they emphasize that "type" determines the interface, and "class" is a special implementation method for that interface ]. This "interface" is called a class interface in the 4.1 Data abstract meaning · 1.2 class interfaces. [P133Class InterfaceA set of interfaces defined by the class that can be accessed by external objects.Access modifier restrictionsClass InterfaceThis mechanism is called Encapsulation, Which is detailed in [Chapter 1 encapsulation.

In most cases, the class can be regarded as a type. For example, in [2.2.2java data type], the concept of the (data) type takes the class as the class type.

The difference between subclass and subtype is introduced in [2.1.1's replacement principle]. What are the differences between classes and types?

Differences are manifested inSeparation of interfaces and Implementations. Type is a name that identifies the class interface.If an object can accept all operation requests (method calls) of Class X interfaces, the object has the X type. It is precisely because of Java'sSub-classes can meet the interface of the parent class(Though it can be rewritten), soSubclass objects can have multiple types in the class hierarchy at the same time..

Class is a combination of interfaces and implementations. The class not only defines a type, but also defines the implementation of the internal state and method of the object, as well as methods that are not interfaces (such as private methods ). In short, the type is the class interface, and the class is the type + implementation .]. 1.3 hiding the hidden implementation

This section describes encapsulation and information hiding.

1.4 reuse of the reusing the implementation Implementation/code. Translation. [Code reuse is one of the greatest advantages that object-oriented programming provides ages .]. This is me Super disagree. 1. code reuse is a huge advantage, but it is not brought about by object-oriented, So C's function library has this huge advantage. Merging reuse priority principleThere is no difference between object-oriented and process-oriented. 2. [p62 Implementation inheritance)Or inheritance for the purpose of reusing the code of the parent class, which is the first impression of many beginners of object technology .] In addition, we use a 4.2.3 interface to inherit. implementation inheritance: [This section describes the problems existing in implementation inheritance (Special inheritance) To emphasize the importance of interface inheritance (Protocol inheritance) and abstract methods ]. 1.5 inheritance: If you re-use the interface in Chinese, I can't see it anymore. Is-A vs. Is-like-a relationships is very poorly written. Seriously suspect that he does not understand LSP. He said that "inheritance can only be a function of the override base class" is a special Inheritance/implementation inheritance (Implementation inheritance), while the latter is an extension inheritance, both of which Perfect replacement principle. In general, he still Regard inheritance as a relationship in code, You should look at the problem from the perspective of class hierarchy. Subclass (Special inheritance and extended inheritance) are "a" parent class. When the extension inherits the upper shape/replacement, it is just" Loss of subclass Extension". Subclass fully meets the interface of the parent classIs the key. [P63's most appropriate explanation of the loss of subclass extension is "White Horse ". After a white horse replaces a horse, it can only be a horse rather than a white horse. The white horse loses its own characteristics and cannot be used as a white horse-"White Horse is not a white horse" unless it is modeled downward (back)]

1.6 interchangeable objects with Polymorphism

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.