Android Architect's Road-oop

Source: Internet
Author: User

1. Object-oriented OOP
Oriented meaning: means a belief, object-oriented believe that any software is made up of objects,
Instead of nothing else, it can be concluded that the computer language design simplifies the writing process as long as you define class.
The difference between 2.oriented-based-driven-centered:
based:--is based on demand and has sequential order. For example, advanced line requirements analysis, then results based on requirements analysis (file)
and follow-up software development activities, called: requirement-based software developer
Commonly known as: Hit the foundation.
Driven: "Boot", when developing the software, according to the specified model to develop the program to the user's use for the Polaris, in not
Develop the system against the user's needs.
Centered: All the software development activities revolve around this architecture, just like Christmas candies and gifts are hanging on the Christmas tree
The same


Objects (object)
The things we all know in nature are objects, and for what we don't know, we take for granted that we don't think of ourselves as objects.
, for example: Li Bai wrote his own poems, he thought it was the object, but when he showed him a foreign poem, he didn't think it was an object.
Because he doesn't know anything about it.
And then it was. Once we get to know something, we can say his characteristics, and make a comparison with other objects, the characteristics of which package
Enclosed:
Characteristics or attributes of a 1> object
Behavior of 2> objects
For example: The person has the nose, the arm, the retreat and so on property, will run, jumps and so on behavior.
Software objects (software object) are composed of data and functions.
Classes (Class)
is a group or a collection, and an object is a part of a class, and a class is a collection of objects.
A class is a group of objects with a common and important attribute, and the definition of a class is an important feature that describes what the object has, and the
Like data to express an attribute, a function to express the behavior, so the definition of a class is to describe the object in the software, should contain data and functions.
Inheritance (Extend)
To classify a large number of objects, it forms a system of inheritance, derived class = Subclass
Subclasses inherit the base class (parent Class) subclasses and parent classes as a relationship between a son and a father, the subclass inherits the attributes and behavior of the parent class, and the subclass can also
Define the attribute (data) and the behavior (function).
Expression combinations:
The structural uses of base classes and subclasses: for example, the relationship between tires and engines, the engine that drives the tires, and each other is a combination.
Here are some of the following:
To create a small thread:
Main () {
Thread t = new Thread (new Task ());//create Tyre engine
T.start ();//start the engine to drive the tire rotation, get the base class object, through the interface call the sub-class function.
T turn on small threads to execute the run () function.
}

Class Task implements runnable{
public void Run () {
System.err.println ("Hello World");
}
}
To combine tires and engines, you have to define an interface (Runnable) for the thread (engine), and then create a task (tyre) to implement the interface.


Android Architect's Road-oop

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.