- Published on
Introduction To C++ Programming
- Authors
- Name
- Amarnath B R
- @digitallyamar
C++ is a simple yet efficient Object Oriented Programming (OOPS) language. One of the main reasons why C++ shines compared to other OOPS based programming language such as Java is that it's syntax is heavily based on C programming language.
In fact, C++ was developed using C as it's base programming language but with OOPS support baked into it. It is for this reason that this language gained quick adoption by the programming community during it's early stages.
However this does not mean that C++ is in any way inferior or inefficient compared to Java or other similar languages.
Infact, C++ is one of the most used programming language by the competitive programming community, mainly because of it's speed of execution and efficiency.
So if you are just still wondering if you need to learn C++ or not, this reason alone should convince you. If you ever want to take part in any coding contests or competitive programming, C++ will come in extremely handy for you.
Why learn C++ ?
If you are coming from a procedural programming language like C, then it will take some time for you to get your mind around working with OOPS concepts.
However, if there is one and only thing that you need to know to get started thinking in terms of OOPS programming, then it is this:
When you design your program in C, you would think and write your program based on your computer's memory layout and it's architecture.
What I mean by that is that say you want to store data about the information of an automobile - it's name, number of wheels, number of doors etc. Then what we do in C is to allocate memory to store these values using variables. So for name, we use a character array, for no. of wheels and doors, we would use two integer variables. We would then think if these numbers can be stored in a short integer or does it need a long integer. In this case, a short data type is sufficient.
So as you can see, rather than thinking about this problem in terms of problem domain i.e. think in terms of automobile, we have moved to think in terms of how it gets stored in the memory.
We need to do this because C programming language forces us to think in terms of how it runs in a computer hardware (RAM, CPU etc). So this will push us away from actual problem space where in we should have been thinking in terms of automobile domain.
So everytime we write a program in C, we need to do this translation from problem domain to machine hardware domain. This will reduce the efficiency of a programmer!
Wouldn't it have been better if we could write our program directly in the problem domain and skip this translation all together? That is where the Object Oriented Programming (OOPS) concept wins!
OOPS allows us to think and write our program directly in the actual problem space, thus making our code more readable and efficient!
In the coming articles, I will tell you how this works and what tools an Object Oriented Programming language like C++ provides that helps us in this transition.
So, if this sounds exciting, bookmark this page and visit back for future articles on C++ programming language.