One of the most useful features of ActionController is the ability to add filters before, after, or around actions.  This tool is made even more powerful by the ability to chain filters together.  Allowing an AOP approach is indispensable for addressing cross cutting concerns (or simply separating concerns), and is one of the things which makes a framework valuable to a developer (Spring is an excellent example of this).

A while back, I had a requirement to persist a record of which email addresses were sent an email through the system.  I expected to find callback support for ActionMailer, but was surprised to find that it didn’t exist.

I had three options: put the logic inline in each ActionMailer method which is not DRY and muddles concerns, put the logic in the ActionContoller as filters which break encapsulation in terrible ways (and is at the wrong layer), or extend ActionMailler to allow callback methods.

I choose the latter…


Just a quick note that the next two testing interviews are up on the Rails Prescriptions Blog:

Geoffrey Grosenbach of PeepCode and Topfunky.

Gregg Pollack of Rails Envy, the Rails Envy Podcast and Rails Activist fame.


Change has come to America, and so, too has it come to, the official website of the President of the United States.

One minute into the 44th Presidency, the website sports a radically new look (I’d love to hear how that was handled), and all the neccesary updates as a new administration moves in have already been made.   But the changes promise to be much more than cosmetic.  According to a statement on the White House Blog, Macon Phillips, the Director of New Media for the White House, “Millions of Americans have powered President Obama’s journey to the White House, many taking advantage of the internet to play a role in shaping our country’s future. is just the beginning of the new administration’s efforts to expand and deepen this online engagement.”

Efforts will be made so that “puts citizens first” through three main priorities.  Again, from the same statement:

“Communication — Americans are eager for information about the state of the economy, national security and a host of other issues. This site will feature timely and in-depth content meant to keep everyone up-to-date and educated. Check out the briefing room, keep tabs on the blog (RSS feed) and take a moment to sign up for e-mail updates from the President and his administration so you can be sure to know about major announcements and decisions.

Transparency — President Obama has committed to making his administration the most open and transparent in history, and will play a major role in delivering on that promise. The President’s executive orders and proclamations will be published for everyone to review, and that’s just the beginning of our efforts to provide a window for all Americans into the business of the government. You can also learn about some of the senior leadership in the new administration and about the President’s policy priorities.

Participation — President Obama started his career as a community organizer on the South Side of Chicago, where he saw firsthand what people can do when they come together for a common cause. Citizen participation will be a priority for the Administration, and the internet will play an important role in that. One significant addition to reflects a campaign promise from the President: we will publish all non-emergency legislation to the website for five days, and allow the public to review and comment before the President signs it.”
Read the full statement

I may have visited three or four times in my life, but I’ll be back quite a bit after reading this, excited and hopeful about the ways that the new administration will use technology to connect to the people.

Mandelbrot Set

While designing software it’s easy to fall into the trap of iterative development. Iterative development allows us to work quickly, exchanging rigorous requirements-gathering for rapid design and development — and as good developers, it is our responsibility to make sure that the code we create now works well with future iterations of our program. However, I find that code created as part of this process can frequently be too complicated, too generalized, or both. When creating agile software we must keep in mind the requirements of the future, but design strictly for the requirements of the present. If we are snared by the trap of iterative development, we risk wasting time, money, and people on code that may not be useful in the future — or, even worse, code that the client doesn’t want and can’t use.


iPhone in Dock

Testing your iPhone application, you may at some point in time need to stub a method call whose return type is a boolean (or some scalar value, or C based structure). The way to implement this (as described in a discussion on CocoaDev here) is to wrap the boolean in an NSValue using the OCMOCK_VALUE() macro defined in OCMockRecorder.h.

While this solution technically works, I find that doing this within the test class itself makes the test cases a little less readable along the way. Instead, I found it useful to extend OCMock to do this type of conversion for me, keeping my test code a bit cleaner as a result.

Let’s take a look at an example by examining the set up for a simple test case..


book cover

