Introduction and History of C++

by Seattle Web Design about a month ago in history

Overview of this high-level programming language

Introduction and History of C++

The high-level programming language C++ was created by computer scientist Bjarne Stroustrup in the early 1980s. C++ is one of the numerous programming languages still highly used today. This language was initially referred to as “C with Classes” — deriving from the original C language created by Dennis Ritchie. Both C and C++ share several similarities including basic syntax and code structure. These two programming languages essentially share the same language foundation.

Stroustrup wanted the addition of object-oriented programming (OOP), which drove him to create C++. The inclusion of OOP is the significant difference between C and C++. One of Stroutrup’s main purpose for designing C++ is utilizing abstractions, “providing only essential information to the outside world.” For example, Tamagotchi was one of the earliest digital pets for customers. Tamagotchi owners knew they had to care for their pets by feeding them, giving playtime, and cleaning up after them. These are the essential information users needed to know to keep their Tamagotchi happy and alive. However, users are not required to understand the formulas and algorithms used to determine the Tamagotchi’s feelings and lifespan. Hence, abstractions allow these algorithms and data to be hidden from the user.

Stroustrup’s thought process while creating C++, “…you have to be able to rely on it being available for decades on a variety of different hardware…” (Big Think, 2011).

Summarizing his interview with Big Think, his motivation for making C++ is increasing a program’s maintainability. With specific coding guidelines, the lifespan of a program or software can be extended. C++ Core Guidelines details many suggestions and instructions that aid the creation of efficient and maintainable code. These guidelines are created and continuously updated by Bjarne Stroustrup and Herb Sutter — with other numerous contributors.

Although C++ has been relevant for the last four decades, Stroustrup recognizes the language’s complexity as a problem. This predicament will be further discussed under “Advantages and Disadvantages” found later in the paper.

Platforms and IDEs

There is controversy on whether C++ is platform-independent as programmers may have differing definitions. The source code of C++ itself is not limited by platforms and thus can be considered platform-independent. The language can be written and compiled on several different operating systems including Windows, Linux, Unix, Mac OS, Android, Chrome, and more. However, C++ can be limited to a platform if the executable file contains operating system specific instructions or call functions. Similarly, Java’s source code is platform-independent, but the executable code is compiler-specific (Java virtual machine).

Every language requires an Integrated Development Environment(IDE), a location where the user can run and compile code. Setting up a local IDE for C++ relies on having a text editor and a compiler. However, there are also various existing online IDEs for programming languages. For example, zyBooks is an online textbook company that utilizes an online IDE to help readers simultaneously practice coding. In brief, C++ has the advantage of not being restricted by platform type.

Advantages and Disadvantages

There are several advantages when choosing C++ as a programming language. Referencing back to platforms and IDE, platform independency and minimal requirements for setting up an IDE are some benefits. Since there are few platform/IDE restrictions, C++ can be convenient if there is inconsistent access to the user’s machine.

Moreover, another significant benefit of using C++ is the application of object-oriented programming (OOP) which allows the creation of classes to define objects. OOP involves principles such as encapsulation, abstraction, polymorphism, and inheritance. The purpose of OOP is better organizing data and functions using classes that can only be accessed with permission.

Further elaborating on the Tamagotchi example from earlier, encapsulation must first be declared before utilizing abstraction. Encapsulation is a class that includes objects which “manages its own state via methods — and no other class can touch it unless explicitly allowed.” In this illustration, the class would be Tamagotchi with private variables and public methods. The private variables are information that users cannot view including Tamagotchi’s mood, hunger level, and lifespan. Whereas public methods can be viewed and called by users. For instance, feeding, cleaning, and playing with the Tamagotchi are public methods.

One drawback of programming with C++ is the consequences of incorrectly using pointers. This concept can be difficult to comprehend but is proven to be convenient when correctly used. For example, pointers allow quick, convenient access to a specific variable which then can be manipulated. However, “wild pointers” — pointers that are not assigned correctly or are invalid, can easily cause problematic coding issues. These pointers can lead to debugging issues or program crashes.

Another disadvantage is the lack of a garbage collector in the language of C++. Within this language, dynamic memory allocation (DMA) is utilized to move and manipulate data space for an object. Since C++ features DMA, a garbage collector is not applied as it is an automatic process for memory allocation. Since there is not a garbage collector, the programmer is burdened with ensuring appropriate memory allocation within their code. This can lead to certain issues if memory is not allocated properly such as memory leaks.

