Iowa Code Camp Slides are Up!

I’ll be speaking at the Spring 2011 Iowa Code Camp on “Developing with Objective-C 2.0 for Mac OS X and iPhone OS”. Check out the slides here. I’ve also started a list of good Mac OS X and iOS development links. Hope you’re registered for the event - it promises to be lots of fun and learning! Enjoy!

Test-Driven Development - A Win!

I’ve been working on a set of Java classes to parse meteorological reports. I also decided to use the Eclipse Java Development environment for the first time to write these classes, and I can say that I’m very pleased with the integration of smart features such as:
  • “Quick Fix” which suggests code amendments on request – such as adding class imports, declaring new classes, and the like.
  • “Refactor” which lets me rename a class and automatically rename the class file as well, since Java wants it that way. Lots more capabilities in refactoring – will be looking at that soon!
  • Java debugging with breakpoints in Eclipse – I came from the “old school” way of gdb and text based debugging. Printf statements anyone? I still use printf’s to output tracing statements even when there’s debugging capabilities in XCode or Visual Studio.
But the most important feature I’ve realised is that of Test-Driven Development. In the old days, we’d write test cases to exercise our code. This was quite cumbersome as developers had to write code to do the test, including comparisons to make sure that the result of the test was correct. This took lots of time and you tend to spend just as much time writing the test code and test support functions as the actual code itself.

With the advent of Test-Driven Development and the plethora of tools supporting that methodology, testing becomes easy, almost fun! Key mantra:

Make something easy to use, it becomes an enabler

In my case, I used the built-in JUnit integration which Eclipse provides. I can right click on a class file, ask for a JUnit test to be created, and designate which Java package the resulting JUnit test class file is to be added to. What you do to write a test case is to simply write a Java function to exercise the function being tested.

I started using JUnit 3 and finally settled on JUnit 4 which uses annotations – part of Java 5.0 – to designate which test case functions are to be run by JUnit.

JUnit example after the break – more...

WAVE Analysis

Just analysed this page using the WAVE web accessibility evaluation tool. Passed!!! Yay!! Thanks again Allison!

Image Title reload rehash

Since Image Title works by inserting title attributes to image tags when the page loads, if you mouse over images (say on this site) immediately after you install it - the title text may not appear. This is because Image Title hasn’t tweaked the image tags for pre-existing pages. Just do a reload and all will be well from henceforth.

Image Title Source Code

Just added the source code to the Image Title Extension - it uses an injected end script. See the Safari Extensions Development Guide.

Image Title Safari Extension

I just created my first Safari Extension. It’s called Image Title and was inspired by Allison Sheridan’s presentation on “How to Increase Your Audience Through Accessibility” at Blog World Expo which she incorporated into NosillaCast #282.

This extension takes the Alt Text and adds a Title attribute with that text to the image tag. This lets Safari put up a tool tip popup with the Alt Text when you mouse over the image. Neat huh? To check that it works after you install, be sure to mouse over the images on my blog and see the secret Alt Text appear!

Do check out my Software page - it’s new! I’ll add more!

OO Coding and Software Principles

Tim Barcz tweeted:

Agree or NO? "Interestingly with the influx of developers moving into OO coding there seems to be a revival of software principles"

Agree wholeheartedly! Here are some considerations:
  • OO coding brings in rigour in coding practices - leading to implicit adoption of good coding methodology.
  • Starting on learning something different and new, such as OO methodologies, may lead to developer to explore and learn good software principles, especially when OO methodologies are closely associated with software principles.
  • OO practitioners are by and large well founded in software principles - so a developer moving to the OO coding methodology would be motivated to adopt good software principles.

QuickTime Development in Windows XP

Sometimes we just have to do Windows... One of the tasks at work was to design and implement a video player that would synchronise video playback across a number of computers (under Windows XP of course...). Naturally the video player engine would be QuickTime, of course! Fortunately Apple’s Windows implementation of QuickTime came with a number of ActiveX components and controls. However, I’m still using Microsoft’s (ugh) Visual Studio .NET 2003 (VS 2003) - because it works... There is little or no information in the Microsoft documentation or website about how to install controls onto the Toolbox so I can drag and drop them into my Form.

Did some judicious websearching and came up with this link: “The easy way to add controls to the VS2005 Toolbox” - which also works for VS 2003. Just drag and drop the DLLs into the Toolbox and voila - they appear! Easy yet quite obscure... Apparently the “Add Item” command works with VS 2005 but I haven’t tried it in VS 2003.

Back from Iowa Code Camp

What an exciting, thought provoking and tech-infused day. Met lots of people, made new connections, revisited existing ones...

Re: my iPhone dev talk, here’s the link to the Apple Developer site’s iPhone 101 PDF file. Enjoy! Hope my talk today was useful!

Day before Iowa Code Camp

See you all at the Iowa Code Camp tomorrow (May 1) at the Iowa Memorial Union in Iowa City. I’ll be presenting a seminar on “Hands on iPhone Development”. Looks like a really technology and learning packed day. Check out the Downloads and Video areas here for the presentation.

Programmer's Cheat Sheets

Check out these two sites for programmer cheat sheets:


I sourced the two Objective-C cheat sheets from the first site:

