tags:

views:

71

answers:

4

Given that applications for mobile devices are expected to be small and simple, often with heavy computation off-loaded to a web-service.

  • Is OO, over and above frameworks such as J2ME, relevant to mobile application programming ?

  • Would application specific frameworks, say for client specific customization, not be an avoidable overhead, particularly when an existing framework (J2ME) itself is already available?

  • Are there any J2ME frameworks available e.g. Struts etc?

+3  A: 

Object Oriented programing, in and of itself, does not imply any specific overhead. It's merely a methodology. You can create programs which use an OO design methodology which are still fast and simple, just as you can create non-OO programs which are slow and kludgy.

Amber
Just updated me question with a couple of follow-ups
Everyone
A: 

Well J2ME is Java and therefore is OO. You can write code in a procedural way in OO land, but that isn't really the point now is it? If you don't want to do OO switch to Python.

Woot4Moo
Python is just as OO as Java, if not more. IIRC it doesn't have any primitive data types that aren't objects, like Java does.
Kaleb Brasee
python is also a scripting language. On account of he decided to mention J2ME I figured it would be a fair comparison. Since Java is compiled Python is not.
Woot4Moo
+1  A: 

Sure, use OO (it is Java after all), but you have to be a little bit more careful, as space and memory are limited for J2ME. A judicious uses of classes is good, but don't go overboard with those things that have classes that create factories that generate other things, etc... etc... That's actually something I like about J2ME: you can't go overboard with the "architecture astronaut" stuff.

David N. Welton
A: 

As Mr. Knuth said it, "premature optimization is the root of all evil".

Similarly, just because you encounter a new platform, J2ME in this case, it makes no sense to forget everything about how to write good software and go back to the global-everything-procedural-everything-orgy.

Sure, use your brain, and don't do things that you wouldn't do on the desktop (e.g. java memleaks by spawning craploads of objects and forgetting to get rid of refs to them, or, just as bad, simply spawning loads of objects indiscriminately). Factories creating factories creating factories might however not be as stupid as it sounds, especially if the reason you're doing that is because it helps you write lots of unit tests. (And yes, do write unit tests on J2ME!)

And responding to David N. Welton a few answers up, "architecture astronaut", or over-engineering, doesn't have to ever happen if you go with the good old iterative approach -- don't make things more complex until it measurably simplifies your life.

So to sum up, my feeling is that everybody is just using the "memory and space constraints" on J2ME and Blackberry to toss the good sense out the window and write crappy, un-navigable software. I assure you that if you go the iterative way and test your app every so often you will notice when the performance becomes unsatisfactory and take appropriate measures at that point. And the chances are, the performance issue will be due to you doing something stupid and not due to the abstractions.

Disclaimer: if you ARE reading this from 1999, writing for CLDC 1.0 with 1KB of mem, or for a JavaCard, disregard all of the above. If however you're running on any feature-phone of today, you're in luck!

Paul Milovanov