Also, complexity is an ongoing problem for C++, mentioned earlier in the introduction. Even though the language offers extensive language capabilities, there is an agreement that C++ contains ambiguous syntax rules. Program errors may occur since the compiler may not identify the problems related to the obscure rules. There is a great deal of information regarding the features and concepts of C++. Stroustrup admits within an interview that even he does not remember all of the details of C++:

“Even I can’t answer every question about C++ without reference to supporting material (e.g. my own books, online documentation, or the standard). I’m sure that if I tried to keep all of that information in my head, I’d become a worse programmer. What I do have is a far less detailed — arguably higher-level — a model of C++ in my head.” — Stroustrup

Considering everything thus far, the user ultimately decides whether the advantages outweigh the disadvantages of programming using C++.

Coding Examples

C++ emphasize readability for the user. This means that the code is easy to understand for non-programmers and programmers alike. Below of code in C++.

If Statements

if ( TRUE ) {

Execute the next statement

}

Example

If ( 3 >= 0 ) {

cout<<”Three is greater than zero.”

}

Loops

for ( variable initialization; condition; variable increment) {

Execute statement(s) while the condition is true

}

Example

for( int a = 5; a > 0; a = a — 1) {

cout << “Value of a: “ << a << end1;

}

Trends and Statistics

According to Stack Overflow’s insight statistics from 2019, C++ was one of the top ten most used programming languages. More specifically, it came in at 9th place, with 23.5% of 87,354 total responses. C++ was the tenth most used programming language among professional developers at 20.4% of 72,525 total responses. All in all, the top ten most used programming languages are the same. As displayed in the graphs below, the common top ten programming languages include JavaScript, SQL, Python, Java, Bash/Shell/PowerShell, C#, PHP, C++, and TypeScript.

Correspondingly to the statistics shown on GitHub based on Google Trends, C++ (grouped with C) remains in the top ten most popular programming languages. The statistics show that C/C++ is currently rank 5 with a positive trend of 0.1% compared to last year. The other languages trending in the top five include Python, Java, JavaScript, and C#. Although C++ is positively trending, C# and Java have been negatively trending at -0.7% and -2.7%, respectively. Python showed the greatest positive trend among the top 28 programming languages with a positive 3.3% trend over the past year.

Also, the logarithmic scale for C/C++ worldwide has remained steady over the past 15 years. Between 2005 and 2012, the trend was approximately positively trending around 10%. As the trend approaches the present, the trend decreases quite a bit. However, there is still a positive trend of approximately 5% between 2013 to the present.

Overall, C++ is a popular programming language choice around the world and there is an unlikely chance that this will change.

C++ in the Real World

C++ is widely acknowledged to be a powerful and secure programming language. The top five uses of this language consist of applications, games, animation, web browsers, and database access. Many popular web browsers and operating systems utilized C++, including Google Chrome, Firefox, and Microsoft Operating System. Additionally, MySQL, a popular open-source database was created using C++ over 25 years ago. Large organizations such as Google, Adobe, and Facebook rely on this database management software. MySQL earned the awarding title of the best database in 2019. Furthermore, there are various other applications whose code is partially made up of C++. Some examples consist of Spotify, Amazon, and YouTube. To summarize, C++ is a popular language choice because of its platform flexibility and adaptability to develop a range of programs.

Final Thoughts on C++

C++ has remained relevant for decades and is still widely used among developers, as proven by statistics. There are several explanations as to why C++ is a preferable coding language compared to other existing languages. The language’s efficiency and maintainability persuade programmers to utilize C++ within their long-term projects. This language can create various pieces including applications, operating systems, video game engines, and more. Whether its an application for an embedded system, like a washing machine, or a data analytics software for an SEO (Search Engine Optimization) consultant, C++ is a powerful language.

On the other hand, this language is extremely complex and difficult to comprehend for many new programmers. If the programmer cannot fully comprehend the concepts of C++ — errors and crashes can occur, making their code flawed or unusable. Wild pointers and inadequately allocating memory are a couple of examples that can cause such errors. All in all, C++ remains a top programming language choice and can be a powerful tool once properly learned.

history
Seattle Web Design
Seattle Web Design
Read next: Wearables vs The Virus | João Bocas | Engati Engage
Seattle Web Design

Seattle Web Design and Online Marketing agency provides a range of web related services to businesses and professionals.

Visit Visualwebz.com

See all posts by Seattle Web Design