Good mobile software is frugal

All software development requires discipline. Attention to detail,  adhering to important conventions, and the willingness to do things the right way are necessary traits for any software developer worthy of the title. But if you are writing code that will be run on a modern desktop, laptop, or server you don’t need to worry too much about writing frugal code. Not only are those computing beasts, but they’re usually plugged into a power outlet.

That all changes when you are writing code that will run on a battery-powered device with (relatively speaking) significantly less horsepower. Your code should follow Einstein’s famous advice of only doing what needs to be done; nothing more, nothing less. Every line of code that runs will suck some juice out of the battery. Every object created brings your app that much closer to using up the available memory, putting your process at risk of being killed by the operating system.

Some developers new to, or unfamiliar with, iOS development consider Objective-C to be some dinosaur language that Apple hasn’t bothered replacing with something more “modern” such as Java or C#. They are wrong. Objective-C, which is C with some object-oriented syntax accompanied by a lightweight runtime, does not burden the device with a garbage collector, JIT compiler, etc. Those luxuries can be great for desktop and server programming, but are overkill for mobile devices.

In the mobile world, Responsiveness is king and the Battery is his queen. Every line of code you write should aim to satisfy those two masters. Write frugal code. Your users will appreciate it.

This entry was posted in Objective-C. Bookmark the permalink.

3 Responses to Good mobile software is frugal

  1. Joe King says:

    Are you talking primarily about Abobe Flex/MonoTouch developers or about the developers who choose to create hybrid apps using HTML/JavaScript and xxx (PhoneGap etc)?

  2. Josh Smith says:

    I think this advice applies to any developer writing mobile software. The specifics of this or that technology don’t change the fact that mobile devices have limited hardware capabilities.

  3. Olga says:

    Hmm, as I see for Android, Java runtime works good even on very cheap and unsophisiticated devices, so why would anyone want to bother with native language and it’s pitfalls? And IMO, Apple has absolutely no excuse to still push Objective-C down developer’s throats on Mac desktops. Personally I envy your boldness anyway, since I would never touch something so outdated and so stale (remembering your blog post NS prefixes… is Apple *really* using same old libraries from 1996 when it bought NeXTstep as the core functuionality of their core developemnt tool?) when it bought after being used to luxuries of C#. To me, even if garbage collection might be an unaffordable luxury on mobile devices, anonymous functions, lambda expressions, safe functional references, event support is an absolute must in any language, and vector graphics support is an absolute must in any self-respecting IDE, regardless of the fact if it has garbage collection or manual memory management. I am not a Microsoft fanboy, and I do realize that Microsoft updates are too frequent, too breaking, and sometimes plain thoughtless just for the sake of an update, and that Microsoft lost the platform wars, and that .NET and C# might as well disappear completely in matter of years, if not months, but, IMO, Apple ultraconservatism and aboslute lack of innovation in term of development tools is something way worse then what Microsoft are doing. It was same Objective-C in 1996, it’s same Objective-C now, and I am totally sure it will be same old Objective-C in 10, same old Objective-C in 20 years, and etc. etc. etc. I would certainly not want to be a developer for such conservative company. It is really sad they have market share now, and I don’t see myself touching it with a 10 foot pole even if Apple gets close to 100% market share. Now I just really, really want Google to win that platform war, since it seems like they have most innovation now. They at least try to make something new 🙂
    Sincerely yours, sad and disillusioned developer.

Comments are closed.