After 15 years of active developement, does the Boost C++ library meet its original vision?

In 1998 a proposal for  a C++ Library Repository Web Site was posted by Beman G. Dawes. The original vision aims to satisfy two major goals:

  • A world-wide web site containing a repository of free C++ class libraries would be of great benefit to the C++ community. Although other sites supply specific libraries or provide links to libraries, there is currently no well-known web site that acts as a general repository for C++ libraries. The vision is of a site where programmers can find libraries they need, post libraries they would like to share, and act as a focal point to encourage innovative C++ library development. An online peer review process is envisioned to ensure library quality with a minimum of bureaucracy.
  • Secondary goals include encouraging effective programming techniques and providing a focal point for C++ programmers to participate in a wider community. Additionally, such a site might foster C++ standards activity by helping to establish existing practice.

Continue reading “After 15 years of active developement, does the Boost C++ library meet its original vision?”

Do you think we need a C++ compiler that forces the use of only a subset of the C++ standards?

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.

Continue reading “Do you think we need a C++ compiler that forces the use of only a subset of the C++ standards?”

CoderGears launch the “Well-Developed Project” program for C/C++ open source projects.

After few years of the analysis of many open source projects developed with C/C++, we can confirm that many of them are well designed and implemented despite the fact that the open source contributors do not have resources like companies. Most of them work only at night or on holidays and they produce a very good code. But some other open source projects need some assistance to be improved which is the goal of the WDP program.

The Well Developped  Project Program (WDP)  aims to improve the quality implementation of the open source projects. The goal is to acheive a deep audit of these projects and send some recommendations to their contributors. The review will be done by some C++ experts from the open source community and by using some static analysis tools.

Each contributor team interested could apply for the review and each C++ expert interested to participate to this program could apply to join the WDP reviewers team.

The audit will be done using the following tools:

  • Cppcheck
  • Clang
  • C++ Modernizer
  • Visual Studio Analyzer
  • CppModernizer
  • CppDepend
  • Vera++

And of course other tools could be suggested.

A detailled report will be generated to send it to the project contributors. The well implemented C/C++ projects will have the label WDP.

Here are some advantages of participating to the program:

  • Your code will be reviewed by some C++ experts from the open source community.
  • Your code will be audited by many C/C++ static analysis tools.
  • We help you to create a custom report with your custom CQLinq rules.

Need Moderators for the “C/C++ coding Best practices repository”

Quality is not something that can be easily added later. It’s preferable to take care of it from the beginning. However there are many style guides around the web talking about the coding best practices. Some guidelines are very interesting, some others are not suitable even they are recommended by known organisations.

The goal of the repository is to vote and comment the C/C++ coding best practices rules to have the most interesting ones and every C/C++ developer will focus more on the most voted rules.

To acheive this goal we need some C/C++ experts as moderators to create additional categories, manage the new added rules and comments which is very important to keep a repository with a good quality.

If you are a C++ expert and you are interested to moderate this repository please contact us at developer@codergears.com.

 

 

CppDepend 6 Just Released!

After 7 years of development, CppDepend reached a certain level of maturity. Yet there are still many new potential features and improvements possible. We found out that the most sensitive part for this version 6 was actually to chose carefully the set of new features and improvements we’d like to offer to users.  version 6 new stuff reflects well the most demanded features that have just been marked as completed.

Continue reading “CppDepend 6 Just Released!”

Enforce the Single Responsibility Principle: Cassandra nodetool case study

Let’s start with the single responsibility principle from wikipedia:

In object-oriented programming, the single responsibility principle states that every class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class. All its servicesshould be narrowly aligned with that responsibility.

Continue reading “Enforce the Single Responsibility Principle: Cassandra nodetool case study”

Basic steps to follow before contributing to a C++ project.

Before contributing effectively to a C++ project , it’s recommended to take a tour in the existing code base, and identify some of its  design and implementation choices. Indeed your contribution must be coherent with the existing source code.

Here are some basic steps to follow before contribute to a C++ project:
Continue reading “Basic steps to follow before contributing to a C++ project.”

Readability and Maintainability regulators using Halstead and Technical Debt measures.

The readability of source code has a direct impact on how well a developer comprehends a software system. Code maintainability refers to how easily that software system can be changed to add new features, modify existing features, fix bugs, or improve performance.

Many coding techniques exist to improve the readability and the maintainability. However it’s better to be assisted by some metrics to help refactor the code and keep it clean. We can regulate our code base like an industrial process:

metrics

Halstead complexity measures are software metrics introduced by Maurice Howard Halstead in 1977 as part of his treatise on establishing an empirical science of software development.

Halstead’s goal was to identify measurable properties of software, and the relations between them.  Thus his metrics are actually not just complexity metrics.

For a given problem, Let:

  • \,\eta_1 = the number of distinct operators
  • \,\eta_2 = the number of distinct operands
  • \,N_1 = the total number of operators
  • \,N_2 = the total number of operands

From these numbers, several measures can be calculated:

  • Program vocabulary: \eta = \eta_1 + \eta_2 \,
  • Program length: N = N_1 + N_2 \,
  • Calculated program length: \hat{N} = \eta_1 \log_2 \eta_1 + \eta_2 \log_2 \eta_2
  • Volume: V = N \times \log_2 \eta
  • Difficulty : D = { \eta_1 \over 2  } \times { N_2 \over \eta_2 }
  • Effort: E =  D \times V

The difficulty measure is related to the difficulty of the program to write or understand, e.g. when doing code review.

The effort measure translates into actual coding time using the following relation,

  • Time required to program: T = {E \over 18} seconds

Halstead’s delivered bugs (B) is an estimate for the number of errors in the implementation.

  • Number of delivered bugs : B = {E^{2 \over 3} \over 3000} or, more recently, B = {V \over 3000} is accepted

The Halstead complexity measures provide insight into the readability of the code. These count the operators and operands to determine volume, difficulty, and effort. Often, these can indicate how difficult it will be for someone to understand the code.

These metics could be used to improve the readability of the code base and it’s better to refactor when their values are more than the accepted ones to keep your code readable. If you have a C/C++ code base you can use CppDepend to calculate them.

Technical debt

Here’s a definition from this interesting article:

Just like a financial debt, the technical debt incurs interest payments. These are paid in the form of extra effort required to maintain and enhance the software which has either decayed or is built on a shaky foundation. Most Agilists recommend repaying the technical debt as early as possible. However, most Agile teams fail to monetize the technical debt, which can give valuable insights.

  • Debt(in man days) = {cost_to_fix_duplications + cost_to_fix_violations + cost_to_comment_public_API + cost_to_fix_uncovered_complexity + cost_to_bring_complexity_below_threshold + cost_to_cut_cycles_at_package_level}

There is a default cost in hour associated with each of the above violation. For example

  • cost_to_fix_duplications = {cost_to_fix_one_block * duplicated_block}

Now, as per the defaults cost_to_fix_one_block = 2 hours. Assuming that the average developer cost is $500 per day and there are 8 hours to a day then to fix one such block $125 would be spent. Likewise, monetary analysis can be done for each violation to finally arrive at the total technical debt.

Having more technical debt means that it will become more difficult to continue to develop a system – you either need to cope with the technical debt and allocate more and more time for what would otherwise be simple tasks, or you need to invest resources (time and money) into reducing technical debt by refactoring the code, improving the tests, and so on. Using the Technical debt from the beginning  for continuous improvement  is a good idea to keep the code maintanable. For C/C++ code base you can use the C/C++ Sonar Plugin based on Clang to calculate the technical debt.

Summary

Keep the code base readable and maintainable is not an easy task and using some metrics could help to facilitate this task and give a relevant indicators on where we have to improve our code. Many measures exist and you can choose the ones you consider relevant. But never blindly move forward,  your code will be quickly a labyrinthine system.

Exploring existing code architecture using dependency graph

Dependency graph offers a wide range of facilities to help user exploring an Existing Code Architecture. In this article you’ll learn how to benefit from these features in order to achieve most popular Code Exploration scenarios:

  • Call Graph
  • Class Inheritance Graph
  • Coupling Graph
  • Path Graph
  • All Paths Graph
  • Cycle Graph
  • Large Graph visualized with Dependency Structure Matrix

Continue reading “Exploring existing code architecture using dependency graph”

How Dependency Structure Matrix could help you improve your software design

The DSM (Dependency Structure Matrix) is a compact way to represent and navigate across dependencies between components. For most engineers, talking of dependencies means talking about something that looks like that: Continue reading “How Dependency Structure Matrix could help you improve your software design”