Redundancy – An open enemy to writing good code

Those who are working on High Available systems/databases consider Redundancy as one of the possible ways to achieve high availability. Redundancy in this case is helping in positive way. But consider the other side of it- In a high available database systems the data is replicated across different nodes. Any change/update at one node has to be propagated to all ...

Read More »

Refactor “if” statements – functional programming style

Have you ever seen code that look like this: public string GetStatusDescription(Model model) { if(model.HasProblemReports) { return "Errors"; } if(model.SystemState.WorkingMode == WorkingMode.NotManaged) { return "Manual"; } if(model.SystemState.IsInitializing) { return "Initialize"; } if(!model.SystemState.InService) { return "Not in service"; } if(model.SystemState.WorkingMode == WorkingMode.Paused) { return "Paused"; } if(model.Storage.Objects.Any(obj => obj.IsMoving)) { return "Movement in storage"; } return string.Empty; } I know I ...

Read More »

List executed code using PostSharp

This post was created to answer a question by Laimonas Simutis on the ALT.NET mailing list – how to list all executed code… There where many good ideas and your truly suggested using PostSharp – mainly because this is one of the examples I use in my AOP and PostSharp presentation. And so without further ado here is my solution ...

Read More »

The Development Pendulum

I’ve noticed a rather interesting thing about best practices and trends in software development, they tend to oscillate from one extreme to another over time. So many of the things that are currently trendy or considered “good” are things that a few years back were considered “bad” and even further back were “good.” This cycle and rule seems to repeat ...

Read More »

Re-inventing the Object

I have spent some years now working as a software architect. There were couple of rather large projects, in both Java and .NET, that I was working on. Infrastructure vs real problems The thing with software architecture is that it tries to set up some basic rules, and solve some primary problems, so that rest of the team can carry ...

Read More »

Why is the legacy code is the way it is?

Most of us would have worked on legacy code OR are working on it OR are even creating legacy code (!!). Just the thought of working on legacy code makes developers spend sleepless nights (yeah, slight exaggeration, but required to highlight the pain). We have yelled and cursed while working on legacy code. Lets step back and reflect a bit ...

Read More »

Looking for the seam

During December/early January we spent some time analysing an existing system which we were looking to rewrite and our approach was to look for how we could do this in an incremental way. In order to do that we needed to look for what Michael Feathers refers to as a seam: A seam is a place where you can alter ...

Read More »

The true cost of technical debt

Whether you like to think of it as technical debt or an unhedged call option we’re all surrounded by bad code, bad decisions and their lasting impact on our day to day lives. But what is the long term impact of these decisions? Are we really making prudent choices? Martin Fowler talks about the four classes of technical debt – ...

Read More »

Tech Leads & The Progress Principle

I’ve been reading The Progress Principle on and off for the last couple of months and one of my favourite quotes from the book is the following: Truly effective video game designers know how to create a sense of progress for players within all stages of a game. Truly effective managers know how to do the same for their subordinates. ...

Read More »

Refactoring Switches to Classes

I’ve talked about refactoring switch statements several times before. Switch is Just a Fancy If Else Pulling out the Switch: It’s Time for a Whooping Refactoring Switches Advanced I’ve even created a defaultable dictionary for refactoring a switch statement into a dictionary of actions. This time, I am going to talk about refactoring switches when you have switch statements operating ...

Read More »