Thursday, August 04, 2011

Mobile devices and good architecture

I'm in the midst of a project that includes a significant mobile device component. The build out requires super engaging user experience (UX) for the interactions on the mobile devices. The project also includes a companion web portal where people will have further insight into their mobile device interactions. The project is very social and has a good possibility in innovating some monetary processes. Very exciting!

The other day I attended a meetup with focus on sproutcore. Great introduction to the product with some very useful insight into how the framework was put together and how it should be utilized. What was cool about the whole meetup is I posted a photo from the AppNovation offices where the event was being hosted. I posted directly from my Android phone to Google+ with no effort (nice feature) and added a comment. The really cool part was the discussion that occurred between myself and two guys I worked with on a really innovative client-server C++ / Sybase SQL Server application 20 years back. Weird thing is we are all still coding in different capacities. Anyhow, the really interesting conversation was around the MVC pattern and business logic in the browser. We all agreed this was not the right way to go, and the sproutcore site was wrong in promoting business logic in the browser as a marketing message.


So why isn't business logic in the browser a good architecture?
Because pushing it out to the browser means it can no longer run on the server. Business logic can be reused for other services (think RESTful) where browsers are consumers of the logic (not the producers), business logic is intellectual property and shouldn't always be exposed in the browser, business logic often needs data and implements business decisions, this should stay on the server. Don't get me wrong a framework that supports HTML5 and implements the MVC pattern is a good architecture. Just pushing the business logic out to the browser is not good architecture. Now we may be getting into the definition of business logic, and if the Model within the MVC is considered the business logic and is only responsible for acting as a proxy for the data and business decisions through a web service API like REST then we are good.


So what does this have to do with mobile devices and good architecture?
HTML5 and the MVC pattern are very good practices when developing on mobile devices. This is mostly because of HTML5's ability to target multiple devices and the MVC being a very mature and proven pattern. The issue then becomes how should the application be architected? I'd suggest the following practices;
  1. Use a HTML5 / MVC approach when building the User eXperience (UX)
  2. Keep the Model thin and it should act mostly as a proxy to the server hosted web services
  3. Build the server hosted services using a well thought out RESTful design, ensure these services could also be consumed by non-mobile devices
  4. Be mindful of which features are required for mobile and which are better implemented within a browser based portal (consider the difference between the Google+ mobile app and the Google+ browser portal)
  5. Separate the database reads from the writes within the RESTful API (this will greatly help scalability)

1 comment:

Rose Mayfield said...

This blog is a great combination of suitable and useful information and well-written sentences that will certainly entice your sense and update you about new happening. Here I have found the information for which I was looking for long time.
solavei opportunity