Post image for Fun with meld.js and AOP in Titanium JavaScript

Fun with meld.js and AOP in Titanium JavaScript

by Bill Dawson on 21 May 2013

If you have played around with Aspect-oriented Programming (AOP), you are familiar with the idea of “cross-cutting concerns”. These are the kinds of things you almost always have to do in your programming work but which are typically a PITA when it comes to trying your best to keep your code modular and respectful of the Law of Demeter.

Logging and instrumentation are the classic examples. During testing (or even in production) you might want to log every method call and/or check the performance of key parts of your program. But it’s painful to start cluttering up your wonderfully modular objects and methods with lines of code which are not relevant to their core concerns. If you have a method which deducts a withdrawal from a bank account balance, you want every line of code in that method to be relevant only to deducting from the balance. You don’t want to pollute the method with log statements or instrumentation code, neither of which would be considered a core concern.

[click to continue…]


This is just an update regarding my tijasmine Titanium wrapper for the Jasmine JavaScript BDD library.

At the time that I first mentioned tijasmine, it was based on the alpha version of Jasmine 2.0. I’ve since changed it so that it’s now based on the most current public release of Jasmine, which is 1.3.1. At the time of this writing, if you visit the Jasmine site, you see the page of documentation with several example test specs, and those are running against 1.3.1. So I thought it would make more sense (obviously) to base tijasmine on the documented version of Jasmine!

[click to continue…]

{ Comments on this entry are closed }

Stopwatch 2 by Flickr user casey.marshall. License: Attribution 2.0 Generic (CC BY 2.0).

Using Custom Titanium Modules for Performance

by Bill Dawson on 23 April 2013

Yet another reason why one might consider creating a custom Titanium module is if a piece of performance-critical code turns out to be faster when run in a module versus in standard Titanium JavaScript.

As an example, I wanted to test out using a custom Titanium Android module for a simple http GET versus doing the same thing in the standard Titanium.Network.HTTPClient. For my test, I chose the Sunlight Foundations “Capitol Words” API. The app is quite simple: it makes 5 successive calls to the capitol words endpoint, searching for “fiscal cliff” as a term. It tracks the elapsed time for each call and totals them all up, then reports the total time at the end. Here’s the simple test function:

[click to continue…]


This has likely been done before somewhere, but I’ve gone ahead anyway and created a little CommonJS module called tijasmine which provides a way to run jasmine (Javascript BDD framework) test suites in an Appcelerator Titanium application. I also want to give credit to Aaron Saunders and his ci.behave.test repo at Github, which inspired me to continue with tijasmine.

[click to continue…]

{ Comments on this entry are closed }

More Fun with Mixed Titanium Android Modules

April 8, 2013
Thumbnail image for More Fun with Mixed Titanium Android Modules

In my previous post, Overcoming TIMOB-13097 in Titanium Android Modules, I discussed adding Javascript to your Titanium Android module in order to overcome a particular problem (see the post for details.) In this post I want to expand on the idea of “mixed” (Java and Javascript) modules by suggesting a few other ways in which […]

Read the full article →

Overcoming TIMOB-13097 in Titanium Android modules

March 29, 2013
Thumbnail image for Overcoming TIMOB-13097 in Titanium Android modules

When developing a Titanium Android module, you may wish to include a mechanism to instantiate one of your proxy classes by means other than the typical module.createMyProxy({…}) method call. For example, you may wish to have a singleton proxy instance of sorts. There is at least one example of this in Titanium itself: the displayCaps […]

Read the full article →

Titanium Android Animation: An Alternative Module

March 22, 2013
Thumbnail image for Titanium Android Animation: An Alternative Module

[UPDATE Feb 2014: I stopped working with Titanium some time ago and so this module is not supported, though I’ll keep it up on Github of course in case others are interested in forking it.] I’m a fan of using external modules to get access to native platform features that might sometimes be difficult to […]

Read the full article →

Titanium CoffeeScript Compiler Plugin – Also for Desktop

April 19, 2011

In the Titanium CoffeeScript Compiler Plugin post from yesterday I introduced the plugin and described how to install it and use it for Titanium Mobile applications. Since then, I’ve had some inquiries concerning whether the plugin can be used for Titanium Desktop. Titanium Desktop does not support the registering and use of <plugins> in your […]

Read the full article →

Titanium CoffeeScript Plugin

April 18, 2011
Thumbnail image for Titanium CoffeeScript Plugin

I’ve created a small plugin for Titanium Mobile which will scan your Resources/ folder (and sub-folders) at build time and, if it finds any CoffeeScript .coffee files, will run the coffee compiler on them to produce the .js files. Since build plugins run before the platform-specific build system kicks in, this actually works. Find the […]

Read the full article →

Titanium Mobile 1.3 Android Preview Part 3: Vertical Layouts

May 5, 2010

This is Part 3 of a series of posts about what’s coming up for Android development in the new Appcelerator Titanium Mobile SDK 1.3, which should be pushed out this week. This time I’m featuring vertical layouts, which were implemented by Marshall Culpepper (@marshall_law.)

Read the full article →