In The Beginning
The C language was
created at
ATT Bell Labs during the 1970's
by Ken Thompson and Dennis Ritchie.
- C was created to write the Unix operating system.
- Intended to replace assembly language.
- As such, it is very low level. Tends to expose details of the
hardware.
- Adds a minimum of overhead. Used when execution speed is important.
The C language is small, and it produces
efficient object programs. This makes it well-suited for
for small and slow computers.
- Unix was written for a minicomputer, the smallest sort of machine
available at the time.
- C was very well-suited for the original PCs.
- Very important for embedded systems.
C is widely used for system software, both operating systems and
networking servers. It is also still important on the desktop, though
it is just one of many there.
The New Class
In 1979, Bjarne Stroustrup at Bell Labs was studying
the problem of partitioning the Unix kernel code in order to
build a distributed system. Having previous experience with
the class construct, he developed
a tool to add
classes to C
to express the modular structure of the code he was studying.
This effort eventually grew into a new programming language.
- Originally: C++ meant C + classes.
- Over time, much more than that was added.
- C and C++ are separate languages, with C (mostly) a subset of C++.
- C++ is designed to be compatible, so a C program can be compiled
under a C++ compiler with minimal changes.
- Plain C is still widely used, particularly for system software (both
the OS and networking servers), and for embedded systems
where small size is essential
California Does Its Own Thing
Java was created in the 1990s,
originally
for use in embedded systems.
James
Gosling is usually given as the primary designer, though others
were were involved.
- Largely a cleaned-up version of C++.
- Discarded compatibility with C, and most of C's older constructs.
- Fairly pure implementation of the OO paradigm.
- Portability is a primary goal, not run-time efficiency.
- Similar syntax to C++.
- Some rather subtle semantic differences.
Speaking Generically
The idea of generic programming is to
build a data structure
without knowing all of the types, so that the code
can then be reused with any or many data types.
Many languages support generic programming in some form, including
Java generics and C++ templates.
- Generics were not part of the original C++ design, but were
added later.
- They were part of the first official standard, in 1998.
- Also included was the Standard Template Library, which used
templates to provide a nice set of generic data structures.
And Now
The C++ standard continues to be updated. The latest
standard is C++17.
It includes accumulated improvements such as:
improvements as:
- Language support for threading.
- Anonymous functions.
- Smart pointers which provide a form of automatic storage management.
- And much more.
Environment
C++ is a text-oriented language. It has no standard Graphical
User Interface library.
A C program types to the console and reads data from the keyboard.
No one had heard of a GUI. The user of a minicomputer typed text
commands on a console or terminal device, and read responses typed
by the computer.
C++ is still a text-based language. The original C had a very good
I/O system for printing and other features for using this environment well.
It is very good at flinging text around. C++ is even better.
So What Will We Do?
This class is primarily focused on C++, following the later standards.
As we go, we'll also mention differences between C and C++.
Textbook: Ch 1, pp. 1-12.
Chapter 1 also has a discussion of IDEs, which are not a subject of this class.
You may use what you like. I use Linux, with its native programming tools.
(IDEs are comprehensive solutions, which is generally a poor approach.)
Most students use Code::Blocks,
which is free and multi-platform. I also believe it is also possible to
configure jgrasp to compile C++, but I have not attempted it.