Posts Tagged‘sencha’

Cross-Platform Technologies: The Destructive Compromise.

The engineer in me loves looking for efficiencies. So when after the first 1.0 version of Lobaco was good enough for me to call it “done” (in the sense that the feature set for it was frozen) I started thinking about the best way in which to tackle the mobile platform which I believe will be the key in achieving the goals I set out for it. I had pretty much resigned myself to go for the iPhone first as it seems to be the best place to target for early adopter types and figured the Android version could come once Lobaco gained some traction. Still the lure of being able to develop the application once and deploy it across multiple handsets in one go made the engineer in me jump up and down with delight, leaving me little choice but to explore my options.

Long time readers will know that my most recent attempt at cross platform development came the way of Sencha and 2 weeks misplaced effort in trying to get it to work. The library itself is quite comprehensive and does a good job of emulating many of the native functions that you’d expect to see on a native iPhone application. However the problem is that performance wise it’s a total dog and would require me to undergo yet another few weeks in building a fundamental base in order to achieve the same level of productivity that I had just gained with the iPhone. Whilst I’ll still have to undergo a similar amount of effort in order to learn how to program for Android I know that the eventual application that comes out of the end of that process will be much better and worth the time invested in it.

However this wasn’t my first foray into the world of cross platform development. Way back in the beginning, long before I actually got a Macbook and Xcode, I started doing preliminary research into cross platform libraries. After getting thoroughly confused with a few code examples in Objective-C a friend suggested that I have a look at the MonoTouch framework which would allow me to leverage my existing C# skills on the iPhone. The problem there wasn’t so much the language as the paradigm I was operating under and whilst using C# might’ve helped to ease me into it without a fundamental understanding of how things work on the iPhone I would’ve gone through just as much trouble in order to use that framework, without the benefits of coding natively. Not to mention being out $100 for the pleasure and still having to buy a Mac device in order to be able to use it.

The problem I find with many cross platform technologies is that they have the unfortunate problem of making compromises when it comes to conflicts between platforms. Sencha, for all its goodness, has decided to look like an iPhone application. This is great, on the iPhone, but for any other device it’s going to be a drastic shift away from the experience the user is expecting. Even cross platform libraries that generate native code will still suffer from destructive compromises because of the different ways in which the major smartphone OSs go about their tasks. Thus you either constrain yourself with limited functionality or you have to cater for those special usage type scenarios, negating the power of the framework you’re using. Cross platform libraries are fantastic in some use cases, but their applicability is really quite limited.

If you’re looking to target multiple platforms I still believe it’s best to go for the native option, even if the development investment will be much higher. Realistically choosing a single platform to begin with isn’t a bad idea with both Android and iPhone (although Android is probably your best bet) being quite viable to test if the market will respond well to an idea. If your idea has legs then you can take the time to invest in some of the other platforms, delivering a much better end user experience. Cross platform technologies might work for some ideas but unless you’re doing nothing above the rudimentary you’re much better served by going native.


Procrastination Takes Many Forms.

I really can be my own worst enemy sometimes. It’s been almost a month since I got back from the USA and despite the best of intentions I haven’t really done that much work on Lobaco apart from a little work on the API and web UI. Whilst I was pretty sure I wasn’t going to hit the code hard immediately after touching back down in Australia I still thought that after maybe a week or two of lazing about the coding bug which had firmly bitten me before I left would take a hold once again, pushing me to build on the momentum I had set up. Sadly it wasn’t to be and instead I just resided myself to feeling guilty about what I should’ve been doing and pulling the meter tall weeds that had grown in our front yard.

Partly to blame is that sense of perspective I get whenever I take time away from a project to work on something else or to just have a break. Usually the first thing that pops into my head is “why the hell should I bother” and I’ll spend a good chunk of time focusing on the negative aspects of whatever I’m doing. After a while though I’ll just try to do a feel small things, a few quick wins to get me back into the mindset of getting things done. After that it’s usually pretty easy going (this usually takes about 2 weeks) until I hit a wall again or I feel like getting my weekends back for a while so I can relax and get my head back together. The last few iterations of this cycle are what lead to the 3 major revisions of what is now Lobaco.

This time however was different. After being back for 2 weeks and being firmly thrust back into the world that had barely changed since I had left (even though I expected it to be wildly different,  for some reason) I still really couldn’t get into coding without feeling like I should be doing something else. My usual routine of getting a couple quick wins with the API and web UI didn’t translate into jumping back onto my MacBook and smashing out some iPhone code. Instead I started wondering whether or not a native client was the way to go and the possibility of doing a web based client for the phone itself. I had been down this road before and ultimately found that whilst iPhone programming was a world away from I’d done before the progress I had made with only a couple weeks of effort was far more encouraging than the same amount of time spent trying to wrangle HTML5 and Javascript into something workable.

Then along came Sencha.

I was going through my 700+ post backlog of Techcrunch articles when I came across this one about Sencha, a web startup that just released their Touch framework which provides the basis for building native looking applications in HTML5 and Javascript. Thinking this might be my salvation to writing native clients for all handsets I quickly downloaded the framework and started hacking around to get something workable. I was able to get the example running in one weekend and made a few modifications but I didn’t get into the real meat of it until last Friday night. After managing to replicate the UI I had built in objective-c within the Sencha framework I uploaded it to my web server to see what it would look like on the iPhone and instantly I realised what was wrong.

This client was just an elaborate way of procrastinating.

Now whilst the client looked decent and didn’t take too much to set up it didn’t look anywhere near as good as my native app nor could it hold a candle to its performance. Sure my hack job probably ensured that the performance wasn’t as good as it could be but in comparison to the native client hack job I did it was pretty stunning. After coming to that realisation I booted up my MacBook to start getting acquainted with Xcode again and spent last weekend coding up some performance improvements¹ for it which I had put off before I left for the USA. I’m sure this won’t stop me from looking at going down that path in the future but I can at least rest easier now that I’m feeling the urge to program once again.

It’s been a weird learning experience for me since I’m usually pretty good at knowing when I’m procrastinating. Usually I have a good reason for it (like having 1 bit of work to do and not doing it since it’s not due for months) but this is the first time I caught myself doing something I thought was useful when really I was just making excuses for doing the work I knew needed to be done. With a good week of holidays coming up over the Christmas/New Year period this realisation couldn’t have come at a better time and I’m looking forward to making the most of my time off with the hope that the momentum will carry me on into the new year.

¹I’m going to do a big post about this hopefully tomorrow. I hit some really, really esoteric problems getting everything to work but I have and the results are, to put it bluntly, bloody amazing.