Design Patterns in Android

 

     As Android developers or developers in general, we encounter the Design Patterns paradigms pretty much in every job. Most of us as I roughly assume – go over some of the more common design patterns as an integral part in preparing for a job interview.

     It is common to assume that software developers should be familiar with what design patterns are and should be able to fire couple of them and explain their usage in modern software architecture. the common patterns that you’ll probably be asked to explain are Singleton, Factory, Strategy and maybe some more exotic ones.

     So the question asked, is how do classical Design patterns come handy when planning the  architecture of an android app?

     The answer to this somewhat bizarre question can be divided into two mini answers :

  1. The platform which we are developing for is not important. In other words, the fact that we are dealing with an Android app is irrelevant. The design patterns which we want and should use are up for us to choose and implement. If we have an Instance of a connection manager, or a global parser, or even a garage which is responsible for creating new vehicles, then we should definitely use Singletons and Factory design patterns, it pretty much screams from the context of the purpose of the code. we can pretty much state that design patterns are platform-agnostic.
  2. The android platform itself, as you may already know is designed in somewhat MVC way. For example:
    • our Controllers are the activities themselves which contain all the business logic done in the application
    • Models are our entities which describe the components of our apps.
    • All the Views can be done in XML layouts.

    it’s clear that the Android SDK pretty much depends on Object oriented design because that's just the way it’s built in the core and in the way system components interact with each other. so in the next time you’re thinking about the architecture of your next app, notice the way the SDK forces you to right, and you’ll see how it’s easy to incorporate the beloved design patterns you already know.

Comments

Popular posts from this blog

Spinner VS AutoCompleteTextView

How to update UI from a different thread

Utilizing Http response cache