Think in Java-notes

Source: Internet
Author: User

1. Abstract process

11,000 things are objects: Any conceptual component (dog, building, service, etc.) in a program can be represented as an object

1.2 Programs are collections of objects that call each other by sending information to each other

1.3 Each object has storage made up of other objects

1.4 Each object has its type

1.5 All objects of a particular type can receive (receive) the same message

3 main features of the object: state, behavior (behaviour), identity.

2. Objects

2.1 Each object has an interface

2.2 Each object is serving (improves the cohesion of the object)

What kind of services can the object provide to me to solve the problem? High cohesion is one of the basic quality requirements of software design: This means that a software artifact (such as an object)

All aspects of the "combination" is very good. One of the problems in designing objects is to fill in the object with too much functionality, and you can decompose an object into multiple objects and

The implementation of the energy can be assigned to different objects. The functionality of other objects is then eventually called by an object. So each object has a high cohesion collection of services it can provide.

2.3 Multiplexing specific implementations (code reuse)

Code reuse is one of the greatest advantages that OOP offers. The simplest way to reuse a class is to use an object of that class directly

We call it "create a member object" and use an existing class to synthesize a new class called "Combination" (composition) if the combined dynamic

It is commonly referred to as "aggregation" (aggregation). A combination is often seen as a "has-a" relationship, just as a car has an engine.

Sometimes "combination" is better than "inherit".

2.4 Inheritance

There are two ways to make a difference between a base class and an exported class: 1. Add a new method. 2. Method overloading overrides a method of the parent class

Think in Java-notes

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.