Tag: Programming

Improving QtTest usability with QtTestUtil

As much as I like CppUnit for writing C++ unit tests, I still prefer using Qt’s built-in QtTest module for Qt-based projects. This avoids a dependency on an external library, lowering the threshold for running and writing unit tests. Unfortunately, QtTest is very basic, and lacks some useful features such as automatic test registration and running multiple test suites in one test binary. In order to improve QtTest’s usability, I started creating some macros and classes that fill in some of the gaps, and bundled them into QtTestUtil.

Continue reading →

Posted in Software with tags Programming, Unit Testing, C++, Qt, QtUnit, CppUnit

Mixing Cocoa and Qt

Qt does a great job at abstracting out platform-specific features into platform-independent C++ APIs. However, sometimes you still need to write platform-specific code for features that are not in Qt (e.g. to access the platform’s address book),  or to access platform-specific applications (e.g. iTunes) or libraries (e.g. Sparkle). On Mac OS X, almost all interfaces are offered through the Cocoa Objective-C interface, and the interfaces that are written in C++ have been deprecated and will disappear soon in favor of Cocoa. Although the language of Cocoa is different from Qt’s, Qt and GCC make it very easy to call these interfaces from within your application. In this post, I will show how this can be done by making an auto-updating application using Sparkle.

Continue reading →

Posted in Programming with tags Programming, C++, Mac OS X, Cocoa, Qt, Objective-C, Sparkle, GCC

Going Agile with Google Summer of Code

Although Psi has had a fair number of succesful Google Summer of Code projects so far, we have experienced some failures as well: the summer before last, 3 out of 6 projects didn’t make the final deadline. A project’s failure was typically due to not having anything really usable at the end of the summer, regardless of the good work that was done during the past months. To reduce the risk of such surprises, I decided to take an Agile Development approach for this year’s ‘Roster improvement’ project.

Continue reading →

Posted in Jabber with tags Programming, Unit Testing, Psi, Jabber, XMPP, Agile Software Development, Test-Driven Development, Model-View-Controller

:set noexpandtab

Google recently published a C++ style guide, containing all the rules that Google code adheres to. Many of the style tips are quite sensible, and well accepted by many developers out there. However, I was surprised to find the following rule:

Spaces vs. Tabs: Use only spaces, and indent 2 spaces at a time. We use spaces for indentation. Do not use tabs in your code. You should set your editor to emit spaces when you hit the tab key.

I never really understood why so many people have such a hatred towards tabs. Is it just because they have seen code where some editor has mixed tabs with spaces (which of course results in a horrible mess)? Or do they have valid counter-arguments, even when tabs are used consistently?

Continue reading →

Posted in Programming with tags Programming, C++, Google, Tabs, Coding Style

Unit testing method overrides

It probably happened to most of us developers before: while refactoring, you change the name of a virtual method, but forget to change the name of the overriding method in one of your derived classes. Compilation works fine, all unit tests pass, but your program doesn’t work: the overriding method is never called. Java (and C#) programmers can avoid this problem by putting @Override (and override) in front of their methods, which causes the compiler to print out an error message if the method is not overriding anything. However, most other languages leave you hanging with this problem. Luckily, with statically typed languages like C++, you can avoid these bugs by slightly adapting your unit tests.

Continue reading →

Posted in Programming with tags Programming, Unit Testing, C++

User Interface Design for Programmers

User interfaces: every piece of software needs one, but no programmer likes to write one. According to Joel Spolsky (host of the popular Joel on Software), the root cause of the problem is the (unnecessary) fear of being incapable of designing user interfaces. He claims that UI design actually is fun, challenging, and doesn’t require any artistic talent whatsoever (as opposed to what many programmers think). Since I have to write quite some UI code myself, and always thought it was the most boring and frustrating aspect of software development, I thought I'ld pick up Spolsky’s book ‘User Interface Design for Programmers’, and let him try to convince me otherwise.

Continue reading →

Posted in Books with tags Books, Reviews, Programming, Joel Spolsky, User Interfaces

Testing Psi

While the last bugs are being squeezed out of Psi 0.11’s release candidates, work on 0.12 has already begun. One thing I’m excited about as a developer is the fact that we’re making the Psi codebase ‘testable’, which has some nice consequences.

Continue reading →

Posted in Jabber with tags Programming, Unit Testing, Psi, Jabber, XMPP

'The First 10 Prolog Programming Contests' available for downloading

Exactly one year after we finished it, our book ‘The First 10 Prolog Programming Contests’ is now freely downloadable. On the home page of the book, you will also find the source code of all solutions presented in the book. Below are some pictures of the ‘deluxe’ edition of the book, hand-made by my mom.

Continue reading →

Posted in Programming, Writing with tags Books, Programming, eBooks, Prolog

Dvorak: Escaping the typewriter age

About half a year ago, I heard this story that QWERTY keyboards (and their variants) were actually designed to slow down typists (to avoid typewriters getting stuck), contrary to the Dvorak layout, which was specifically designed for speed and comfort. After having learned to count binary on my hands (yes, you can count to 1023 using only your 10 fingers!), this seemed like another fun and freaky thing to learn, and this could actually prove to be useful over time. After all, I switched from AZERTY to QWERTY before, how hard could this be ? At least I was right about it being useful.

Continue reading →

Posted in Miscellaneous with tags Programming, Dvorak, Keyboards