what are the design patterns used in android?-ThrowExceptions

Exception or error:

I know some of the design pattern used in android like…

  1. Broadcast receiver uses Observer Design Pattern
  2. Intent uses a kind of Factory Design Pattern
  3. View uses Composite Design Pattern
  4. Media Framework uses Facade Design Pattern

apart from these are there any other design patterns used in android?
Appreciate your thoughts

How to solve:

Android uses a lot of patterns in side its structure.

The very first pattern you can see is Layer pattern, it is classified as architecture pattern in POSA 1 (Pattern-oriented Software Architecture 1) book. The main structural characteristic of the Layers pattern is that the services of Layer J are only used by LayerJ+1 there are no further direct dependencies between layers. This pattern will solve the problem about the mix of low- and high-level issues, where high-level operations rely on the lower-level ones. Android is built on a stack of multi abstract level layer ( refer to http://elinux.org/Android_Architecture for more detail), so this design is deployed to solve its problem.

Android does a lot of stuffs on multi processes, so an IPC (inter-process communication) mechanism needs to be well-designed. In Android, Binder and using AIDL to make the communication seamlessly though services in these processes may be written in Java, C or C++. Binder is implemented by Proxy (In Gang of Four book), Broker (in POSA 1 book) and Facade Wrapper pattern (refer to this link http://www.cs.wustl.edu/~schmidt/PDF/wrapper-facade.pdf) to implement. Proxy pattern will hide communication detail from client, so a process can communicate with object in local context or in network context uniformly. Broker is used to isolate communication-related concerns. Facade Wrapper pattern is used to to encapsulate low-level functions and data structures in C library Android within higher class interface.

Multi threading mechanism also uses a lot of pattern. A pattern we can see is Command Processor pattern used to execute long-running call.

Observer pattern is used to keep track of system-related status.


Those are all I can remember now. If you are interested in Android design pattern. You can take a look at this course: https://class.coursera.org/posa-001/class/index on Coursera for more detail.

Leave a Reply

Your email address will not be published. Required fields are marked *