Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

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:

  • making 3D applications, using static scenes, core 3D primitives and components;
  • mixing 3D and 2D in C++Builder application UI, viewports;
  • encapsulation, class-object concepts, creating objects in runtime, components and classes;
  • pointers, object lifetime, constructors/destructors; 
  • object containers: TList (on the base of “void*”), TObjectList, list <…> (templates, STL, parametic classes);
  • TObjectList – inheritance, storing dynamically-created objects in TObjectList, inheritance of TObjectList, creating TMyObjectList;
  • polymorphism or “how to treat different objects the same way”;
  • saving 3D scene, serialization, working with files
  • making compositions of objects: association, aggregation, composition;
  • making custom components, TMesh;

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 🙂

What's New for RAD Studio 11

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts

What's New in the GetIt Package Manager - June 2020


RAD Studio 10.4 Now Available, Learn More


Open for Business with 10.4! - May 2020 GM Update


Embarcadero Open Source Project Sponsorship

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.