How it was the C source code 25 years ago

C is one of the most popular language around all the world, it was initially developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Labs. Many thousands of projects was developed using C since then. It’s used for all kinds of needs, we can enumerate OS, embedded applications, gaming development, image processing, word processing and database engines.

It’s interesting to discover the evolution of a language, and how it evolved over years of feedbacks from developers and end users. We will go back 25 years ago to discover how some C projects was implemented. Continue reading “How it was the C source code 25 years ago”

Detect not well implemented design patterns in C++ automatically

Design patterns are solutions to software design problems you find again and again in real-world application development. Patterns are about reusable designs and interactions of objects. Some of them are very popular like singleton, factory and strategy.  Others are not widely used like flyweight.

Sometimes the patterns are not well implemented by developers. This could generates some design issues and affect the benefits of using them. It’s interesting to detect where they are not well implemented, and correct their implementation. Continue reading “Detect not well implemented design patterns in C++ automatically”

Some C++ good practices from the OpenCV source code

OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real-time computer vision, developed by Intel Russia research center in Nizhny Novgorod. The library is cross-platform. It focuses mainly on real-time image processing.

OpenCV is widely used , Adopted all around the world, for end users it’s very mature and powerful, for developers its well implemented and designed. The OpenCV developers used very basic principles which makes it very simple to understand and maintain.

Let’s discover some OpenCV design choices: Continue reading “Some C++ good practices from the OpenCV source code”

Learn from Doxygen source code how to optimize the memory usage.

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 “Learn from Doxygen source code how to optimize the memory usage.”

Domain Driven Design, Immutability and C++

There is a powerful and simple concept in programming that is widely underused: Immutability

Basically, an object is immutable if its state doesn’t change once the object has been created. Consequently, a class is immutable if its instances are immutable.

There is one important argument in favor of using immutable objects: It dramatically simplifies concurrent programming. Think about it, why does writing proper multithreaded programming is a hard task? Because it is hard to synchronize threads access to resources (objects or others OS resources). Why it is hard to synchronize these accesses? Because it is hard to guarantee that there won’t be race conditions between the multiple write accesses and read accesses done by multiple threads on multiple objects. What if there are no more write accesses? In other words, what if the state of the objects accessed by threads, doesn’t change? There is no more need for synchronization!
Continue reading “Domain Driven Design, Immutability and C++”