Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are the design patterns used in android? [closed]

Tags:

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

like image 445
Swapnal Avatar asked Mar 31 '13 12:03

Swapnal


People also ask

Which design pattern is used in Android?

So in this blog, we learned about some of the Design Patterns that are used in Android to write a cleaner and understandable code. We learn about Builder pattern, Singleton pattern, Dependency Injection pattern, Adapter pattern, Facade pattern, Observer pattern, Command pattern, MVC, MVP, and MVVM pattern.

What is MVVM pattern in Android?

MVVM stands for Model, View, ViewModel. Model: This holds the data of the application. It cannot directly talk to the View. Generally, it's recommended to expose the data to the ViewModel through Observables. View: It represents the UI of the application devoid of any Application Logic.

What are Android patterns?

A compiled representation of a regular expression. A regular expression, specified as a string, must first be compiled into an instance of this class.


1 Answers

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.

like image 189
minh truong Avatar answered Sep 23 '22 13:09

minh truong