http://blog.csdn.net/luoxinwu123/article/details/8019547
The component-oriented idea is a kind of software design thought based on object-oriented in the background of expanding software scale and increasing complexity. It can be understood as a more coarse-grained object-oriented, its granularity is generally greater than the object, but to what extent, and can be determined according to the actual situation. This idea is based on components, emphasizing the concept of "service".
Component-oriented has the following characteristics:
Low coupling: The components generally do not depend on each other, a component only need to know the "name" of the other component can access it;
High reusability: System-level reuse;
High interoperability: The components developed by different developers can access each other as long as the interfaces are defined;
Transparency of processes: components can work in the same process can also work in different processes;
The independence of the language and development environment: components only need to define a good service interface, the internal implementation can be in any language.
Component-oriented frameworks are already numerous, such as JavaBean, EJB, COM, and so on. Android does not claim to be component-oriented, but from the perspective of its design, the first design consideration of Android is to adopt a "borderless" design approach, in order to achieve a high level of reuse of resources within the system.
In fact, Android is fully compliant with component-oriented features. First, Android offers four components of activity, Service, Broadcastreceiver, and ContentProvider. The collaboration between these four components is based on a binder mechanism, where servicemanager and Activitymanagerservice are the most important foundations for working together between components, and they are also components themselves. ServiceManager is a binder daemon that manages various services and provides the ability to query remote interfaces for clients that invoke these services. Activitymanagerservice is responsible for all activity and service launches, as well as the registration and distribution of all broadcasts in the system and the sending of broadcasts to recipients.
With this mechanism, there is a low-coupling between Android components, where activity and activity, activity and service, service, and service are only known to the other person's "name" to access it. Moreover, the reuse between them is system-level, especially service, any service deployed in the system can serve any one application, any one process, any one component to serve. It also meets high interoperability, and any developer-developed component can be used by other developers as long as the interface is advertised. Android is completely transparent to the process, and instead, in Android, the concept of task is generally used as the boundary of the application, and a task can be a single process or multiple processes. Activity and service collaboration can be done both in the same process and in different processes. For example, start the activity's startactivity function, and if the new activity is configured with the Android:process attribute, it will run in another process or run in the same process. There are two ways to start a service, such as the following:
StartService: running in different processes;
Bindservice: Runs in the unified process.
The start-up process is a binder mechanism that notifies activitmanagerservice to decide whether to create a new process and start a new activity or service.
Android's component-oriented thinking