CSC 458 - C++ Programming: Java vs. C++ - What Are The Similarities and Differences?
CSC 458 - C++ Programming: Java vs. C++ - What Are The Similarities and Differences?
Lecture 2
Brief History of C++ High Level Differences Between C++ and Java Reasons to use C++
Introduction
Java and C++ look a lot alike syntactically. Many of the basic constructs in Java have only minor technical differences from C++; other Java features (such as OOP support for classes) have a similar look and feel to C++. How did we obtain these languages?
The first forms of language were actually physical motion languages the programmer physically moved gears and/or wires to convey what they wished the computer to do. Programming was accomplished by rewiring the entire system each time a new calculation was required.
FORTRAN (FORmula TRANslation) COBOL (COmon Business Oriented Language) LISP (LISt Processing language)
FORTRAN
Computer Science without FORTRAN and COBOL is like birthday cake without ketchup and mustard.
COBOL
Compiles Only Because Of Luck Compiles Only By Odd Luck Completely Obsolete Business Oriented Language Completely Obsolete Boring Old Language
LISP
Please don't assume Lisp is only useful for Animation and Graphics, AI, Bioinformatics, B2B and E-Commerce, Data Mining, EDA/Semiconductor applications, Expert Systems, Finance, Intelligent Agents, Knowledge Management, Mechanical CAD, Modeling and Simulation, Natural Language, Optimization, Research, Risk Analysis, Scheduling, Telecom, and Web Authoring just because these are the only things they happened to list. Kent Pitman
Algol
Led to:
Pascal
Developed out of necessity for a good teaching language Combined best features of COBOL, FORTRAN, and Algol Improved pointers, introduced CASE statements
Built to be fast and powerful Hard to read Many OS built in C (Unix, Windows, MacOS, and Linux)
C++
C with Classes Built to maintain speed of C (and run C programs) and be more portable Language of choice in high school AP classes
Java
Visual Basic
Perl
Depending on who you ask, Perl stands for:
Back to C++
C++ should be viewed as a new language, based largely on C. It includes modern constructs to support OOP and was influenced by several design issues.
Intended to be upward compatible with C as much as possible (i.e. legal C programs should be legal C++ programs) C++ programs should be as fast as C programs if they do the same thing.
No one wants to learn a more complicated language to produce slower code This means: no runtime bounds checks, no garbage collection
Has continually evolved, first supporting classes and inheritance, later adding templates, exceptions, and namespaces
Java Development
Allow the programmer to write the same set of programs that C++ allows, using simpler syntax Make it harder for incorrect code to run Requires compiler to detect many sets of errors when it first compiles the program and requiring the Virtual Machine to throw an exceptions when bad things happen at runtime. This also enhances security against hacking
C++ is still widely used Templates Operator Overloading STL Automatic Reclamation of Resources Conditional Compilation Distinctions between Accessor and Mutator Multiple Implementation Inheritance Space Efficiency Private Inheritance