Archive

Archive for the ‘Clean Code’ Category

Structure your code by feature

January 25th, 2012
Urs Enzler

cross-post from bbv blog

When software projects grow both in age and size the developers often struggle with the structure of the code. It gets more and more difficult to find the class you have to change for a new requirement. In this post, I’ll show you how we organize our code and how we derive our structure directly from the requirements.

read more

 

.NET, Agile, Architecture, Clean Code, Methodology, Test Driven Development , , ,

Why I like NDepend to untangle Dependencies in my Code

November 13th, 2011
Urs Enzler

Some time ago, Patrick Smacchia (NDepend lead developer) offered me a NDepend Pro license to play around. NDepend is a tool providing a lot of features. The feature that impressed me from the very start is visualizing dependencies. Not just dependencies from classes to classes, or assemblies to assemblies; no from everything to everything. Like for example all assemblies that use somewhere the method Foo of class Bar. It works for assemblies, namespaces, types, methods and fields.

But, what’s all this fuss about?

Keeping a code base and its design as simple as possible over a long period of time is very difficult. It happens just too quickly that we loose the overview of how things are sticked together. And this is the moment when NDepend with its quick and easy dependency visualization comes to the rescue.

read more

 

.NET, Clean Code, Software, Why I like ... ,

Clean Code: Nesting

July 27th, 2011
Urs Enzler

This is the start of a series of posts about Clean Code. I’m going to pick some topics from my cheat sheets about Clean Code and Clean Test Driven Development and explain them in more details.

Today’s topic is

Nested code should be more specific or handle less probable scenarios than unnested code.

read more

 

Clean Code

.NET Open Source Projects and Coding Guidelines

July 27th, 2011
Urs Enzler

In my projects, we use a lot of open source libraries like Ninject, xUnit, Machine.Specifications, FluentAssertions, StyleCop, Moq, statLight, AgUnit and of course the project I lead myself: bbv.Common.

These projects are really cool. But sometimes of course, we need something that they do not (yet) provide. Like adding Machine.Specification support in FluentAssertions or a faster runner for xUnit unit tests under silverlight with AgUnit and statLight.

Therfore, we download the source code and try to contribute the features we need. And we try to follow the coding style of the existing code so that the project owners are willing to merge our changes into their code base. But this is almost impossible!

read more

 

.NET, Clean Code, Sourceanalysis , ,

How to Unit Test Finite State Machines

May 17th, 2011
Urs Enzler

We use a lot of state machines in our projects. We use them for abstracting instruments that we control, controlling when user input controls have to be enabled or disabled and for other things.

State machines are great for these kind of tasks (much easier that nested switch statements anyway) but they provide a big challenge when developing software test driven. This is due to the fact that they are of course very state full and often active (running on their own worker thread).

Here are some best practices leading to maintainable and refactoring friendly unit tests.

read more

 

Clean Code, Test Driven Development, Testing , , ,

Why test naming conventions are important!

April 9th, 2011
Daniel Marbach

I’m working in an agile software development team which develops a fairly complex automation system for manufacturing facilities. We are using Test Driven Development as our main tool to improve the overall quality of the code. We all knew that we are going to have a large number of unit tests during the life cycle of the software. Before we started writing unit tests we decided that we need a test naming convention.

read more

 

Agile, Clean Code, Test Driven Development , ,