Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

CAD with C++Builder, episode#1

Author: Seva Leonov

Learning tasks and motivation

When teaching programming skills, especially with C++, one of the main issue is the selection of right examples and tasks. C++ is not that easy both in syntax, and concepts, and so students are demotivated just by the number of pages in the book. The true motive when studying a complicated discipline is the seeing the progress not in just understanding, but in making applications. The learning tasks must be easy, exciting, and methodically correct. The last requirement means the tasks should initiated and support self-education and achievement of incremental educational targets. Simply saying, incapsulation, inheritance, and polymorphism should be immediately implemented when solving student problems. 

I started teaching C++ in 1997 (20 years ago), and then my favorite task for students was “vector graphical editor”, kind of canonical TShape, TCircle, TRectangle with 2D graphics. Thanks to XE2 and following C++Builder versions, where we can use 3D graphics at the ready components level. That was the point, when learning C++ started being so attractive, that never before. 

Epic fail

Never give students “game development” tasks. The approach used to be good, when PC games were pacman-like simple. Within the learning course we can manage to do only simple games, but poor results comparing to modern 3D shooters is not the main pain. Some flash-games are still interesting, while being simple. The problem is that students are easy to distract from the Object-Oriented Analysis & Coding wihtin the OOP paradigms, and start thinking of gameplay scenarious etc. The main idea of OOP is the making complicated coding tasks easier, reducing the code modification time/manpower/cost. 

Ok, you’re really stuck to “game development”. In this case you may continue using C++Builder and let your students program “combats” like in “Herous of Might and Magic”. The dragons, hoblins, archers, and pikemen all have similiarities, and demonstrate polymorphic behavior, while definitelly their classes are different visually and in code (walking/flying, distant attach/close attack, using magic/no magic).

Why CAD (with C++Builder) as a learning task?

CAD development is an incremental task, and great to be split into auditory and self-study hours. Here the list of topics:

This is module 1 of the CAD development for students. Next module 2 will cover making custom components (TMesh), adding Box2D support, refactoring code to using STL’s list <…>, and using JSON to serialize “plain” objects. Module 3 will use mobile development tools in C++Builder to make mobile version of CAD. 

…next post will show the current progress of my students, who are already ending module 1 instead of having summer vacation 🙂 Yes, I’m a motivator 🙂

Exit mobile version