I am a strong believer in a future where mobile devices would actually be servers too. This is not a new idea or anything. And Il admit I jumped on the bandwagon quite late. Though jumping is not what I did out of trying to follow the popular opinion. It all started when I got the iPhone and it hit me like a truck. So it wasnt a bandwagon jumping moment as it was a getting-hit-by-a-truck moment.
Anyway, clearly servers on mobile devices instead of server boxes sitting in some rack is exciting. Imaging you are on the move with a few people on a train and voila you have a webserver you can put up for sharing. Mind you, this is not that different or even superior to P2P (locally via Bluetooth or globally). Just another alternative. So one of the tools I figured Il use quite a bit on my mobile, should it take off as a webserver is a templating engine. Here is where Mango comes in. This was actually inspired by Django templates. And being a big worshipper of Django, I think of Django as a philosophy and not just as a framework. So first thing was the port of the templating engine.
Where exactly am I porting it to? First of all the code is opened under an Apache license and is on git. Secondly I am porting it to android and objective C. The objective C version is woefully behind, where as the android version has support for a lot of stuff (for, if, include, variables etc) and has a full set of unit tests with it. Frankly I find android a much much more intuitive platform to develop than XCode (and objective C). May be it has to do with my familiarity with java. The objective C version will follow shortly.
So why another templating engine – Well I had envisaged 2 use cases for it:
1. Consume json or xml data from a backend and apply a template on the data from the client (mobile).
2. Mobile generates the content and applies a template to it before sending off the response to a client’s request.
Either way a separate templating engine helps.
Please feel free to try it out. Would appreciate any and all feedback and not to mention help with extending it to a large number of tags and filters.
1. Check it out from git at http://github.com/panyam/mango.
2. Start eclipse (must have java and android)
3. Open the mango and the mangotest projects (from mango/android and mango/android/test respectively).
4. Select the mangotest project and Run As Junit – watch the unit tests.