When unit testing legacy code I find several (anti) patterns which prevent getting code under test. The most recurring pattern I see is the Singleton pattern – a useful pattern when not abused and overused.In the object oriented world Singleton’s are slightly better than their evil cousin – the static method. Unfortunately I’ve seen them … Continue reading How to fake a singleton in C++
Tag: C++ 11
Syntax error when using explicitly defaulted/deleted functions in windows phone 8 project (C++11)
A few days ago a colleague of mine asked me to help with strange errors his C++ project kept throwing at him.Since it was a C++ project we had more than 200 compilation errors but as the C++ veterans that we are we’ve ignored most of them and scrolled up until we’ve found the patient … Continue reading Syntax error when using explicitly defaulted/deleted functions in windows phone 8 project (C++11)
C++ Bug hunt – shared_ptr misuse
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.from Bjarne Stroustrup's FAQ: Did you really say that?I want to share with you a strange bug I’ve been struggling with last week.I had an application that crashed whenever a user logged … Continue reading C++ Bug hunt – shared_ptr misuse
Why I like C++ 11 – auto & nullptr
I’ve been away from C++ for the last three years, this is the longest we’ve been apart.Luckily I’ve been given a chance to sharpen my skills and in the last few weeks I’ve been working exclusively in C++. During our time apart C++ has grown, and changed – this is not your father’s C++ it’s … Continue reading Why I like C++ 11 – auto & nullptr