Thursday, 24 March 2016

Writing quality code good for the soul

I recently found myself without paid employment. Not a great situation at first thought, but it actually turned out to be a blessing. Having been made redundant I was forced to think about what I really want to do.

I enjoy writing code and solving problems. Making things, you might say coding is my outlet for my creative side given my lack of artistic talent. The thing is I had spent years in the corporate machine, writing the code I was told to write, in the style I was told to, to do things that other people said it needed to do, the way they said it should do it. The lack of creative input was stifling. I wanted control. Don't we all. Without my own software house how could I do that? Well I couldn't. Not entirely, but I did have the power to only accept a job that felt right.

I know from experience that what you expect of a job from the advert and interview is seldom the reality. This left me with the quandary of how to choose a role that would fulfill my needs. I couldn't guarantee that I would choose a role that delivered what it promised in reality, so the best decision was to not tie myself to a single role long term. As a result I have become a contract software developer.

This leads me to my current role, one that on the face of it doesn't tick many of the boxes I was looking for. It's a role advertised as with vb6 developer, which after more investigation looked to be a job of migrating old applications that only run in Windows XP to work on Windows 8. Not a shiny sexy role, but a safe role. At the interview however things started to look better. Yes the legacy apps are (1.1 and 2.0) and vb6, but the technical vision was heading towards C# and .net 4.x. Also it was clear that the dev team, with the architect involved in the interview, had a good amount of control of the technical direction. It felt like the devs were valued as experts in their craft and opinions mattered.

Due to business reasons the technology was a little mired in the past, but the appetite to move forward was clear amongst the devs.

After a couple of months doing the necessary, taking a legacy app up to .net 4, and making the required changes to keep the app working in XP and now also in win8, I have the opportunity to work on a 'greenfield' project. It isn't a brand new app, rather a rewrite of an existing one, one that had bugs and required significant changes for the 'migration', so the decision to rewrite made sense.

I have been given almost full control of technical decisions for the app, as a result I am writing it using WPF, with a MVVM structure. The control of technical decisions has also allowed me to develop the code in a fully TDD manner, with near 100% unit test coverage using mocking through Moq to isolate classes for testing. The code I have written adheres to the SOLID principles to an extent no code I have written before did. The system is built up using dependency injection, and the code coupling is minimal. All in all its a pleasure to work with.

The thing I had in mind when I envisaged this post was that I now feel reinvigorated about coding. No longer is it a slog. When I add functionality, it goes in cleanly without making the existing code messy. When I refactor some sections I do it with confidence. I actually look forward to touching this codebase. It's amazing what clean code can mean, and I know better now than ever before why many clean coding evangelists preach so much about the pros of clean code. Its not just about a functional, maintainable system. Its about a functional, happy development team.