Practice Safe Subclassing: NSTableView Row Highlighting

Even though hand crafting source lists are a lost art on Leopard (since the look is now offered natively in AppKit), for cross-developed applications or other styling needs, I’d to demonstrate a safe and sturdy technique for custom drawn NSTableView row highlights.

One seemingly always overlooked fact about NSTableView subclassing is that custom row highlighting can be achieved solely by overriding public, documented methods on 10.4 and above. A decent number of NSTableView subclasses I’ve come across, mainly source list implementations, accomplish customized row highlighting by stepping in the way of the superclass’s normal highlight drawing process by overriding a private and undocumented method called “-_highlightColorForCell.”

Continue reading…

Continue reading » · Rating: · Written on: 04-20-08 · No Comments »

Make Your Own Abstract Factory Class Cluster in Objective-C

Crafting software is more than just mastering the syntax of any given language – the overall architecture, relationships and interaction among an application’s source code weigh in heavily to define true engineering elegance. A winning design is often harder to achieve than superior syntax, since the solutions are not as clear cut and mistakes are not immediately obvious. No compiler can warn us of poor architectural and design decisions, we instead realize such problems maintaining our code in the future. Thankfully, design principles and patterns exist to help us write elegant software.

One design template relied upon heavily by Cocoa’s Foundation framework is the class cluster, which is implemented in a manner consistent with the Abstract Factory design pattern. I’d like to explain how you’d actually go about rolling one of these yourself, and also touch on some of the motivating factors for introducing such a pattern into your own application. Later, I’ll relate to a real-world example of a class-cluster I designed for use in Camino to support the flexible parsing of search engine plugins.

Continue reading…

Continue reading » · Rating: · Written on: 04-20-08 · No Comments »

The First Post

Well, it’s been a goal of mine for quite some time to start up a weblog, mainly to express the many Cocoa development related thoughts flying around inside of my head.  I thoroughly enjoy reading the rich diversity of developer blogs in the Mac OS X community, especially when I come across an awesome and in-depth technically focused article.  I hope to contribute a few drops of my own into this vast ocean of information.

A little background about who I am, and my experience:

Programming in Cocoa and Objective-C has been my main focus (and eventually, job) since 2004.  I’m extremely passionate about the Mac platform, foremost as a developer, but also as a user.  Currently, my main source of fame in the Cocoa community is my position as a member of Camino’s programming team.  Elsewhere, I’m active on the Cocoa-Dev mailing list trying to help out when I can.

When I’m not writing code I’m usually outside, hanging around on a horse farm where I’m lucky enough to be the best friend (owner) of a quarter horse named Dude (that red guy with me, above).  I’m also found hiking in the awesome Pennsylvania mountains with my golden-retriever Casey, or giving out “lap time” to a few cat friends I fell in love with and brought home from the barn.  I work part-time taking care of the 18 horses on the farm,  and often wonder if perhaps I’m the only horse farmer / Cocoa developer that exists.  Anyway, my passions in life are divvied among software development, animals, nature, environmentalism, healthy eating, and hockey.  That’s me in a paragraph!

I should give a shout and admit that I was further motivated by Daniel Jalkut’s No More Excuses post.  The rest of my inspiration came from the fact that there’s a shortage of fellow Cocoa developers to share my thoughts with in Northeast PA, and I can only bore my friends and family with so much ;)

Anyway, on my home page you’ll find out more about me, including photos and a resume.   Thanks for taking time to stop by and listen to what I have to say.

Continue reading » · Rating: · Written on: 04-20-08 · No Comments »