Optimization lessons to learn from the V8 javascript engine

V8 is Google’s open source high-performance JavaScript engine, written in C++ and used in Google Chrome, the open source browser from Google.

It’s very interesting to discover what makes V8 so fast and which solutions were used to achieve this goal.
Continue reading “Optimization lessons to learn from the V8 javascript engine”

The first enemy of C++ is its past.

During  the last few years we talk about the “C++ Renaissance”. We have to admit that Microsoft was a major actor of this movement, I remember this video where Craig Symonds and Mohsen Agsen talked about it.

In 2011 Microsoft announced in many articles the come back of C++, and Microsoft C++ experts like Herb Sutter did many conferences to explain why C++ is back and mostly recommend the use of Modern C++. In the same time the standard C++11 was approved and we begin to talk about  C++ as new  language. Continue reading “The first enemy of C++ is its past.”

Exceptions is one of the controversy mechanism in C++. Should I use them?

More that 20 years ago, the exception handling was added to C++, and after many years of using this feature by the C++ developers, we have a very interesting feedback of their pros and cons.

Let’s discover the opinion of some C++ actors, and what they think about the use of the exception mechanism. Continue reading “Exceptions is one of the controversy mechanism in C++. Should I use them?”

Make the most of Pmd, Findbugs and CheckStyle results.

Many Java static analysis tools exist right there, each one focus on a specific area and has its advantages, we can enumerate:

  • Pmd which is a static rule-set based Java source code analyzer that identifies potential problems like:
    • Possible bugs—Empty try/catch/finally/switch blocks.
    • Dead code—Unused local variables, parameters and private methods.
    • Empty if/while statements.
    • Overcomplicated expressions—Unnecessary if statements, for loops that could be while loops.
    • Suboptimal code—Wasteful String/StringBuffer usage.
  • FindBugs which looks for bugs in Java code. It uses static analysis to identify hundreds of different potential types of errors in Java programs.
  • Checkstyle defines a set of available modules, each of which provides rules checking with a configurable level of strictness (mandatory, optional…). Each rule can raise notifications, warnings, and errors.

Continue reading “Make the most of Pmd, Findbugs and CheckStyle results.”

C++ needs to modernize its legacy #include mechanism to be really a new language

C++ was stagnated for many years, and many developers was confident that the language will have the same destiny as  Cobol, Fortran and VB6. No new projects will be developed with it  and  C++ developers will do just the maintenance of existing projects. But against all odds C++ reborn from its ashes and the new standards changes a lot how the language is used.

But the legacy  #include mechanism still there.  After the modernisation of the language, it became the  next weak link to improve. Indeed, it has many disadvantages, here are some of them from this interesting document.

Continue reading “C++ needs to modernize its legacy #include mechanism to be really a new language”

Three easy steps to modernize your C++ algorithms

Algorithms are used for calculation, data processing, and automated reasoning. Programming them is not always an easy task and it depends on their complexity. In C++ many efforts was done to simplify their implementation and to make them more powerful. Indeed, during the last ten years many C++ experts promotes the use of “Modern C++ Design” to improve the quality of the C++ project design and implementation.

In this post we will discover three steps to modernize a C++ algorithm, for that we take as example the quick sort algorithm. Here’s a classic implementation: Continue reading “Three easy steps to modernize your C++ algorithms”

What makes Clang so special?

It’s proven that Clang is a mature compiler For C and C++ as GCC and Microsoft compilers, but what makes it special is the fact that it’s not just a compiler. It’s also an infrastructure to build tools. Thanks to its library based architecture which makes the reuse and integration of functionality provided more flexible and easier to integrate into other projects. Continue reading “What makes Clang so special?”

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”