Friday 22 October 2010

I love to...

I've learnt some really painful lessons these last few weeks. I grew up programming in turbo C and debugging was just one of those things I picked up naturally and ran with. Then I made then switch to java with it's fancy IDEs and convoluted 'frameworks' and I gave up on debugging. I still occasionally used the IDEs debugger but most of the time I just put print statements all over the place, sat back and watch the code spew out lines of messages as it self destructed. About 3 years ago, I picked up unit testing as a by product of an encryption project I worked on in software engineering class. Unit testing was easy and cool when it's a new project I'm working on and not some 10 year old architectural master piece... or so I thought.

So a little over a 6 weeks long ago my boss says dude I've got the coolest project for you. Fix up this synchronous module so it's asynchronous using JMS and using the approach taken by 'other existing asynchronous modules'. If you don't know it yet that, there, is the perfect recipe for a project from hell.

Anyhow, I spend the first one week or so reading the existing code. The next one week creating class diagrams and sequence diagrams Those 2 there (class and sequence diagrams before actually writing one line of code) make up a perfect reason to be thankful that I was too busy growing up in the 80s not dable into coding (not that there were computers or the internet available where I grew up anyway). Remember I've got about 4 weeks - and I've spent the first 2 or 3 doing nothing... well almost nothing. So, I finally start tweaking the interface. Let me just say right now that working with old code makes you appreciate senior programmers more - how they kept their sanity while managing to construe such insanity is purely beyond me. But I digress. So I finished tweaking the interface, what with sessions and requests, data objects put into memory in java code and accessed from the JSP (cue utter and complete mayhem), in about a week and was now left with the code itself.

JMS is a cool technology. It would have been cooler though were it not tied to the JEE framework somewhat (you know, kinda like the way scala actors are written in a self contained scala library). So now I had to practically create a temporary cache in memory that manage insertion and retrieval with some complex voodoo logic because the manager is a singleton amongst other reasons. I've also got to accomodate the existing code (you remember that part earlier where I said something about making sure my code changes followed the existing pattern).

After fooling myself into believing I knew what I was doing for all of one week I finally was humble enough to learn. I realized in hindsight that writing unit tests for the existing code was the smartest way to not only learn but to also make sure down the road that my changes were good enough. The nature of writing unit tests is that you end up breaking up the code into small compartments (apparently that's one of the reasons it's called unit testing - duh). Smaller compartments mean you understand the code better. I also learnt that debugging isn't a dead act after all- it's good programmers that are reducing in number. Old code will always exist... cos some smart dude will come up with a better why to write it (writing intelligent software that can create software faster would fall under this category) and there'll always be the need to maintain it (except of course you also write sofware to maintain the code in which case you'd have to maintain the software that maintains the software that maintains...). Reminds me of that one time we had to write a compiler in college. I had classmates who complained because it was a waste of time which is wierd cos I enjoyed the entire course (I didn't read for the exam and I didn't get an A because I was too busy trying to get my compiler to compile).

These last few weeks we've been talking about humility in church. Last week I told a church member, in jest, that I'm sure God was opposing me because of my pride. I guess there's some truth to that especially since he gives grace (I like to read this as style) to the humble. Humility is accepting your failures/foibles and then submitting what (who) you do not fully understand because you realize and accept that you are flawed. I finished my project 2 weeks behind schedule. I now have to struggle to meet up other goals but it's been worth it in the end. I love programming.

Wednesday 13 October 2010

Good reason...

I like to post, every friday, stuff I type on the train as I make my way home. Sometimes, I'm just too lazy to be thinking but lately I've been busy trying to play Wordsworth or Hughes to the most beautiful (inward and then outward) lady my eyes have seen. I hope she doen't mind 'cos I plan to court her forever.

=======================

I'll try to voice thoughts in my heart
lest they run riot and leave me limp.
I'll shout them loud; they'll ring out clear
on mountains rough or waters fast;
on frigid nights in barren lands
or stormy days in tropic isles.

In every stride your beauty takes,
On every word borne by your voice
these thoughts burn deeper yet in me.
Thoughts that mere words cannot relate
for there's beauty yet that words can't paint;
there's music yet that notes can't play.

I'd call you pretty if that would do
but I know 'fine' when she walks by
and she's not you - not by a mile.
I'd say your smile lights up my world
but I know lies when they are told
and you're no star - you're fairer yet.

There's that someone for everyone
that leaves us speechless as beauty goes,
that leaves us breathless each time they smile.
I've found that someone here in you:
I see your smile on every face,
Your sultry voice in every song

Friday 1 October 2010

And so...

Naija is 50. There's not much more to it other than that fact. Actually, I lie - there's more to it. In the larger scheme of things the phrase 'epic fail' aptly describes the country today. If Naija were a software project we'll say she's violated in every way the concepts of KISS and DRY. Instead of test or behaviour driven development she's gone the route of faith driven development. Given the opportunity to put to use some of the finest principles of OOP (given it's differs cultural and ethic heritage) she's blindly opted for functional progamming from the center. She's also become a land where form never follows function - merit never determines opportunity and responsibility is as foreign a concept as snow in Jos (theoretically possible but extremely rare).

But she's 50 and we'll celebrate that. We'll celebrate because, perhaps, of its people and their rich cultural heritage. We'll celebrate because, despite 50 years of some of the worst governance man will ever experience and the saddiest degree of acquiescence our planet may yet see, the people haven't given up hope. We'll celebrate because whatever the country is today, good or bad, is the result of the collective will of the people - unfortunately that's me and... you. I know the military coups are a better excuse for our conditons but at 50 we should not better. We'll celebrate because Naija is the one entity we can truly call home and because, despite the best efforts of our colonial masters, we are still 'one indivisible nation under God'.

Naija is like an open source project whose final delivery was Windows Me. Seriously, how to move forward from that kind of position in an open and free manner is an act that's not yet been pulled off. But we are Nigerians, and if anybody can pull it off perhaps it's us. Perhaps, that's why we celebrate - because we've not gone the route that our conditions would warrant, because our very continued existence in our decadent social and economic structure is testament to the hideous miracle that we have fast become.

Here's one good enough reason to celebrate though. To paraphrase the words of Paul "everyman has been placed at a place for an appointed time and reason". Nigeria was that place for the first 25-ish years of my life. It looks like it would be that place for the bulk of my years here on earth - and I plan to be around for a long time. So today's an opportunity to celebrate the opportunity to be part of the gift that's my home - cos regardless of how torn and worn she may be, she's mine.

But its going to be a sober celebration alright