Thursday, May 2, 2013

Planning a new App development? How about the Technology Stack?

I guess anyone doing any sort of Software Development work will agree that Technology Stack plays the most critical part during the development life cycle as well when the product is in use which often requires modifications. A bad choice could add millions of dollars of additional expenses during the development as well as higher maintenance expenses when it's in use resulting into higher TCO (Total Cost of Ownership) for the customers. But unfortunately there is no simple answer to this question when you start building a new app. In this post and the follow up posts I will try to cover  some of those Tech Stacks and pros & cons of them. 

Let's take a look at what are the different pieces that influence the choice of Technology Stack:

1. Content Rendering or UI Layer
2. Content Generation Layer
3. Core Business Logic
4. Back-end batch processing
5. Data Storage

Next, some of the priorities that influence the choice of Technology Stack.

1. Is UI layer a native App or a regular Web App?
2. High availability 
3. Scalability
4. Disaster recovery
5. Data Consistency - transactional consistency or eventual consistency? 
6. Serviceability 
7. Extensibility 

And last but not the least low cost of development and maintenance. 

In this first case, we will consider developing a basic Web Application meant for consumers using Java/J2EE Technology.

Content Rendering or UI Layer: Use of HTML5, CSS3 and Javascript/jQuery is probably given. There is not much scope for debate. However, an important consideration here would be to think if HTML5 based rendering is going to be the final one. This is an important consideration as increasingly consumers are moving towards Mobile devices for Internet access and regular HTML5 doesn't really give the best experience there. So, this consideration would influence what Technology to be used for the Content Generation LayerFor UI layer, time spent to identify the right jQuery plugins is worth every second of it.

Content Generation Layer: Here our pick is RESTful APIs. That allows you to keep this layer agnostic of the final UI Layer. The RESTful APIs could feed to your HTML5+CSS3+jQuery based UI or to your iOS or Android based native App equally comfortably. Considering this App is getting developed using Java/J2EE, we will recommend Jersey for RESTful API implementation.

Core Business Logic: Here our pick is one of the most commonly used patterns by the Java Developers - use POJO (Plain Old Java Objects) coupled with DAO layer (Data Access Layer APIs) and for persistence use JPA (Java Persistence API) coupled with some ORM tool. Hibernate is pretty universal choice for an ORM tool.

Back-end batch processing: Even simplest of the Software Applications will have some sort of back-end batch processing where the priority is necessarily the "throughtput" i.e. how many records/data/file processed per unit time. For simple workflow and business process, we will recommend having one single step of processing and run it in a scheduled manner. One option is to use Java Concurrency APIs but it requires deeper skill sets. So, to keep the things simple, we will recommend using either Unix cron job or Windows Scheduler. However, if you don't want to depend on the OS, then go for Quartz

Data Storage: Any standard RDBMS should fit the bill here. For the simple app in our discussion, we will recommend MySQL. However, when it comes to creation of the Database tables etc, we will recommend that be done through regular Java objects/beans and let your JPA/ORM layer take care of managing the DB tables.

Till this point, we really did not talk about which Web Server or App Server to be used or where to host the Application and they play a very critical role in the choice of overall Technology Stack.

So, as mentioned earlier two of our major considerations are - 
1. Keep things simple that requires as less skill sets as possible 
2. Keep the cost low - both development and running cost.

So, keeping those goals in perspective, our recommendation would be to go for Google App Engine. Google App Engine makes the development really simple, you can work out your Eclipse environment - use the environment for both development and deployment (release management) activities. If you are not already familiar with GAE, GAE is necessarily a PaaS offering from Google that gives you  Hosting Environment (HW), Software Dev Env (GAE Eclipse Plugin) as well as Software infrastructure layer like Web Server, App Server, Scheduler, Database and multiple value added Services for running the Application in production. And imagine you get to run your app on the same infrastructure as Google Search.

Finally, for the code repository and version control, go for GitHub.

So, here is how it finally looks like -

1. Eclipse 4.2 (Juno) for Development/Deployment (free)
2. GitHub as code repository and version control. (free for public repository otherwise $7/month)
3. Google App Engine as Hosting Env as well as Platform.(free for limited quota otherwise $10/month is sufficient)
4. HTML5 + CSS3 + jQuery for UI
5. RESTful APIs using Jersey
6. JPA for persistence layer
7. Google Big Table for storage (comes with GAE)
8. Make use of other GAE services like cron job etc.