Learning C++
Like humans use languages to communicate with each other, programming languages use coding to communicate with the processor. Computer code accomplishes different tasks that involve talking with the processor. Modern programming languages were developed in the late 1940’s. One of the very first programming languages was the Assembly language, a low-level programming language that simplified the language of machine code. FORTRAN (FORmula TRANslation), which was introduced around 1957, was a language specifically geared for high-level scientific, mathematical, and statistical computations. It is one of the most successful languages, and is still in use today in some of the world’s most advanced supercomputers.
C, the precursor of C++, was developed by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. Today, there is a whole bunch of languages that are used to develop code. Many of them are identified with the flavour of the OS. For example, PHP works best for Linux, VB.NET works with Windows, etc. However, in general, most popular programming languages like C, C++, Python, etc. run on all kinds of OS.
Why C++
While there are many languages available today, C++ still continues to be one of most preferred languages. The reason it is popular is because it is fast, it can be used to develop anything from very simple (say adding two numbers) to highly complex programs that include developing a complete operating system. It has enhanced features that allow it to be more close to hardware than most other languages. It is pertinent to note here that C++ has been derived from C. It has similar syntax as C, is compiled almost the same way, is close to hardware like C, and shares code structure with C. Like C, C++ also has unique concepts like stack, heap, file-scope and static variables that set it apart from some other coding languages. C++ is a language in which new and different features are built on top of an existing syntax. Due to this, C++ is often referred to as a hybrid object-oriented programming language. Unlike C, however, C++ has added many features, like enabling object oriented programming, templates, memory handling, error handling and more tools for the programmers. Like any human language, C++ provides a way to express concepts. If successful, this medium of expression will be significantly easier and more flexible than the alternatives as problems grow larger and more complex. However, at its heart, what separates C++ from C is the fact that it is an Object Oriented Programming (OOP) language.
Object Oriented Programming (OOP)
Another serious drawback with the procedural approach is that we do not model real world problems very well. This is because functions are action-oriented and do not really corresponding to the element of the problem. FORTRAN and C are some popular procedural languages.
OOP
- Everything Is an object: this is one of the most important concepts of languages based on OOPs. C++ and other OOPs based language. These objects communicate by sending and receiving messages (in terms of objects). They also have their own memory.
- Classes: a class describes the contents of the objects that belong to it. In essence, it describes an aggregate of data fields (called instance variables), and defines the operations (called methods). Every object is an instance of a class, and the class holds the shared behaviour for its instances.
- Data Abstraction: another important concept in OOPs is data abstraction. Data abstraction hides unnecessary details from the user; enabling them to focus on their task. A simple example is driving a car. The driver need not know about engines, spark plugs, carburetors, etc. in order to drive a car. Hiding these details under the hood (pun intended!), allows the drivers to focus on what they want to do – drive the car. Similarly, by hiding unnecessary details from the user, OOP enables the user to implement more complex logic on top of the provided abstraction without understanding or even thinking about all the hidden complexity.