Z’s

August 16, 2007

What Makes You a Good C/C++ Coder?

Filed under: C/C++,Techs — mdzahidh @ 7:57 pm

Simple answer to this, perhaps, million dollar question is “Experience.” Now that’s vague enough to be applied to every other language on the planet. So what really does make someone a good C/C++ coder. Btw, do not even dare asking this question to Bjarne Stroustrup or Dennis Ritchie or perhaps guys like Linus Torvald 🙂 since they surely have their own definition of being “good” which comprise only themselves :).

Following is an excerpt of an email that I wrote to someone suggesting him which areas to explore to attend an interview for the game dev team at ReliSource Ltd:

“1. Thorough understanding of pointers and memory related stuffs. Which may include understanding of all memory related operations like malloc, free, calloc, new, delete , delete []. We will try to figure out how you plan to deal with not writing or at-least avoiding memory-leaks. Even the best programmers add memory leaks, so we will try to figure out how you might plan to detect memory leaks and fix them.

2. Understanding of Function Pointer and how it might be used.

3. Tricky application of MACROS.

4. Thorough understanding of OOP (which i guess you already have since you do a lot of Java ). But the important thing here is C/C++ way of doing OOP is different (Hint:virtual keyword, multiple inheritance). It also includes understanding of how C/C++ achieves OOP (Hint: vtable).

5. Very good understanding of “Copy Constructor” and why and where it might be absolutely necessary.

6. Singleton design .

7. Understanding of Templates and fluency in STL .

8. Optimization: This is extremely important specially for our projects. You must know which code produces faster executable. How OOP may slow down your process. Code Bloating introduced by Templates. How normal C can be used to make OOP-alike features (Hint: Function Pointer).”

Well, the list can grow bigger but exploring the above areas pretty much makes someone a good C/C++ coder. Obviously this article doesn’t consider the algorithmic, mathematical and problem solving skills of a person which is unrelated to any specific programming language.

Advertisements

9 Comments »

  1. Thank you for the points. They will be very helpful for people who want to establish themselve as good c/c++ programmers.

    Comment by Reza — August 17, 2007 @ 12:03 pm | Reply

  2. When Zahid talks on technical things most of fly over my head. So, this is not a special case. I finally able to understand the use of the above thing coz I have used those in small application except macros. I really dont know how use macros and how a non experience (work exp) coder like me will able to answer questions like macros??

    Comment by Jalal — August 19, 2007 @ 3:11 am | Reply

  3. Well, the easiest of the above lot is the MACRO. Jalal, i am sure you have used macros, its just about using #defines, thats it. But you will be amazed how simple #defines can be used in your code in intriguing ways.

    Comment by mdzahidh — August 19, 2007 @ 6:36 am | Reply

  4. Exclusive guideline for any C/C++ newbie coders 🙂
    You are BlogLinked! 😉

    Comment by Tahmid Munaz — August 21, 2007 @ 5:32 pm | Reply

  5. Nice article, but I would like to know why you pointed out the singleton pattern explicitly and why it is so valuable in C++. Forgive my ignorance (in c++) 🙂

    Comment by Shams — August 22, 2007 @ 9:03 am | Reply

  6. Though I am a Java fanatic, I find the Blog quite intriguing. But I find (8) to be a little too difficult as it only comes with experience.

    By the grace of Allah I almost know all the other points except memory leak. I am looking forward to a post on it from Zahid; especially because I know that Zahid mastered it 🙂

    Comment by Imran M Yousuf — August 22, 2007 @ 9:08 am | Reply

  7. @Shams: Though Singleton is one type of design pattern but this is something that is used in almost all projects quite heavily. To reduce code-rewriting, people often write a Template Singleton class then derive all other singletons from that Template. So I thought its good to have knowledge on how to write Singleton, Template Singleton and etc.

    @Imran: Memory Leak Avoidance and Detection both actually come through experience. But there are still various programmatic aids that you can use to detect Memory Leaks, for example crtdbg routines of VC++. While in eSophers I was not aware of the existence of crtdbg and wrote a leak detector myself which worked almost similarly to crtdbg. That leak detector was esoterically named as “Terror Lib” and was dedicated to Sazzad Bhai (Mr. Terror). But later I found that crtdbg is already there to do just that. But crtdbg is not portable ,as far as i know. So if you are planning to write some cross-platform code, use your own leak detector. I will probably write something on leak detection soon, so stay tuned

    Comment by mdzahidh — August 23, 2007 @ 6:06 am | Reply

  8. Boost!!
    Use Boost C++ libraries which can I suppose help one out with memory leaks and so on. Some of the libraries in Boost are supposed to be incorporated into the next version of C++ (C++0x). But there are lot more stuff in Boost than just smart pointers. I am glad that Boost is being incorporated just like STL was done a few years ago..:D:D

    The days of JAVA are coming to an end (maybe not).. long live C++

    Comment by Ruman Zakaria — May 22, 2008 @ 11:58 am | Reply

  9. Excellent blog post. I certainly appreciate this site.
    Continue the good work!

    Comment by Phillip — December 30, 2012 @ 1:08 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: