How many times have you read a comment about C++ like this one:
C++ is a difficult language even for experienced C++ developers. Even for the simplest algorithms you have to explain many of the language subtleties. Consider a Hello World example:
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
}What's that #include command? What's std::cout. Why the ::? What is <<? Ohhh, it is an overloaded operator! What's an overloaded operator? Sooo, for ints, it does bit shifting, but for whatever std::cout is, it outputs stuff to the console. Ohhh, std::cout is a stream, and streams have their << and >> operator overloaded.Let's see the same sample in Python:
print("Hello World!")Maybe this observation is true if we directly use the methods and utilities provided by the standard. But that’s not the case in real-world C++ projects. In fact, many C++ projects contain code like this:
#include "utilities"
int main()
{
print("Hello World!");
}The fact that we have a low-level mechanism for console output through std::cout, along with all the possibilities it provides, gives the language a richness that is not found in many other languages. It’s up to you to make the most of that richness to produce code that is easy to read, maintain, and efficient.
The same observation applies to any C++ code considered overly complicated. In C++, we have everything we need to simplify its use and provide libraries that hide the complexity, making the language easier to work with.
Let’s take another example: opening a file and reading all of its contents. In C#, you can do it like this:
string text = System.IO.File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt");
But is there anything preventing us from doing the same in C++?
string text = FileHelper.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt");
However, many developers might ask: why do I need another library to easily do what I want? Why not embed these facilities in the standard library?
Perhaps the best answer is another question: why are there so many libraries for every language? Sooner or later, we need to use external libraries, even with the easiest languages. And in real-world projects, even with Python, in-house libraries are often used — along with many external libraries, of course.
Don’t forget that a programming language is intended for engineers who have the basic skills required to use the capabilities it provides. In any field, isn’t an engineer’s job to analyze a problem, adapt, and provide an efficient solution? C++ may be low-level, but it gives us more possibilities, and its richness can help us solve problems efficiently.
Personally, in many of the C++ projects I worked on, we had an in-house library that simplified recurring tasks. Any developer who encountered a recurring need could suggest adding a utility to the library, and the entire team benefited from these additions. This approach doesn’t require C++ gurus or experts on the team — it’s simply common sense.