Objective-C Reference Card for Java Programmers (PDF)


Beginners iPhone Objective-C 2.0 Cheat Sheet V4 (PDF)

Iowa Code Camp 5: Call for Speakers

The Call for Speakers for Iowa Code Camp 5 to be held at the Iowa Memorial Union in Iowa City on Saturday, May 1 has been posted. Looking to submit a couple or so topics... Mac / iPhone related and maybe something fundamental... See you there!

On Leadership and software

Tim Barcz (@timbarcz on Twitter) asked “What does leadership in software look like to you? Technical expertise only? explain. enlighten.”

Here’s what I mused over...

Leadership by virtue of its general appellation, means to me to inspire, motivate and direct a group. Technical expertise is only a small fraction of the role. Inspiration lets you lead by example, the way you solve problems, write code, hold conversations, run meetings and even handle your e-mail (yup, welcome to the Inbox Zero crowd!). Your team members and peers will certainly take notice and perhaps begin to emulate. It’s a tough job - you have to be on your toes to make sure that you’re being a good role model and that any detractions are noted and rectified - it’s the way to get better. Inspire - lead by example.

Motivation is a little different, to me, than inspiration - it’s when you have to get your team going as a focussed entity to solve a problem. Communication is key here - making sure that everyone knows what is required of them and of the team as a whole.

Direct - this is where you have to set goals and determine actions to be performed to achieve those goals. Milestones, project and resource management come into play here.

One of the nice things about working in a large corporation is that you get to attend really interesting courses. The recent Personal Leadership course I took changed my skeptical outlook on the value of these courses. Sure there were the usual (maybe trite at times) team building and icebreaker exercises but the key takeaways from the course were often intangible - networking, collaboration and communication. I wound up being introspective into my role in the group and charted a plan of action to improve. The 270º survey (self, bosses and peers) was extremely helpful - letting me know my strengths and where I needed to improve.

Currently Reading

I'm re-reading "Object Oriented Programming: An Evolutionary Approach" by Brad Cox. This was published in 1986 and featured Objective-C as the language of discourse. I read it back in 1987 and object orientation was a little hard to understand. My computer science education to that point was procedural languages and standard data structures. There was some foreshadowing of OOP while I was programming Mac OS 6 at that time - especially with my own popup menus and calling functions with a passed structure describing the state of the popup menu, and there were some calls in the Mac OS Toolbox (Dialog and Control Manager) which were of that type.

Things covered:

  • Loose vs tight coupling
  • Software ICs - these are reusable object classes, usually generic.
  • Dynamic vs Static Binding
  • I'm resonating with the concepts in the book - goes to show that even after 20 years on, things are still valid.

CRineta Bookclub

The Cedar Rapids .Net group (CRineta) is holding a monthly bookclub at Roaster's. We're presently reading "Foundations of Programming" by Karl Seguin. It's available for download from his blog.

The book is extremely .Net centric with respect to examples and focus.

That aside, there are some nuggets of information for us five-percenters (i.e. Mac folk) - we've read the first four chapters so far and here's what I have found:

  • Domain driven design (versus data driven design) - it's important to always keep in mind the end user of your product. Remember that they are the ones who will ultimately be subjected to your application. Software developers tend to be very effective in getting the code to interact with the data, not so much with the users. My take is that sound techniques such as use-case analyses and requirements drive the design of the application rather letting data dictate that.
  • Let requirements drive the design - YAGNI (You Aren’t Going to Need It) referenced on pages 8-9 illustrates the need to come up with a good understanding of the requirements. The YAGNI concept refers to the extent to which you should make your application flexible and adaptable - having requirements will bound that flexibility. The other nice thing about requirements is that they let you derive function pre- and post- conditions which then let you construct unit tests.
  • Many concepts come up over and over in software development - such as cohesion and coupling. I studied these in University back in 1984 under Structured Analysis. Do we forget these concepts only to re-discover them? Do we not teach them to our students?
  • Interfaces let you exchange implementations - especially if you need to build pseudo object classes (called mocking) for testing. Note: interfaces are not a .Net thing - you can apply them in Objective-C, Java and C++ to mention those I know of.
  • Persistence is a good thing but don't let that drive your design. Use Mac OS X's Core Data judiciously to handle data persistence. The section on persistence illustrates the fallacies of going nitty gritty into the depths of SQL (the M$ way) - think NSObjects and let Core Data store them for you.
  • Dependency rejection - this chapter mentions StructureMap as a means of enabling mock objects. While that's a nice add-on suite for the .Net world, think about using class inheritance and interfaces in Objective-C for example, to build mock objects. I haven't investigated if there are equivalents for Cocoa but will post an entry when I find one. One word of caution, many of these suites have been implemented to "scratch a particular itch" in software development - you have to make sure to see if the suite meets your needs or if the tweaking / customisation effort you have to put in makes it not worth your while.

In my humble opinion the book does not meet up to the title "Foundations of Programming". There is very little (if any) about the foundations such as good analysis, design and code techniques. Instead it's a .Net oriented treatise with not a lot of scope beyond that. While I know that M$ rules the roost and everyone (more or less) is obliged to toe the .Net line - there's more out there to programming than .Net.