I am currently developing a small free software (my latest attempt of a graphical vi replacement). And I am running into many trouble for finding the good IDE / Compiler / Debugger / test library combination.
My needs are pretty standard. But it’s still surprising how difficult it is to meet them. Let’s see.
1. OS
I am developing on Windows. That’s what my computer runs, and I no longer have time to maintain a functional Linux box. Still I want all my software to be reasonably portable. Reasonably means that if I want to, I can port to Linux in a few days of spare time.
I am using Windows with Cygwin, Mingw, Thunderbird, Python, Console, Vim, a window manager. 95% of the software I use is free software, available also on Linux.
The Windows constraint means that software tools that run very well on Linux but poorly on Windows are out of question. It’s ok for me to invest time in porting when porting is the current task. It’s not ok to waste time on a daily basis because of poor Windows support. Examples of software ruled out: git, Gtk. Both claim minimal Windows support which in practice means poorly documented painful windows support. Not for me.
Requirement : Good windows support.
2. Spare Time
I am working on my spare time. This is about 30 minutes to one hour every day, when I commute. A problem that needs 2 hours of fixing is very annoying, because that’s almost one full week of my spare time. And it’s very frustrating to be stuck for one week. So, I want tools that mostly just works, without too much fiddling. Tools that don’t break as soon as you start pushing them toward their limits.
Requirement : very stable tools
3. Vi rocks
I have grown addicted to Vi. I kind of manage without it, because Thunderbird does nos support Vi very well, and typing with french keyboard and accents in Vim is not very convienient, neither is typing in Vi mode in Word or Excel. But when I need to edit and fix code, Vi is still the best thing for me. So, my development environment must be more or less Vi compatible. This means either using Vi exclusively, or using a Vi compatible mode, or launching Vi quickly.
Requirement : Vi friendly
4. Fun
I do free software for fun. I have a real job during the rest of the day, with his shares of boring and fun stuff to do. But “extremely tedious” is not how I want to describe my 30 minutes daily coding experience.
Requirement : Fun
5. Professional and high quality
Eventhough I am programming for fun, I want my software and development environement to be the best of what a professional software developer can deliver. I won’t compromise on quality, I don’t have deadlines. For me professional means:
- unit tests for everything
- software easy to run
- software easy to install
- software easy to maintain: high readability, no code duplication, …
- software easy to debug
- software reports errors in a meaningful way
- software is either easy to use or reasonably documented
- maximum number of things are automated
Doing all this is part of the fun of programming. I know it does not apply to every programmer but it works for me.
Requirement : professional
6. Portable
I write software on Windows, but I want everybody to be able to use it. So, within reasonable bounds, all my code must be portable. A developer familiar with Linux should be able to compile and execute my code in less than one day and fix the few portability issues. All my development tools and library should be available on both Windows and Linux. And even better if on Mac Os X.
Requirement : portable
So, that’s it with my requirements.
My choice of tools
Now, let’s see which set of tools to use, and how they match my requirements. It was not easy to find them at first, and it’s the combination of all of them that makes my coding a rewarding experience.
1. Version Control
I need an easy to use version control system. Why easy to use ? Because I don’t program that often, so I need to be able to be able to use it efficiently even after not using it for one year. DVCS is nice, because I work mostly in the train, without internet access. After several years of happiness with subversion, I have now switched to Mercurial. Zero overhead when starting a project, minimal overhead when I start sharing the project with others. Easy transition from svn. Perfect for the task.
Choice : mercurial
2. Development language
Those days, for me, it’s Python, Python and Python. But for this project, I have to integrate into existing projects so C++ is my best second choice. Still, if only I could use Python…
Choice : C++
3. Graphical toolkit
My requirements are: portable, easy to use, supports C++. If you thought Gtk, go think again because for example Windows support is awful. If you thought WxWidgets, go think again because easy of use and portability are not that good. The obvious answer is … Qt ! I am still in love with Qt eventhough Qt 4 becomes more and more complicated to use. Portable, very well documented, very complete, easy to use. Qt still rocks.
Choice : Qt
4. IDE
I have tries several combinations over the years, none of them being very satisfying:
- Vim + Makefile + Console + Gdb
- Vim + QMake + Console + Gdb
- Vim + CMake + Console + Gdb
- QtCreator + Vi emulation mode + Gdb
- Visual Studio + Vi emulation
- Visual Studio + external Vim
- CMake + Visual Studio generated files
Eventually, solution 5 works well for me: Visual Studio + external Vim. Solution 6 ought to be tested a bit more, but all the others are simply painful. I will go into details of why later.
Choice : Visual Studio + external Vim
5. C++ standard library
For every C++ program, you can choose between several C++ standard library. There is the official one, the STL provided by your compiler. There is boost. And there is Qt. I usually prefer Qt above anything, but for this project, I am trying to cut down dependencies. So, C++ stl is my friend so far. Well, friend is not the right term. We live together but not so happily. I’ll switch back to Qt if I find a good justification for the extra dependency that it creates.
Choice : STL
6. Lexer and Parser
For this project, I need a small parser. I have touched lex and yacc a long time ago for a small project. I know enough to know that this is not what I want: cumbersome and not so easy to read, there ought to be a better solution. I have just found Quex which I am testing happily right now. The experience has been pleasant so far: portable, stable, sane and well documented. It’s only a lexer, but my parser is quite simple, so a switch/case does the job reasonably.
Choice : Quex
7. Testing
I want unit tests. I want them a lot because they are my garantee against failure. And my unit test library should bring me other nice features:
- easy to integrate: no braindead dependency.
- descriptive errors: errors of my unit tests should be meaningful. Not just Fail but Error in file testAbc.cpp, line 37. I expected 137 for “complicatedFunctionCall( 1, 345, 567, “abc” )” and I got 125″. Even better if I can integrate it into my IDE, so that it jumps directly on the error. Then I press F9 to set my breakpoint, run again and I can start debugging the failure.
- easy selection of the set of test to run: all of them, all the tests related to class BlaBlaBla, all the tests matching a regexp.
- usual XP facilities with testing: fixtures, SetUp and TearDown, run tests in isolation
- little code to write to add a new test. I hate when I need to update a header file and a C++ file just to add one more method to test. Or when I have to create a whole new class before writing my first very basic test.
Qt testing does not fit the ball, nor does CppUnit (a bit too heavy on syntax). Again, I found happiness recently: Googletest written by Google. It has everything I want and a few nice additional features:
- test failures are not exception based, which is easier to manage
- documentation is good
- advance testing technique are supported: paramterized tests, tests with subroutines, additional logging information during tests, continuing a test after a failure, …
- color in the test output
- report about number of tests run and failed. It sounds trivial, but I usually patch the test libraries that are missing this just to show the number of tests succeeding, failing and the total number of tests (and usually the success percentage although it’s not very meaningful)
And now ?
Equipped with all these tools, I can make my spare-time development an enjoyable time !
I will elaborate in my next post about Visual Studio, QMake and Vi…





Home