Feb 062013
 

A couple of months ago I managed to get myself a new job as a programmer. It was a pretty great feeling achieving what I had been working towards for the past three years. I’m a couple of months in and I’m starting to get the hang of things and feel more comfortable. However, it’s quite a shock to the system going from the nice, well thought out examples of code seen in textbooks and blog posts to a giant code base  filled with fixes, patches and rushed code.

The culprit that made me write this post was a real corker. Whenever anyone checks in code changes all of the tests are run automatically so everyone can see if the changes broke anything. If a test fails after you’ve changed something then you generally know that you’ve done something wrong. I say generally because today I checked in some changes and was faced with a failing test in a completely unrelated project. It’s a horrible feeling seeing your name next to a bright red test failure.

So I went to investigate the test. It didn’t look like it used anything I changed but you never know. The test was checking some date validation. A date is valid if it’s between 90 days old and 90 days in the future. The test expected the result to be valid however it was using a hard coded date as input. The input date was valid yesterday but today was over 90 days on. This meant that the test would fail at least every 180 days unless someone changed the hardcoded date. It also meant that the sap who happened to check in code the day the test date was suddenly invalid was blamed for the test failure!

I did what any self respecting programmer would and fixed the test to use the current date as a seed and then wrote more tests to check 90 days before and after the seed date as well as the other boundary values.

So today I learnt that wild code is very different from textbook code.

Nov 102010
 

I’ve been a bit lax of late with updating this blog. I haven’t been completely slacking off though you’ll be glad to hear. I’ve been relatively busy with my newest Open University module that started in October. I’ve managed to read ahead of schedule and I’ve almost finished my first assignment that is due in on the 29th of this month so I thought I’d take a bit of time out from that and get back into the land of Perl.

Since finishing Intermediate Perl I’ve been looking for a good book to continue my learning. I bought Effective Perl and read most of it but I decided fairly early on that it would work better as a reference. Just reading a whole book of tips, best practices and code snippets was, whilst useful, not giving me the opportunity to put what I was learning into practice.

After looking around I settled on The Definitive Guide to Catalyst. It’s relatively advanced compared to the stuff I have been doing but it’s set out in a way that walks you through building simple applications that you can extend with extra features as the book progresses. This is perfect for me because I find that not working in an environment where I can put my new found knowledge to use it can be difficult to know where to start. The book is also full of modern idioms and has a great introduction to Moose. It also focuses heavily on automated testing which is all very new to me.

My experience with web development has always been very basic. I’ve made a couple of websites for various projects over the years. They were all incredibly simple, flat pages that were built using Dreamweaver. Playing with Catalyst has given me a much clearer picture on what is happening behind the scenes of proper dynamic websites. It’s also interesting to see how the Perl I already know can be used in a new way to create these web apps. Although I need to brush up on my HTML and CSS skills to actually build a nice looking front end.

Jul 012010
 

In February I started an Open University degree in Computing. During my first module I had to learn some basic Javascript for a couple of assignments. I have been wanting to learn some programming for ages now but as usual it got left by the wayside with the new job and life in general. That is until it was forced upon me by my studies. It didn’t take me long to pick up the code in course materials and I ended up finishing the two Javascript assignments two months early as I just had so much fun with it.

As I had two months free before my course caught up with me I decided I’d look at starting to learn another language. I asked around and was suggested Perl by Jordan’s step dad, Dave. He’s fairly biased due to the fact that he is huge Perl evangelist but I thought I may as well as there is a huge amount of free material around and the Perl community seem like a very fun group.

I started off reading a few chapters of Beginning Perl by Simon Cozens. Whilst it had the definite advantage of being free I felt that the style didn’t really suit my learning. It was also in .PDF format and I am too cheap and environmentally conscious to print out 400 pages so it wasn’t the most convenient learning resource. Preferring to have a book I can carry around sans computer, I ventured online and bought Learning Perl published by O’Reilly.

This book felt like a much better match for me. Over the last few weeks I’ve been reading it in my lunch breaks and for an hour or so after work. I’ve been through it once and I’m just going back round and going over everything again to make sure everything gets stuck in. Of course I don’t think that I’ll be able to remember everything straightaway but I think reading the book through  two or maybe three times will stand me in good stead for the next step.

I actually really enjoyed my first go through the book. I found myself getting excited about what the next chapter would bring and the sense of achievement that comes from figuring out how to complete each of the exercises makes you want to charge through. The pace is excellent. I’m fairly techie but my programming knowledge leaves a lot (not alot) to be desired and I never felt like I was being left behind. A few passages might have had to be read twice but I put that down to my lack of experience with the Unix command line in most cases.

From here it looks like I’ll be moving on to Intermediate Perl which is the most logical step. Once that’s done I’m curious about looking at the Perl DBI module which allows Perl to talk to databases. As I’m training to be a database administrator at the moment I think that tool may just come in handy one day.

It’s really exciting to have such a huge amount of potential knowledge out there to learn and explore. My only regret it not trying this out earlier. Things might have been very different had I actually put the effort in as a teenager…

Anyway… onwards!