Learning C++ with Qt

Getting to know C, first

C++ is an object-oriented high-level language build on top of C. Because C++ includes C as a language subset, low-level libraries and system calls can be easily invoked. The C programming language was originally designed at Bell labs in the early 1970’s as a minimal programming language for the implementation of the UNIX operating system. The primary resource of learning the C programming language is the book “The C Programming Language” written by the language’s original authors (see below). Commonly it is advised to learn C first, because it lays the foundations to understand the higher level language features of C++. You may want to skip that step for starters, if you already know another high-level language derived from C, like for instance Perl or Java. But you should come back at a certain point, because understanding the intricacies of C and system-level programming is crucial in writing stable and responsive applications.

book cover Homepage of the book [cm.bell-labs.com]

About C++

C++ adds type-safe structures and classes on top of C . Advanced features like operator overloading, multiple inheritance and templates allow developers to define any aspect of a custom type. For instance type-cast and memory management operators are fully overloadable. Yet, leveraging C++‘s power requires a wise choice of when to use and when better not to use certain features.

One of the core ideas of C++ is to abstract away from implementation details and provide high-level interfaces. The goal is to develop classes which allow expression of complex domain-specific problems. Secondly the goal is reuse of code, as widely as possible. Early class frameworks were built directly on top of ANSI C and native system interfaces.

STL and Qt

The Standard Template Library (STL) solved many of the original problems of implementing cross-platform C++, especially due to the good reference libraries by SGI and GNU. But even today STL provides no standard means of, for instance, opening a window or starting a shell script. Many application frameworks have been created to abstract away from the delicate details of system level programming. Most of them are platform or domain specific with only a few exceptions.

Qt started out in the early 1990’s as a cross-platform GUI toolkit targeting X11 and Windows. Qt, originally developed by Trolltech, a small startup from Norway, was first commercially released in 1995. Since then Qt has grown into an increasingly successful product. There always have been two flavors of Qt: OpenSource licensed and commercial. Since Qt 3.2 Qt has been available for all target platforms under the GPL license and after Trolltech was taken over in 2008 by Nokia, Qt has also been available under the LGPL license.

From its original goals of being a cross-platform GUI library Qt has grown widely in scope. Today it supports many different embedded and desktop platforms, includes a full set of generic algorithms and a wide range of utility classes. Qt borrows the concept of generic containers, algorithms and streams from the STL library.

book cover Book review [qt.nokia.com]

Categories: