HARDCODE

Code, bugs, tools and developers…

Test That Fails So Hard

I’ve added a few unit tests today and all the tests stopped running. There was no feedback about the problem, the tests just wouldn’t run. I’ve got suspicious first about VS 2015 and then NUnit test adapters because VS 2015 is in Preview stage and test adapters use Visual Studio SDK(which in turn may not be mature enough). Then I tried running tests using NUnit GUI runner app, no luck, it too got stuck.

It was time to debug the test, and as soon as the debugger entered a property in one of my new classes, I realized that there was a circular call which resulted in running out of stack memory and StackOverflowException was being thrown.

Of course this is a fatal exception that can’t be handled by an app easily (maybe impossible?). So there was no information from the IDE that something was causing infinite loop of method calls. The next time same thing happens, I would suspect my own code instead of Visual Studio even if it is a “Preview” version.

Mutants in Your Code

Immutable objects are very popular in concurrency models because immutable objects are naturally thread safe because the state an object cannot be corrupted by multiple threads. As C# developers we can also benefit from immutability. C# has a keyword just for that, readonly. We can also utilize readonly property mechanism with private setters.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// A field assigned in declaration statement
private readonly int _num = 20;

public MyClass(int num)
{
    _num = num; // Assign in constructor
}

// Use a readonly property
public int Num
{
    get{ return _num; }
    private set{ _num = value; } // Or you just don't introduce a private setter
}

Fountain of Lore: Scrum as a Learning Model

To be successful in learning, one must have a plan. What do you want to learn and what materials are relevant? How do you order them? Do you study them in parallel or one at a time? How do you keep track of the progress you’ve made? Should you keep a history of what you’ve studied?

Enter Continuous Learning, the fountain of lore!

I use Git and Visual Studio Online to help me throughout the learning process. I choose Git because I use it everyday and I can use it on both Windows and OS X (Unlike TFVC). As you probably know Microsoft provides a free VS Online option that is more than enough for personal use. As a Scrum tool I use VS Online.

Saruman indexing his ebook collection of fire magic.

Developer’s Machine: Lightsaber vs Woodsaber

Software development is a very competitive area and it is at utmost importance to keep the process efficient. When a new project arrives, we take into account our skills and knowledge to analyze risks, challenges and the schedule. Developers naturally assume that they can work as fast as they can think and type, however sometimes your development machine is not so eager.

Do you remember what had happened to Qui Gon when he faced Darth Maul? He was MULTITHREADED by the Sith Lord with his dual-blade. Poor Qui Gon did not stand a chance with that crappy single-blade :(