The Art of Computer Programming

Wednesday November 20 2013 - , , , , - 0 comments

There are plenty of mediocre and even downright bad computer programmers out there. So what is it that makes a good programmer? Is it the ability to solve difficult problems, or to write fancy code that uses all the bells and whistles of a language, or to write a program in the fewest possible lines of code, or just turning out something that works in the shortest possible time? Perhaps there is a flavour of all those ingredients in a good programmer, but for me, this one nugget of wisdom encapsulates what makes a good programmer and, by implication, drives a developer towards many best practices...

Why are Developers Stuck in the 1980s?

Wednesday November 13 2013 - , , - 0 comments

Are you a hacker or a craftsman ? Clean code and SOLID design principles: surely these are concepts that any developer writing code in an object-oriented language must be familiar with in this day and age? Well, it seems not. It seems like a lot of developers are stuck in the 1980s. I see lots of code that demonstrates a complete lack of understanding of either of these principles. Let me start with an example, one particular method decompiled from a recent product release, contemporary code that doesn’t have the excuse of any historical baggage: 1: private void ParserThread( object clientsocket...

What It Means To Be A Geek

Sunday November 03 2013 - , - 0 comments

Today I was making a cup of coffee and I opened a fresh pack of long life soya milk. When you unscrew the cap, it somehow pierces a foil seal inside the carton. It occurred to me that this was odd, because unscrewing the cap lifts it up, so how can that possibly break a seal  that is lower down? It occurred to me that the seal is either a placebo and it is always broken, or there is some ingenious mechanism in play. Geek mode kicks in, I have to know what makes it work. I notice a helical thread _inside_ the neck and an almost invisible plastic collar that appears to be screwed into the inside...

In Memory of the Twenty Million

Thursday October 31 2013 - - 0 comments

Each November 11th at 11am, we observe a 2 minute silence; the first minute in memory of the 20 million fallen and the second minute dedicated to the the wives, children and families left behind but deeply affected by the conflict.Roughly 20 million people died in the war. 20 million!   These medals are those of my great grandfather, Private Frederick Symes, who served in the Army Veterinary Corps during World War 1. Fred entered the fray in April 1915 and he was one of the lucky ones, he made it back alive and lived out his life in Dorset and Hampshire. Pip, Squeak and Wilfred, as they were...

The Case of the Null Coalescence Illusion

Monday October 14 2013 - , , , , - 2 comments

Nothing marks you out as a rookie programmer faster than blaming the compiler when your code doesn’t work, but sometimes, just sometimes, the compiler actually is at fault. Today, I discovered one such situation. Consider this little console application. The meat of this reproduction was provided to me by Matt Johnson, in response to my question on Stack Overflow . C# 1: namespace NullCoalescenceIllusion 2: { 3: internal class Program 4: { 5: static void Main( string [] args) 6: { 7: var test = new FooHarness(); 8: test.Test(); 9: } 10: } 11: public class FooHarness 12: { 13: public void Test(...

New Paradigms of Code Re-use

Friday October 11 2013 - , , - 0 comments

One of the great benefits of object oriented programming was supposed to be easy code re-use. In the past, I’ve always found it somewhat less easy in practice. I have been using Subversion for a few years and that led me to a choice of two methods of code re-use: For third party code, get the binaries and commit them to version control in a \Lib or \Dependencies folder. This was necessary to get continuous integration builds to work without having to install myriad third party stuff on every build agent. For in-house code, use SVN Externals and re-use code at the source level. Care has to be taken...

Threading is Harder Than You Think

Thursday June 27 2013 - , , , , - 0 comments

I’ve been tinkering with multi-threaded code recently and also re-reading Jeff Richter’s book, CLR via C# . Jeff presents a wonderful example that really illustrates how you can burn your fingers in multi-threaded code. Here’s a slightly modified version of his example: 1: using System; 2: using System.Threading; 3:   4: internal class Program 5: { 6: static bool StopWorker; 7:   8: static void Main( string [] args) 9: { 10: Console.WriteLine( "Main: letting worker run for 5 seconds" ); 11: var thread = new Thread(worker); 12: thread.Start(); 13: Thread.Sleep(5000); 14: StopWorker...

Entity Framework 5: Adding Support for Indexes via Data Annotations

Saturday June 15 2013 - , , , , , - 0 comments

I’m in the middle of developing my first serious project using Entity Framework 5.0. I’m using ‘code first’ or, more precisely, ‘UML first’. We author our entities using Visual Studio’s UML editor within our modelling project. Here’s a partial view of my domain objects:...

CI Build with TeamCity, Git and GitFlow workflow

Friday June 14 2013 - , , , , , , , , - 0 comments

Background Over the past few months I’ve been slowly revising my approach to version control and continuous integration. Until recently we used Subversion (svn) for our version control but I wanted to use more of a distributed VCS. We are a Windows shop and generally prefer GUI tools to command lines. Perhaps we are unusual in that but nevertheless that’s the way we rock, so some of the Git tools didn’t sit very well with us and our Windows servers and we were initially a bit ‘luke warm’ towards Git. Then we discovered Atlassian’s VCS offerings, Stash and SourceTree. We already use a number of...

The Life and Times of a Software Project

Monday June 03 2013 - , , , , - 3 comments

Just for fun, here is a visualization of work on a software project I was involved in ( The ASCOM Platform ). In this video, each second of real time represents about 10 calendar days.The project begins in early 2009 when we imported an existing codebase representing ASCOM Platform 5.0. The video depicts people working on the code over time, you can see them flying around the screen ‘zapping’ files. Each dot represents a file, each line represents a directory. Dots appear when the file is created or modified and persist for a few seconds, then fade away. So, the total number of dots on the screen...