Mark Needham

Thoughts on Software Development

Objective C: Back to being a novice

with one comment

As I mentioned in my previous post about parsing an XML file in Objective C I’m a novice on the Dreyfus Model when it comes to this type of development and I’ve found it interesting that I’ve dropped back into habits from my PHP days when I was first learning how to program.

The big picture

My first instinct after I’d created a project in XCode was to try and understand how an iPad application fits together.

While this approach has worked fairly well for me in languages that I’m familiar with I found that I ended up shaving multiple yaks all at once.

I know too little about all of the individual components such that when I start reading how they all work together I end up veering off track and reading about how each of the components work on their own.

For the moment I’ve put the big picture to one side and I’m just trying to understand the ins and outs of the language by hacking bits of code together.

Copy/Paste/Change/Comment

Talking about hacking code, I’ve found myself copying and pasting example code that people have posted and then tweaking it bit by bit, re-running the code each time to check I haven’t broken anything.

Eventually I’ll need to learn how to write the code from scratch but at the moment I make way too many mistakes that the copy/paste approach gives me quicker feedback about how the language works.

When the code stops working I find myself commenting out code until I get it back into a working state because I’m not yet able to intuitively narrow in on where the problem might be.

Limit the hours a day

Perhaps due to the frustration of everything being a struggle I find that I’m quite mentally fatigued after coding for a few hours.

On the days when things work more frequently than not I find that I can code for longer but at the moment I’m finding it more beneficial to stop coding when I’m getting too frustrated and then pick it up later.

Quite frequently I’ll work out how to do something that I was really struggling with after leaving it for a while.

TDD…

Despite being a big fan of Test Driven Development I haven’t written a single test in Objective C yet.

While that will probably be the most effective way to develop code, as I’ve previously suggested, I don’t necessarily think it’s the most effective way to learn a new language.

The feedback loop is slowed down as you first try and setup a testing framework and because you don’t know the syntax that well it’ll probably be a bit of a struggle to get a test setup.

Writing a bit of code and then compiling and running it provides a feedback loop which is working fine for me at the moment although I’m sure at some stage I’ll drift back towards my TDD roots.

Be Sociable, Share!

Written by Mark Needham

August 6th, 2010 at 3:59 am

Posted in Objective C

Tagged with

  • Saager Mhatre

    WRT TDD, actually I spent a couple of days setting up a GHUnit [ http://github.com/gabriel/gh-unit ] enabled project and it taught me loads about ObjC, XCode and how libraries interact in the IDE. Of course, YMMV.