close

Вход

Забыли?

вход по аккаунту

?

CSC 308 – Graphics Programming

код для вставкиСкачать
CSC 458 – C++ Programming
Java vs. C++ - What are the similarities
and differences?
Information from:
* “C++ for Java Programmers” – Weiss
* Wikipedia.com
Dr. Paige H. Meeker
Computer Science
Presbyterian College, Clinton, SC
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?
History of Programming Languages
Since we have had computers, we
have needed a means of
communicating with them to obtain
desired results. This necessitates
some sort of language that will
allow communication between man
and machine.
History of Programming 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.
History of Programming Languages
п‚Ў
John von Neumann’s Computing
Concepts
пЃ¬
пЃ¬
Shared-Program Technique
Conditional Control Transfer
History of Programming Languages
п‚Ў
п‚Ў
1951: First Compiler (Grace
Hopper)
First High Level Languages:
пЃ¬
пЃ¬
пЃ¬
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
п‚Ў
Alternative expansions of the
COBOL acronym have been
suggested:
пЃ¬
пЃ¬
пЃ¬
пЃ¬
Compiles Only Because Of Luck
Compiles Only By Odd Luck
Completely Obsolete Business Oriented
Language
Completely Obsolete Boring Old
Language
COBOL – Hello World
IDENTIFICATION DIVISION.
Program-Id. Hello-World.
*
ENVIRONMENT DIVISION.
*
DATA DIVISION.
*
PROCEDURE DIVISION.
Para1.
DISPLAY "Hello, world.".
*
Stop Run.
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
C
C++
Java
First language with a formal
grammar (BNF)
Pascal
п‚Ў
п‚Ў
п‚Ў
Developed out of necessity for a
good teaching language
Combined best features of COBOL,
FORTRAN, and Algol
Improved pointers, introduced CASE
statements
C
п‚Ў
п‚Ў
п‚Ў
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:
пЃ¬
пЃ¬
Practical Extraction and Reporting
Language
Pathologically Eclectic Rubbish Lister.
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.
C++ Design Concerns
п‚Ў
п‚Ў
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
C++ Design Concerns
п‚Ў
Has continually evolved, first
supporting classes and inheritance,
later adding templates, exceptions,
and namespaces
Java Development
п‚Ў
Similar to C++ cosmetically, but
designers had two main goals
пЃ¬
пЃ¬
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
High Level Differences between C++
and Java
п‚Ў
п‚Ў
п‚Ў
п‚Ў
Compiled vs. Interpreted Code
Security and Robustness
Multithreading
API
Why learn C++?
п‚Ў
п‚Ў
п‚Ў
п‚Ў
п‚Ў
п‚Ў
п‚Ў
п‚Ў
п‚Ў
п‚Ў
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
Документ
Категория
Презентации
Просмотров
10
Размер файла
116 Кб
Теги
1/--страниц
Пожаловаться на содержимое документа