John Carmack: A C++ Programming Legend

Have you already seen a basketball or a soccer player plays a simple yet effective game to such a point that you say: Why couldn’t everybody play like him, he uses only easy techniques?

And as C++ programmer I had the same remark when exploring the John Carmack source code. It’s so simple, we wonder why we can ‘t develop like him.

Let’s explore some Doom3 source code choices and try to understand why the code even if it’s simple, it’s very efficient.

On November 23, 2011 id Software maintained the tradition and it released the source code of their previous engine. This source code was reviewed by many developers, here’s as an example of Doom3 feedback from fabien (orginal source): Continue reading “John Carmack: A C++ Programming Legend”

Thrashing Impact on C++ Performance: Doxygen Analysis

When the processes running on your machine attempt to allocate more memory than your system has available, the kernel begins to swap memory pages to and from the disk. This is done in order to free up sufficient physical memory to meet the RAM allocation requirements of the requestor.

Excessive use of swapping is called thrashing and is undesirable because it lowers overall system performance, mainly because hard drives are far slower than RAM. Continue reading “Thrashing Impact on C++ Performance: Doxygen Analysis”

Being a Productive C++ Developer Without Internet

As developer, How many times during a day you need to ask google for something related to your work? How to use a library? Is there a fix for an encountered problem?

Maybe the answer is at least once a day.

Currently and as developers, the internet saves us a lot of time. Whatever the problem you have, just search the right keywords in google and instantly and in many cases you have a result that matches your need. Continue reading “Being a Productive C++ Developer Without Internet”

C++ Algorithm Evolution: A Historical Flashback

Before the initial standardization in 1998, C++ was developed by Bjarne Stroustrup at Bell Labs since 1979, as an extension of the C language as he wanted an efficient and flexible language similar to C

In 1983, “C with Classes” was renamed to “C++” , adding new features that included virtual functions, function name and operator overloading, references, constants, type-safe free-store memory allocation (new/delete), improved type checking. Continue reading “C++ Algorithm Evolution: A Historical Flashback”

C++20 Concepts: Eliminating Generics Paradigm Drawbacks

As Bjarne Stroustrup points out, “C++ is a multi-paradigmed language.” It supports many different styles of programs, or paradigms, and object-oriented programming is only one of these. Some of the others are structured programming, and generic programming. In the last few years C++ experts like Andrei Alexandrescu, Scott Meyers and Herb Sutter promotes the uses of the generic programming and they qualify it as Modern C++ Design.

Here’s what say Andrei Alexandrescu about the Modern C++ design:

Modern C++ Design defines and systematically uses generic components - highly flexible design artifacts that are mixable and matchable to obtain rich behaviors with a small, orthogonal body of code.

Three assertions are interesting in his point of view: Continue reading “C++20 Concepts: Eliminating Generics Paradigm Drawbacks”

The Key to Successful OOP C++ Project: Stable Abstractions

Robert C.Martin wrote an interesting article about a set of metrics that can be used to measure the quality of an object-oriented design in terms of the interdependence between the subsystems of that design.

Here’s from the article what he said about the interdependence between modules:

What is it that makes a design rigid, fragile and difficult to reuse. It is the interdependence of the subsystems within that design. A design is rigid if it cannot be easily changed. Such rigidity is due to the fact that a single change to heavily interdependent software begins a cascade of changes in dependent modules. When the extent of that cascade of change cannot be predicted by the designers or maintainers the impact of the change cannot be estimated. This makes the cost of the change impossible to estimate. Managers, faced with such unpredictability, become reluctant to authorize changes. Thus the design becomes rigid.

And to fight the rigidity he introduces metrics like Afferent coupling, Efferent coupling, Abstractness and Instability. Continue reading “The Key to Successful OOP C++ Project: Stable Abstractions”

Learn Design Patterns from RigsOfRods Game Project

The majority of developers have already heard about the design patterns, GOF(Gang Of Four) patterns are the most popularized, and each developer has his way to learn them , we can enumerate:

  • Reading a book.
  • From web sites.
  • From a collegue.
  • Doing a training.

Regardless of the method chose, we can learn by heart the patterns and spent hours to memorize their UML diagrams, but sometimes when we need to use them in a real project, it becomes more problematic. Continue reading “Learn Design Patterns from RigsOfRods Game Project”

Master C++ Concurrency with ‘Concurrency with Modern C++

C++11 and beyond introduced a new thread library. This library includes utilities for starting and managing threads. It also contains utilities for synchronization like mutexes and other locks, atomic variables and other utilities.

It’s a good news to have a standard way to manage the concurrency in C++, indeed before the introduced features in the new standards, many libraries and ways existed to manage the concurrency in the C++ projects. Continue reading “Master C++ Concurrency with ‘Concurrency with Modern C++”

Exploring SQLite Codebase: Improve C++ Skills

16 years after its first checkin, SQLite is the most widely deployed database engine in the world. An open source project such as this is a good candidate for learning how to make your code easy to understand and to maintain.

Let’s discover some facts about the SQLite code base, beginning with the following code snippet: Continue reading “Exploring SQLite Codebase: Improve C++ Skills”