Android architect path-oop, android architecture-oop

Source: Internet
Author: User

Android architect path-oop, android architecture-oop

 I hereby declare that I am learning about the android architecture. This blog is equivalent to my learning notes and a full manual code word. Some of the content is based on the ppt handouts of the android researcher Gao hang Gao, interspersed with personal insights, to promote the dedication of programmers, and then share with interested friends!

1. Object-oriented oop
Oriented means a belief that object-oriented believes that any software is composed of objects,
Instead of the Nothing else, we can conclude that the design of computer language simplifies the Write Program and only needs to define the class.
2. Differences between Oriented-Based-Driven-Centered:
Based: -- Based on requirements, there is a sequential order. For example, perform requirement analysis first, and then based on the results (Files) of the requirement analysis)
Subsequent software development activities are called: Requirement-based software developer.
Commonly known as: laying the foundation.
Driven: "pilot". When developing software, develop programs based on the specified model, and use the user as the Polaris.
Develop a system in the case of violating user requirements.
Centered: All software development activities are centered around this architecture. They are hung on Christmas trees like Christmas sweets and gifts.
Same


Object)
What we all know in nature is an object, and what we don't know is taken for granted as an object.
For example, Li Bai's poems he wrote are considered objects, but when he shows him a foreign-language poem, he does not think they are objects.
Because he doesn't know this thing at all.
Then. Once we get to know something, we can express its characteristics and compare it with other objects.
Including:
1> features or attributes of Objects
2> object behavior
For example, a person has attributes such as his or her nose, arm, and bounce, and can run or jump.
Software objects are composed of Data and functions.
Class)
It is a group or set, and the object is a part of the class. The class is a set of objects.
A class is a group of objects with common important attributes. The definition of a class is to describe the important features of this object.
Such as expressing features with data and expressing behavior with functions. Therefore, the definition of a class is to describe the objects in the software and should contain data and functions.
Inheritance (extend)
To classify a large number of objects, it forms an inherited system, category class = subclass
The Child class inherits the relationship between the Child class (parent class) and the parent class, just like the relationship between the child and the father. The Child class inherits the attributes and actions used by the parent class, and the Child class can also
Define attributes and actions (functions ).
Expression combination: expands functions, similar to inheritance.
The structure and usage of the base class and subclass: for example, the relationship between the tire and the engine, the engine drives the tire operation, and the relationship between them is a combination.
Here is a column:
Create a small thread:
Main (){
Thread t = new Thread (new Task (); // create a tire Engine
T. start (); // start the engine to drive the tire rotation, get the base class object, and call the subclass function through the interface.
// T start a small thread to execute the run () function.
}

Class Task implements Runnable {
Public void run (){
System. err. println ("hello world ");
}
}
To combine tires and engines, you must define a Runnable interface for Thread (ENGINE) and create a Task (tire) to implement this interface,

Interface = (snap-on function)
Structure of the base class and subclass:
A Hook is an interface used to combine two things. If two things appear at different times
The void will be reserved, and the other party will be able to fill the space with entities in the future. The two will be sealed together in order to replace the metabolism freely (pnp)
Separation of variation and immutability: It is the basic principle and craft for designing the function and application framework.
After the change and the unchanged part are separated, you can write the unchanged part in the parent category, and the changed part is written in the subcategory.

* In Java, you can use abstract functions or overridable functions to implement the snap-on function.



Ioc control inversion:
The base class calls subclass, and the main control permission is on the base class,
The Ioc mechanism is derived from the class inheritance system of the oo language (c ++ and so on). basic functions in c ++ can actively call sub-class functions. This is a classic
Ioc mechanism.
Between the base class and the subclass, the base class is the main control permission, and The subclass is called through the Hook function.
Generally, the Foundation Class is written first, and after the sub-class, this kind of predecessors have the dominant power, and then control the back, is called "control reversal"
Default behavior: the primary function of the base class, which provides the Default behavior of the Default value, that is, the function, for the subclass to call.
Inheritance.

Initiative vs passive api:
UI = user interface.
Distinguish between active and passive from the perspective of the base class.
API: This is a term, but it is associated with three verbs: 1. define (define) 2. implement (implement) 3. Call (ioc)
API can be classified into active and passive types"

An interface is a contact between the two parties. It can be said that it is a line between the forces or sites of both parties.
Who has the right to establish interfaces, who has control points, who can take the initiative, and the other is passive.



The above knowledge can be easily understood through images:


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.