Monday, 16 March 2015

What makes a good software developer?

What makes a good software developer? I've been thinking about this question quite a lot in the past few years, even more so recently since I've been involved in interviewing candidates. 

Many people with much larger brains than myself have written about this, but here's my take. Knowledge and experience are very important. I could make a list of technical skills I think are essential for a job on the team I am currently part of. If someone else were to write a similar list I've no doubt it would be different. This is why I think knowledge and experience definitely play a big part in what makes a good developer but it's a good attitude that is key. 

What constitutes a good attitude? Here are a few things that I believe are important:

  • Enjoyment - You must enjoy creating software. This is absolutely fundamental. It's impossible to be good at something you don't enjoy 
  • Learning/self improvement - I'm not saying you need to spend hours reading books or creating software in your own time, although that will get you far, I mean at the very least take time to improve at work. Identify weak skills, learn from more experienced colleagues, read blogs when you have ten minutes spare
  • Caring - Please give a crap! Care about writing good code, care about coming up with the best solution possible, don’t settle for the first idea that pops into your head. Care about your team, care about your culture, care about everything!
  • Be open to new ideas - Don't reject something simply because it's new, you don't know much about it or it's not the way you’ve always done things
  • Take responsibility - Don't just complain about problems or leave them for others to fix, take action 
  • Simply doing what you've been asked to do is not enough - Typically companies want developers to build features and fix bugs as fast as possible. Unfortunately a codebase is like a car, it needs servicing, regularly, otherwise small problems become big problems. A good developer will identify and fix these problems

Tuesday, 21 October 2014

Enable MvcBuildViews using TeamCity if a view is changed

At work we recently switched from using SVN to Git and GitHub. There are many advantages but there's one in particular I want to talk about. 

Using TeamCity you can automatically build all pull requests. This is incredibly useful as it ensures only code that compiles successfully and passes all unit tests gets back into master. If the build fails you are notified in GitHub.

But, there's a problem. View errors are not reported because MvcBuildViews is off. One solution is to enable MvcBuildViews for all web projects but in our case this is best avoided as it roughly quadruples compile time. The ideal solution is to enable MvcBuildViews only if a view has been changed in the current build. Unfortunately I struggled to work out how to do this. So I asked a question on Stack Overflow and the first answer I received pointed me the right direction.

I've managed to improve on my Stack Overflow answer. It simply enables MvcBuildViews for all .csproj files if a view has changed, but this is still quite slow. It's much faster to only enable the setting for projects in which views have changed. This may be overkill for many solutions but for ours it's not.

A few things to bear in mind:
  • I'm no PowerShell expert, the code is probably quite poor
  • You'll probably what to change the Get-ChildItem command in step one to point directly at your web project .csproj files rather than all .csproj files
  • The Write-Host commands must be formatted in this way so they appear in the TeamCity build log
  • By default TeamCity does not do a clean checkout of the source code (although this can be enabled). Instead changes are applied incrementally meaning that alterations to .csproj files are not undone on each build. So MvcBuildViews should be reset on every build
  • %system.teamcity.build.changedFiles.file% - This file lists all the changes in the current build in the format [fileName]:[status]:[commitHash]. E.g. Home/Index.cshtml:CHANGED:1400ea14c3196abbfd8de3ab6fe0a902be2ccad8
  • %teamcity.build.workingDir% - This is the directory that contains all the files to be built