To C(++) or not to C(++)

The primary text books for my sons was (and still is) Starting out with C++. From Control Structures through Objects by Tony Gaddis published by Addison Wesley 2009. We use the 6th edition which is not as expensive as the most recent ones.

 
I feel that this is one of the best introductory and intermediate textbook around. My decision to jump right into C++ is based on decades of my experience in teaching programming and my professional software development career. I decided against starting with an “easier” language like Python or PhP. I also decided against starting with Java.
There are two reasons. I think that C++ used from the very beginning imposes the structure and algorithmic thinking on the student, whereas other languages offer much abbreviated notation that might not be transferrable to other programming languages.
Secondly, one of the biggest problems in programming is managed code vs. unmanaged code. Basically, we can write code and let the programming environment manage memory (managed code) or do it manually. Programmers, who manage manually the memory, have a bit more complexity to deal with. However, the benefits are enormous. Besides, a much better understanding of what is going on, the code runs more efficiently. Managed programming languages like Java or C# execute much slower. One of the key reasons is that managed environment is less efficient.
 
Another big discussion among programmers and researchers centers on single-threaded vs. multi-threaded programming. Basically, all computers today are equipped with multi-core CPUs (central processing units). It means that, by design, microprocessors are designed to execute multiple programs in parallel. Many programmers support the approach of teaching parallel programming for multi-core CPUs from the introductory courses. Environments supporting parallel programming like OpenMP or MPI have almost a religious following.
 
 
 
 
  Despite the obvious importance of parallel code architectures we have decided to skip this topic until my sons have a good grasp of basic data processing algorithms and data structures. Computer graphics is also a big magnet for the boys. Therefore, we devoted a significant amount of time to studying the contents of the following text: The Nature of Code: Simulating Natural Systems with Processing by Daniel Shiffman.
 
 
 
It is a wonderful resource for learning computer graphics and visualizations applicable to such fields as multi-agent system simulations, physical system simulations, steering behaviors, etc. The code discussed in the book is based on Java and Processing.org framework.
 

 
Although I mentioned several times that we decided to focus on C++, this Java-based framework offers one major advantage i.e. the graphical libraries are integrated in the framework. Therefore, displaying graphics on screen is significantly easier compering to C++ and OpenGL or DirectX. (I will write a separate post on OpenGL programming). The ease of use is important for a beginner or intermediate programmer. Often, displaying the simplest shape on screen requires a significant setup and a good understanding of video card hardware.

Future work in computer graphics
 Computer graphics is a very mathematical field. Down the road, I will introduce a more general textbook into our curriculum. The Computational Geometry in C by Joseph O’Rourke is discussing basic concepts lie Voronoi diagrams or intersecting polygons with code examples. This book will be a great foundation for future studies in advanced 3D graphics.
 
 
 

No comments:

Post a Comment