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…]
by Bill Dawson on 11 May 2013
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…]
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…]
by Bill Dawson on 15 April 2013
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…]