Monthly Archives: April 2010

Introduction to Test-Driven Development in C++ using Boost Test Library

I have been following Test-Driven Development for a few years now. Even though TDD is widespread, often I come across a few friends who aren’t very familiar with TDD approach. It took a while for me to really appreciate TDD since I was introduced to it. When I demonstrated TDD in action, I got a few of my friends interested.

We have our own test framework that we use in our project which was primarily developed by David Carlton. It works very well for our needs. However, for my personal projects, I wanted to try something that is more widely used in the industry. I started using CppUnit for a while until I found Boost Test Library coming a long way. Now, I use Boost Test Library for all my personal projects. It is very easy to setup tests and I really like it.

I also wanted to write a quick introduction to Boost Test Library. So, I thought that I will put down a screencast that will solve two purposes of demonstrating Boost Test Library and serve as an introduction to TDD. This is not an extensive demo or an introduction. I have chosen a really simple problem that is often asked in preliminary rounds of technical interviews. But, it is a good place to start. I don’t guarantee that the solution is efficient. But, it is correct to my knowledge. Please feel free to suggest issues or improvements.

Please note that a HD version of this video is available when viewed on Vimeo’s site.

Introduction to Test Driven Development in C++ using Boost Test Library from Praveen Kumar on Vimeo.

Read more »

Simple GNU Emacs keyboard macro demonstration

My obsession for GNU Emacs has grown over years to an extent where I managed to get a significant amount of users to adopt Emacs. In the past 10 years, I have learned a lot of nice tricks that I can do on Emacs to improve my productivity. So, I have decided to create a series of screencasts demonstrating some of those.

I will start with a very simple one, macros. Quoting from Emacs documentation, “A keyboard macro is a command defined by an Emacs user to stand for another sequence of keys. For example, if you discover that you are about to type C-n M-d C-d forty times, you can speed your work by defining a keyboard macro to do C-n M-d C-d, and then executing it 39 more times.”

In this demo, I have taken a real world example where you have to add C++ class member variables and accessors. There are other efficient ways to do such tasks in GNU Emacs. I personally use yasnippets to do these things. However, this approach is shown just to demonstrate keyboard macros. To supplement this video, please take a look at the keyboard macro documentation that is available within Emacs.