Last night, up until 7:00 AM. I had applied for a job, a very good job, and they had called and asked for some samples of code that demonstrated my understanding of Object Oriented Behavior.
Now this I've done, but it's been a few years (almost 10 to be precise) and so commit to throw them something together over the weekend.
And I try to come up with some ideas. They are particular, this job, about it being original and so much of what I've done is built upon the works of others - that's the way web development works, at least in the billing world, no one wants to pay for a job written from scratch if you can just find and adapt a script off the net. So while I've gotten rather good at avoiding coding, this job is looking for the opposite. They want proof I can code.
Original is a bit of a sticky thing. One can write any number of "original" things that have no value or purpose. The trick is to write some original code that covers a niche (somewhat) that I haven't come across online (and now that I've decided I can't search, because to do so would lead me to investigate how others did it, and originality would be ebbing away fast...). Not as easy as it sounds. Eventually I have an idea, and I begin to code....
And it goes to hell. A version of Conway's "Game of Life", but I've overlooked the fact that PHP runs server side, not client side, and so the pretty pictures will have to be animated with a next button in the browser, or a perpetually refreshing page (blinking in and out on the browser), and this isn't a terribly elegant example.
So I switch ideas, come up with something else, but not until I've dumped a good 6 hours down that well. This is how I learn.
The keyword again was "original", and they wouldn't be specific and so I'm left again racking my brains. Something original, portable, that can use all the various aspects of Object Oriented Behavior, inheritance, class, public, private and protected functions. A shopping cart would be the perfect pointless and redundant example, but there's plenty of those around...Original....
I begin again. Or perhaps not begin, simply begin rewriting code. I raise every error known in PHP, even the T_PAAMAYIM_NEKUDOTAYIM, which sad to say I have to google to understand. And time is passing, the weekend is disappearing and the project, this little code snippet, is getting way out of my league.
I discover my errors, eventually, I always do, and things begin to get a little more on track. By 11:30 Sunday evening I'm in flow, writing code and executing it, debugging, correcting...there are no problems not quickly addressed and remedied and by 3:00 AM the code snippet is done.
Bear in mind that I've not scripted OOP in PHP before, and so there's a steep learning curve with most of what I'm doing. And a lot of my mistakes are due to my over-complicating the situation, not realizing how obviously simple certain solutions are, not seeing my errors, but by 3:00 AM I'm done.
Now I'm not pleased. I can do better, much better, and so I write the code shop a brief note begging their indulgence, a few more days will give them something that will give them a better idea of my abilities, more to my credit. I had no abilities Friday, but now, 3:00 AM on a Sunday night and I'm confident that I'm remedial. Now I've discovered in my searching (Google, the God of Programmers) a great many other things and the scope of my project is expanding.
It's small, true, just a sample, but that doesn't mean that it has to be ugly. There should be a bit of style. There should be some error handling, validation, portability to the code (after all, that's what OOP is about), documentation, there should be adherence to best practices, there should be, well, any number of things. And I make my notes and the project goes. I don't have to work this week, that's a good thing, it will be late nights - up until 2:00, 3:00 AM, coding, debugging, googling.
I haven't done this - not at this level anyways - since school. When it's working it's kind of fun. When it's not it's hell. Probably more than proving I can handle PHP and Object Based Programming, this should be proving - to them, I hope - that I can quickly learn and master new skill sets. That - in my books - is the most important thing you can bring to any job.
I celebrate by reading a book, finishing off "Fleshmarket Close" by Ian Rankin. It's 7:00 AM by the time I get to bed, and I'm up again at 9:30 AM. There's more code to be written.