Thursday, May 17, 2012

Android's component-oriented architecture


To make the reuse concept concrete, suppose you’re creating a drawing app that lets users choose a color from a palette, and suppose that another app has developed a suitable color chooser and permits this component to be reused. In this scenario, the drawing app can call upon that other app’s color chooser to have the user select a color rather than provide its own color chooser. The drawing app doesn’t contain the other app’s color chooser or even link to this other app. Instead, it starts up the other app’s
color chooser component when needed.

Android starts a process when any part of the app (such as the aforementioned color chooser) is needed, and instantiates the Java objects for that part. This is why Android’s apps don’t have a single entry point (no C-style main() function, for example). Instead, apps use components that are instantiated and run as needed.

No comments: