Building a Ti Mobile App: GrillTime, part 1

I am an avid griller, and I’ve always wanted an app to help me cook up a great New York Strip steak or other delicious dishes on the grill. There are a couple of things I need all the time:

  • a versatile timer
  • cooking temperature guide

I have seen timers on the markets, but none do quite what I want. And for some reason, I can never remember the safe cooking temperatures for poultry, pork, beef, etc. So if I could build one app that has all of this at my fingertips, I’d get a lot of use out of it. So I saw this as a good opportunity to build an app in tutorial form so everyone can see the kinds of steps you take to build a Titanium Mobile app.

Continue reading “Building a Ti Mobile App: GrillTime, part 1”

Titanium Mobile Utility Library: TitanUp

In building my first commercial app with Titanium Mobile, I ran into what I felt were some gaps in the API which I sought to fill with some library code. These classes and functions became so central to what I was doing that I felt they could be reusable in nearly any Titanium Mobile app. I named the library TitanUp, and I am making it available here to anybody who wants to use it, borrow from it, or extend it.

Continue reading “Titanium Mobile Utility Library: TitanUp”

Titanium Mobile – Beyond the Prototype

Appcelerator’s Titanium Mobile is a powerful toolkit for building cross-platform mobile applications. Using Javascript, which is familiar to many developers, you can build native applications on iOS and Android without learning the intricacies of the native SDKs.

Many developers dive into the product without steeping themselves in Appcelerator’s philosophy, which can be a mistake. Over time (after reading hundreds of Q&A threads, blogposts, API documentation, guides, JIRA reports, and even source code), the developer starts to form a more complete picture of the platform and finds the best ways to structure his code. This guide is intended to jumpstart that process, to help you get from quick-n-dirty prototype to a fully functioning mobile app.

Continue reading “Titanium Mobile – Beyond the Prototype”

Titanium Mobile – Extending Views with CommonJS

When you’re building an intricate user interface with Titanium Mobile, you’ll absolutely want to organize your UI elements into well-designed CommonJS modules. This makes it easy to reuse components throughout your app and even across other apps. It’s also a lot easier for maintainers to deal with it if you organize it well.

Continue reading “Titanium Mobile – Extending Views with CommonJS”

Titanium Mobile – CommonJS Fundamentals

For many developers, a Titanium mobile project might be their first exposure to serious object-oriented programming in Javascript. They may have even used a framework like jquery or mootools (or if they’re really lucky, qooxdoo — check it out sometime). But most of the time, even if you’re using those frameworks, you don’t have to do a lot of your own class definitions.

It’s critical in Titanium Mobile that you follow best practices in your application design. There are three different methods that have been used by Titanium Mobile developers during its relatively short lifetime. There is really only one you should use at this point; I will cover the others so that you can recognize them when you encounter them online (there are still people using these techniques).

  • multi-context: open a window with the "url" property set to a Javascript file; this results in a new Javascript context being created for the file to run in. DON’T DO THIS!
  • namespacing: create a global variable and add properties to that global variable via modules that you include() into your code. DON’T DO THIS!
  • CommonJS: build modules that are each isolated from the global namespace and explicitly define the interface for that module. DO THIS!

More information on these strategies is found here:!/guide/Coding_Strategies

All guidance from Appcelerator points to using CommonJS modules. It is the best way to build a robust single-context application that is free from nasty memory management issues.

So how do you structure your modules? I will illustrate a number of different techniques here.

Continue reading “Titanium Mobile – CommonJS Fundamentals”