Wednesday, May 25, 2016

Very Trending Question for Android Experienced Professionals i.e. which design-pattern to use for designing any android application?

e.g.. Let's take very simple example have a single Screen and you have one edit-text and one Send button and display that text to user.Once you click on Send button then whatever the text is.will be send to the Server and will also be displayed on the UI.

Question is how will you design this application?

AnswerI think every body know how to do this application and definitely can do it but the thing is how will you do it.Lot of things matter over here the performance,complexity,server interaction,Internet, View of the Application,space complexity,time complexity and Majorly coupling between the View-Data-Model.
So i know lots of Design-Pattern started coming in your mind such as MVC(Model View Controller),MVP(Model View Presenter),MVVM(Model View View-model) etc.

but before going further, we should think that we should apply these or not and if we are applying either of these then why? because in Android Application Development Server-View-Model-Data are very important even for this simple single screen application also.So we should use MVC>MVP>MVVM.even if you use any of these will work but the problem will be user-interaction.Let say we write something in edit text and we click on the send button then for the moment there would be a time gap of let say 1-2-3-4 secs lot depends on Internet to send even that small text to server.for that moment  also user would have to wait.i want to remove that time gap.I know you would do something like create a Model and CustomeAdapter , ListView or RecyclerView,HttpUrl Connect for data posting to server anything i am misssing? yes i am misssing a local storage let say Sqlite instead of sending data to server via Http Url Post through JSON,XML be anyhting.I would insert that data to local storage and will update my View from there  and will also display it to the user then i would cal server and will sync it from there.So insteda of sending data directly to server i would insert the data to local-storage So in this case the time gap would be removed and the app performance will also  not be impacted.Its just a  single use case can be many.I would suggest before relying on any design-pattern try to think the otherways of it.So that you can think of User-Ineratction and Performance of the application.these are major component of the any android the application which can matter.

No comments: