Sunday, May 11, 2008

The Evolution of a matured C++ software engineer

One day one junior friend of mine came to me and asked what he should do to become a proficient C++ developer. And I was stumped. I didn't have any direct answer to his queries. Then I started pondering on this matter and was amazed to know that although there are so many books and articles on C++, but there is hardly anything which will tell a novice what to do or rather what to read to become a matured C++ engineer. Hence I am writing this article to demystify some of the basic things one must be aware of to become proficient in this subject matter. Some of the ideas presented here are common to any software domain, but I have given stress on C++ specifically.

UML Use Case

Before delving into the nitty gritty of the language one should be comfortable with UML use case analysis. Because this is one of the major ways for requirement gathering process. And for a GUI oriented project this gives the developer the pictorial view of the different flow of the application. Or in other words the developer can visualize about the work he is going to produce. Because I believe that a piece of work is done first in the mind and then it is depicted in the actual coding.
But how to develop the skill set for the UML Use cases. The best way to go about this is to think in terms of use cases. One should try to divide any software work into small use cases. The use cases developed this way may not be very complex but it gives the developer the idea of the subject. One should pick up any standard books on UML and formulate the idea. There are free tools available on the internet. One tool that comes to my mind is Visual Paradigm for UML. It has a community edition which is free of cost.

C++ Basics

With the increase in knowledge of UML use cases, the developer should start learning about the different aspects of C++ side by side. He should clarify the ideas about inheritance, polymorphism, virtual functions, abstract classes and so many other things. This may take several months to complete for a person having computer science background, and for one without any computer science background, this may take more time.
Once he is familiar with the basic C++ ideas, now he is ready for an entrance in the industry.

Coding Standard

Before writing a single line of code in a commercial project, the developer should be aware of the coding standards. Besides telling about the indentation and commenting about the comments, the coding standard is helpful in understanding the basic C++ concepts. It gives the developer an idea about how to write a maintainable C++ code. It tells the developer about the naming convention and helps him to understand why long and self-explanatory naming of variables and functions are preferred. Not only that, it also tells one about some of the basic things one should follow when developing C++ code. As an example the following item in the coding standard tells the developer how to delete a heap based pointer.

SomeClass* ptr;
......
.....
....
delete ptr;
ptr = NULL;

So if one always keeps these things in mind, it will become his habit.

UML Class Diagrams, Sequence Diagrams, etc

After learning about the C++ basics, the developer should focus into learning the rest of the UML concepts. This includes mainly Class Diagram and Sequence Diagram. My suggestion for the developer would be to translate any kind of C++ code into Class Diagrams and Sequence Diagrams. Again Visual Paradigm for UML would be a perfect free tool to learn about these things.

C++ Design

Now as the developer has started some coding and as he is familiar with UML, he becomes more or less comfortable with the C++ programming style. But what about the design. This is a very important aspect in any object oriented programming. So my suggestion to the developer would be to pick up some good books and learn about the designing aspect of C++. He may go through books like Effective C++, More Effective C++ and books like these in that series. After going through all these books, one should get familiar with the concepts of Design Pattern. The developer should pick up the Design Pattern book of GoF and become familiar with several aspects of an object oriented project. I also suggest the developer to pick up design pattern books like POSA.

Open Source Library

Now the developer has become a proficient C++ programmer. So my suggestion would be to delve into the source code of some C++ libraries like Boost and Loki. Some of the concepts from these libraries like Generalized function pointer, etc are very interesting.

Documentation

This is also very important aspect of good software. Any software should be accompanied with useful documentation. So my suggestion to the developer is make it an habit to extensively document and comment in the source code. All the public interfaces of a class should be well documented. Along with that a document which will give the bigger picture of how different modules are interacting with each other would be useful. UML diagrams will be a perfect requirement in documentation.
Conclusion

Are these all to become a good C++ engineer? Obviously not. The main challenge lies in how one can traverse from the problem domain to the solution domain; how one can break down the actual problem in hand into classes and modules. In other words how one can visualize the problem and its solution. The UML tools are there to help one out, but ultimately its the responsibility of the person to use that tool.

Hopefully the above discussion will guide the novice to become a proficient C++ engineer.

No comments: