WHY OBJECT-ORIENTED PROGRAMMING IN C++
1. History of C++
C, C++, Java, and C# are very similar. C++ evolved from C. Java was modeled after C++. C# is a subset of C++ with some features similar to Java. If you know one of these languages, it is easy to learn the others.
C evolved from the B language and the B language evolved from the BCPL language. BCPL was developed by Martin Richards in the mid-1960s for writing operating systems and compilers.
C++ is an extension of C, developed by Bjarne Stroustrup at Bell Labs during 1983-1985. C++ added a number of features that improved the C language.
2. Why C++?
C++ embodies the dominant computing paradigm, Object-Oriented Programming (OOP). Object-oriented programming techniques are more natural than structured programming. You’ll learn both since OOP is built upon structured programming.
Learning C++ also teaches you an enhanced form of C.
Advanced computing topics (operating systems, etc) are typically and more efficiently implemented in C/C++.
Legacy migration of systems from C to C++ (30+ years of C code to migrate to C++ means jobs!).
Contrary to popular belief, it’s fun!
o Why object-oriented programming?
A natural way of thinking about the world and computer programs Object-oriented design (OOD)
Models real-world objects in software Models communication among objects
Encapsulates attributes and operations (behaviors) Information hiding
Communication through well-defined interfaces Object-oriented language
Programming in object oriented languages is called object-oriented programming (OOP) C++ is an object-oriented language
Programmers can create user-defined types called classes
Contain data members (attributes) and member functions (behaviors) o What are objects?
Reusable software components that
model real world items Meaningful software units
o Time objects, paycheck objects, record objects, etc. o Any noun can be represented as an object
Objects have attributes
o Size, shape, color, weight, etc. Exhibit behaviors
o Babies cry, crawl, sleep, etc.; cars accelerate, brake, turn, etc.
More understandable, better organized and easier to maintain than procedural programming
Libraries of reusable software
o MFC (Microsoft Foundation Classes)