Table of Contents
1. Use The Latest Modern Components via Get-It!
When developing Modern C++ apps we mostly refer to a lot of libraries and other tools that helps us to modernize our applications. They also help to save time, to save us to see a lot of code lines, to save us to learn and focus on more areas. One of the strongest parts of C++ Builder is its components and libraries, plus it supports 3rd party components and libraries. GetIt also a good place for developers who wants to release this kind of libraries and tools.
The GetIt Package Manager, is an official tool (a window form) of RAD Studio IDE that comes with C++ Builder and/or Delphi. GetIt Package Manager lets you search and browse available packages (C++ or Delphi Components, Libraries, Components for IoT, Styles, Sample Projects, Tools, IDE Plugins, Patches, Trials). From this window you can install, uninstall, update, or subscribe to these packages. Currently it has about 300 components, all are in up to date, and able to run on the latest RADS version.
2. Use 3rd Party Components and Libraries!
RAD Studio, C++ Builder is a C++ IDE that allows users to install 3rd party components. These components allow users to add features and functionality to their C++ apps without needing to write lots of new code. Easy to connect, easy to compile, easy to design and view tables and easy to handle many digital features. There are more than 100 C++ components, all of them are really great and they have different helps in design and programming apps. All components can be found here. Here are our favorite picks right now.
3. Use Styles, Skin your Apps!
Syles are sets of graphical details that define the look and feel of a application visually and they are one of most beautiful and useful UI feature of RAD Studio, that makes your UI elements skinned with professionally designed with different Styles. Official Styles are designed by Embarcadero’s Designers and other there are other 3rd party Styles, also users may generate their own styles. Styles are similar to themes in Windows or skins of applications. Styles are being modernized with RAD Studio, C++ Builder and Delphi since the first XE versions (2010), currently C++ Builder 10.4 has many improvements on Styles.
In RAD Studio, Multi-Device C++ Builder FireMonkey Projects, using styles on your new projects is very easy. You design your application view in normal ways with buttons, labels, edit boxes, memos, trackbars, panels, switches etc. You can also add these Styles to your Old C++ Builder Projects or to Old C++ Builder Unit files. You just need a RAD Studio, C++ Builder which supports styles, we highly recommend you latest RADS , C++ Builder 10.x versions which has new features and improvements on Styles.
4. Use Viewport3D
In application development 3D Objects can be displayed with 2D projection methods by using 2D / 3D mathematical calculations. That may be hard and needs much coding to display them. You can use OpenGL and DirectX with their own 3D commands to display them. You can also use and port a 3D Engine SDK. Simply, In C++ Builder 3D Objects can be easily displayed in the Viewport3D Component. You can change their shape, position, color, materials etc. on design time or on runtime. You can add Texture Materials or Light Materials on them. You can group them by using Dummy objects. You can use all of these without any graphical engine API/SDK/DLL or Lib. You just need to drag one of the 3D objects listed below in to viewport, then you have windows applications which has 3D objects. Note that FireMonkey supports GPU usage on runtime. All basic 3d objects can be be found in 3D Shapes category of Tool Palette.
5. Use OpenGL
In C++, we can use OpenGL or Direct3D libraries or some other 3rd party 3D Engines. OpenGL is one of the 3D Graphic Library that allows you to create 3D applications.
C++ Builder supports to develop very low level graphics (here low term means very fast and native codes for 3D graphics) with specific C++ codes or with OpenGL. If you want to simulate something with OpenGL or if you want to develop a game with OpenGL, we should setup openGL we need a loop that loops on Application Idle. In this loop we should apply physics and we should draw or update our 3D objects.
OpenGL (Open Graphics Library) is a 3D library for development of graphical programs. It is a cross-language, cross-platform Application Programming Interface (API) for rendering 2D and 3D vector graphics. The OpenGL API is typically used to interact with CPU and mostly with GPU to achieve hardware accelerated rendering.
6. Use Transparent Option for Gorgeous Transparent App Windows
In C++ Builder, we can easily develop these kind of transparent FMX applications. FireMonkey (FMX) framework supports modern ways to manipulate transparency of each UI elements, bitmaps, canvas drawings, and allows you to set pixel colors in ARGB form. I should note that, for the Firemonkey FMX applications, Windows applications successfully runs with transparency, I personally haven’t checked if the other operating systems supports this.
7. Use Effects
C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. One of the greatest features of VCL and FMX UI frameworks are the effects on UI elements. There are many UI effects that can be used on most of the visual elements supported officially by the Embarcadero. There are many good effects that we can use: Sepia Effect, Reflection Effects, Shadow Effects, Emboss Effects, Glow Effects, … etc. Here are few posts about some of effects in C++ Builder,
Please check LearnCPlusPlus.org for more UI Effect examples. For further information, please check official docwiki about TEffect and FireMonkey Image Effects.
8. Use Animation & Transition Effects
Use Animation Effects and Transitions Effects of C++ Builder. Here are two great videos about how to use them,
9. Use Modern Strings, UnicodeStrings
Avoid using Char Array, AnsiChar and WideString. Use UnicodeStrings, std::wstring, std::u16string, std::u32Strings in string formats to support worldwide language; avoid using fixed char arrays as much as possible. Char Arrays can be used in some specific operations. Do not use them to hold User Names, Addresses etc.
In C++ Builder, We highlUnicode standard for UnicodeString provides a unique number for every character (8, 16 or 32 bits) more than ASCII (8 bits) characters. UnicodeStrings are being used widely because of support to languages world wide and emojis. In modern C++ nowadays there are two types of strings used; array of chars (char strings) and UnicodeStrings (WideStrings and AnsiStrings are older, not compatible with all features now). CLANG / C++ Builder / GNU C / VC++ compilers, IDEs are using this standard for GUI forms to support all languages to provided applications in global. More information about the structure of Unicode Strings can be found here .
RAD Studio , Delphi & C++ Builder uses Unicode-based strings: that is, the type String is a Unicode string (System.UnicodeString) instead of an ANSI string. If you want to transform your codes to Unicode strings we recommend you this article.
10. Use OOP, Classes, Objects, Methods; Use Modern CLANG Standards
Use Classes, Objects, Methods, Events and more modern methods of C++. Avoid to use old methods, modernize your codes. These will allow you develop your applications more professionally and this will make them ready for the future versions of compilers.
Object Oriented Programming is a way to integrate with objects which can contain data in the form of attributes or properties of objects, and code blocks in the form of methods, functions of objects. These attributes and methods that belong to the class are generally referred to as class members. Object-Oriented Programming (OOP) is a good way to work on data and work with functions in memory. Classes and Objects are the best way to work on properties and functions. Object-Oriented Programming has many advantages over procedural programming, and it is the most characteristic feature of the C++ programming language.
Before learning about Classes and Objects it is important to learn about Object Oriented Programming.
Benefits of Object-Oriented Programming are,
- faster and easier to execute
- provides a clear structure for the programs
- helps to keep the C++ code DRY “Don’t Repeat Yourself”, and makes the code easier to maintain, modify and debug
- makes it possible to create full reusable applications with less code and shorter development time
Procedural programming is about functions ( procedures, sub-functions, algorithms ) that perform operations on variables (properties). While OOP is about objects with a defined class that contain both properties and functions. OOP is a modern way to use both variables and functions safely.
CLANG is considered to be a production quality C, Objective-C, C++ and Objective-C++ compiler when targeting X86-32, X86-64, and ARM. It is a new C/C++ compiler standard (C++98, C++11, C++17, C++20, C++23 ..) supported by The LLVM Compiler Infrastructure Project, and has been a default compiler in recent years for most C/C++ compilers. This means that if you code for a CLANG compiler, most other IDEs, Compilers of Platforms will support your code without any changes. The latest C++17 standard is supported by the most C++ compilers. More information about core language features can be found here.
We highly recommend you start with or to move to a CLANG Enhanced compiler like the Embarcadero’s C++ Builder, which supports the CLANG (C++11, C++ 17) standard and has its own C++ Compiler, IDE, GUI Designer and more. The C++Builder Standards and Clang Enhanced Compiler features can be found here.
Learn more about techniques how you can tackle common questions on Strings in C++ in this informative article.