Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design patterns used in Android apis

We have a class home work for design pattern class. In that we have to explain anyone design pattern used in any api/framework. I was thinking if I could do the same using Android apis. I know that android uses some command, observer, template method patterns and many more but it would be great if someone could point me to the starting reference document or so.

Thank you so much in advance.

like image 513
Pruthvid Avatar asked Mar 19 '26 05:03

Pruthvid


1 Answers

Frameworks almost by definition tend to implement high-level patterns such as MVC or ORM patterns. These are not covered in the GOF text, although you will find them in other pattern books such as Martin Fowler's Patterns of Enterprise Application Architecture. Some GOF patterns are implemented at the framework or even language-level (like C# events/delegates as an example of the Observer pattern), but mostly GOF patterns are left to the individual developer to implement as needed, as the details tend to be application or domain-specific.

Android is the same way. It has a specific flavor of Model-View-Controller built in, but not too many GOF-specific patterns. You might consider the Activity lifecycle callbacks (onStart, onResume, etc.) as a kind of Observer pattern, although with only one dedicated subscriber.

Another example might be AsyncTask, which could be considered a species of the Command Pattern. I'll leave it to you to make the connection. It is homework after all.

like image 97
Dave Sims Avatar answered Mar 21 '26 18:03

Dave Sims



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!