In Core Animation for Mac OS X and the iPhone, Bill Dudney gives a good introduction to the Core Animation framework and some of the slick ways that you can spice up a Cocoa app for Mac OSX or the iPhone. Its assumed that you know your way around Xcode, and that you know the basics of Cocoa programming. So if you are new to Cocoa you may want to have a copy of Cocoa Programming for Mac OS X handy, but you can get your hands on the code examples from Pragmatic Screencasts if you want to try and work your way through it.

The book gives a fair overview of the Core Animation framework, and helps to get you through some of the less intuitive parts. It quickly walks you through a few different examples of developing animation apps for the mac and then explains the differences and limitations of writing for the iPhone. I would also suggest reading through the apple docs which will help you understand some of the other tools available to you and also read more details on what you are working with.

Its a quick read, coming in at only 200 pages, and a lot of those pages are full-page images. Personally, I was hoping for a more thorough review and examples for the iPhone, and was dissapointed that there are only like 14 pages in the iPhone chapter, and 7 of them are a full page of a single image. (I think that might have something to do with the time the book was written and the state of the NDA for iPhone developers, but still I was disappointed).  You can get the pdf directly from the PragmaticProgrammers site, but you might want to check Amazon too.

Overall, I think the book gives a decent start to some animation concepts, and ways to improve your iPhone apps, but you might want to hold off on getting it now, and work your way through the existing docs and other sites first. I suspect the next generation of docs on this topic will have a much deeper review and will be worth the wait.

Now I’m looking for something that can give me a good overview of using OpenGL for the iPhone or something like Blender or Unity3d.

Related Services: iPhone Application Development, Custom Software Development

jQuery logo

I’m as geeked about jQuery’s 1.3 release as the next developer. But I’m even more excited about the new API browser developed by Remy Sharp and available here.

For as long as I’ve been a jQuery user – going on 18 months now – I’ve been frustrated by the slow speed and sometimes intermittent availability of the jQuery documentation site. Now we’ve got a blazing-fast API browser that presents jQuery Core and jQuery UI side by side in the same cool interface. Better yet, it’s available as an Adobe AIR app for offline viewing. Sweet!

I could quibble about the lack of bookmarkable URLs and the occasionally sparse documentation of corner cases. Instead, I’ll just remain upbeat about this huge step in the right direction. No matter how intuitive jQuery’s API, it’s a powerful library whose roster of methods continues to grow. Nothing speeds up development faster than quick, persistent access to quality API documentation.

jQuery logo

jQuery celebrated its third birthday Wednesday with the release of the brand-new 1.3 version. This latest release includes a bunch of cool new stuff which has already been discussed to death elsewhere. To me, however, the most interesting aspect of jQuery 1.3 is the movement of former plugin functionality to the core library.

Live events are a new twist on the venerable, and indispensable, Live Query plugin, while the upgraded, more granular effects queues were previously tackled by add-on authors. IMHO, this kind of migration is A Good Thing, providing greater parity with other core JavaScript and effects libraries (such as Scriptaculous’s FX queue) while offering compelling feature differentiation (event binding throughout the full lifecycle of an Ajax page).

Over at the Rails Prescriptions blog, I’m going to be posting a series of interviews with various and sundry Rails folks — I’m cross-posting the first one here. To get the series started off, I’ve decided to use myself as a guinea pig and see if I can hold up to the grilling.

A couple of quick notes before I get to it.

  • The free e-book Getting Started With Rails Testing is now available. Check it out.
  • Those of you lucky enough to be in the sub-zero Chicago area can come to the Chicago meetup Saturday, January 17th to hear lots of interesting stuff, including me talking about testing and Rails some more.

And on with the interview.

I’ve used the ILog Business Rules products on a number of projects. Reasonable software. Does the job. Not exactly cheap. I’m not sure why they went for the aquisition by IBM — it was announced back at the end of July, so likely nothing to do with hard economic times.

What does this mean for software developers and system integrators? Back when the aquisition plans were first announced, I joked that we would soon be using WebSphere rules. And wouldn’t you know it, the aquisition announcement mentions ILog and WebSphere in the same sentence several times.