Designing Qt-style APIs

KDE Contributor and Developer Conference

2004 KDE Community World Summit

Speaker: Matthias Ettrich of Trolltech

Language: English

Talk is scheduled for: Saturday, 21st of August 2004, 14:00 - 15:00


Check the Schedule for an overview of all talks during this conference.


Designing APIs is hard. It is an art as difficult as designing programming languages. There are many different principles to choose from, some of which contradict each other. Ultimately the quality of your design is determined by the compromises this forces you to make.

Computer science education today puts a lot of emphasis on algorithms and data structures, with less focus on the principles behind designing programming languages. It is a pity that such education rarely covers API design. This leaves application programmers unprepared for an increasingly important task: the creation of reusable components. In a time predating object orientated languages, resusable generic code was mostly written by library vendors rather than by application developers. In the Qt and KDE world this changed significantly. Programming with Qt is programming components. A typical Qt application has at least some customized components that are reused throughout the application. Often the same components are deployed as part of other applications. KDE goes even further and extends the Qt API with many add-on libraries that implement hundreds of additional classes.

But what constitutes a good, efficient API? As with many non-trivial questions there is no easy answer. What is good or bad depends on many factors, for example on the task and the specific target group. A good API has a number of features, some of which are generally desirable, and some of which are more specific to certain problem domains.

At Trolltech, we have done substantial research into improving and simplifying the Qt development experience. In this talk, I want to share some of our findings and present the guidelines and principles we are now using, and to show you how to apply them to your own code.

About Matthias Ettrich

Matthias Ettrich

Matthias Ettrich joined Trolltech in 1998. As Director of Software Development he manages the development team in Norway, participating actively in development work himself.

Matthias is a well-known member of the Free Software Community. He created the LyX document-processor and is a founder of the KDE project. Matthias graduated from the University of Tübingen with a M.Sc ("Dipl. Inf.") in Computer Science. He lives in Oslo.


Please direct suggestions and inquiries to KDE aKademy Team.