Developing for Mobile with the aim of achieving the best performance

A continuation of the last post on mobile programming tips.. <tags> Mobile Programming, Symbian, J2ME ……

Here are some ways to code with the aim to achieve the best performance;

  • Use local variables since it is quicker to access them than accessing class members
  • Avoid string concatenation since it decreases performance and can increase the application’s peak memory usage.
  • Use threads and avoid synchronization. Any operation that takes more than a-tenth of a second to run requires its separate thread.
  • Separate the model using the model-view-controller (MVC) to separate the logic from the code that controls the application.
  • Optimization should only be done at the very last stage. Only optimize when you need to, that is, when you find that the app runs too slow, or the jar is too big. The speed of operations depends on the implementation of the K virtual Machine(KVM) of the phone, which often is optimised to make common operations faster. So don’t assume that certain operations are slower than others.
  • Avoid code duplication. Sometimes the big size of code base is caused by duplicating your code. To do this, create a sub-class which holds methods common to many of your specific classes and extend it. Try to understand the logic of sub-classing as a way of re-using the code then it will be easier to figure how/when/why you should put code in a method. Programmers may take advantage of sub-typing to write code in a more abstract manner than would be possible without it.

And as I see it, Object Oriented Programming (OOP) is more a way of ‘thinking’ instead of a set rule of how to program. You can apply the logic of OOP even when you only have a single class by properly naming the methods and thinking ahead so you reuse general bits of the code.

Remember the usability of the app, its loading speed and the same user experience across all phones. Generally, fastness of the app does not mean its not heavy (in size)… 🙂

A software developer must be part writer and poet, part salesperson and public speaker, part artist and designer, and always equal parts logic and empathy.” Jonathan Wise.

This post is open for additional comments and or criticism according to one’s user experience with developing mobile apps.

Tagged , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: