History of Computers

Computers have evolved from their introduction in the 1950s with very few computers, through the 1960s with very large, expensive computers, to the 1970s with cheaper, smaller computers. In the mid-1970's the first microcomputers, also called personal computers, appeared in the marketplace. In a very short amount of time these devices have become a permanent part of how we do business today. Regardless of the type, computers share some basic elements. History of Computers, Convenient Lookup Tables

There are many different types of programming languages. We will review the following general types of programming languages: 1. machine languages, 2. assembly languages, 3. procedure-oriented languages, and 4. object-oriented languages. History of Programming Languages, History of Programming Languages - poster

Machine language is a language that uses bits/bytes to form instructions to communicate with a computer. Each computer has its own instruction set (set of instructions it understands). Machine language uses binary numbering, which is a number system using 1's and 0's to represent data (base two). Each digit in binary is commonly called a bit (short for binary digit); and eight bits form a byte. Each character entered into the computer will be represented by a unique code consisting of 1's and 0's. ASCII (American Standard Code for Information Interchange) is a popular data representation code using bits to represent numbers, letters, and symbols. Because of all the 1's and 0's, programming in machine language is very tedious and prone to committing errors. The Second Book Of Machine Language

Assembly language is a language using mnemonics in place of 1's and 0's. Mnemonics are symbols used to represent the actual machine language instructions. Since the only instructions that the computer understands are machine language instructions, an assembler is required to convert the assembly language code to machine code before being executed by the computer. Note that each assembly language instruction is translated into one machine language instruction. It is easy to see that programming in assembly language is preferred to programming in machine language; however programming in assembly language can also be very tedious.

Procedure-oriented languages allow the programmer to use instructions that more closely resemble the English language. Still the only instructions that the computer can understand are machine language instructions, therefore a compiler is required to convert the high-level code to machine code before being executed by the computer. Unlike assembly language, each high-level language instruction may produce many machine code instructions. The emphasis of high-level procedure-oriented languages is on accomplishing a task. The programmer determines and controls the order in which the computer will process the instructions. The order of execution of these instructions is extremely important and should be well designed. A design methodology called top-down design is typically used with procedure-oriented programs. Top-down design begins with a general statement describing the purpose of the program. This purpose is then broken down into smaller, more manageable tasks, and eventually into the actual high-level procedure-oriented language instructions. Some popular procedure-oriented languages include COBOL, BASIC, Pascal, and C. High-level procedure-oriented languages are a vast improvement over machine and assembly languages.

Object-oriented languages view a problem solution as a set of interacting objects, where high-level procedure-oriented languages view the problem solution as a set of ordered steps. Like procedure-oriented languages, object-oriented languages require a compiler to convert the high-level instructions into machine code, and each high-level object-oriented language instruction may produce many machine language code instructions. Unlike procedure-oriented languages, with object-oriented languages a design methodology called OOD (Object-Oriented Design) is used. OOD, like top-down design, begins with a statement describing the purpose of the program, however unlike top-down design the programmer then divides the program into one or more objects. Objects in an object-oriented program may take on many forms, examples being menus, options buttons, and command buttons. Objects may also take on real-life meanings, such as an employee, date, and a time card. Some popular object-oriented languages include Visual Basic.NET, C++, and Java. One main advantage of object-oriented languages over procedure-oriented languages include allowing a programmer to use familiar objects to solve a problem. Then because these objects are viewed as independent units, they may be used in more than one application with little or no modification. Object-Oriented Programming Using C++, Object-Oriented Software, Object-Oriented language basics

Computer System Components

There are two basic computer system categories: 1) hardware and 2) software. Anything that you can touch or see is the hardware, such as the monitor, the computer case, all of the components inside the case, etc. The software is the instructions that run the computer applications.

1. Hardware components include:



Central Processing Unit (CPU)--"computer brain": Main Memory (RAM - volatile data): Secondary storage ("permanent" data): Input/Output (I/O) Devices:
Input: Output: 2. Software components include (programs that do specific tasks):
Two Types:
  1. System programs control the computer (i.e., operating system and services)

  2. Examples of operating system services:
  3. Application programs perform a specific task (run by operating system)

  4. Examples of Application programs:

Language of a Computer

Machine language: language of a computer

All characters must be encoded into a specific code. For standardization, personal computers (PCs) use seven-bit American Standard Code for Information Interchange (ASCII). Each code actually takes 8 bits, but left-most bit is a 0. Using this scheme, character 'A' is represented as 1000001 or 01000001. The decimal equivalent of 1000001 is 65.

Coding Schemas:
ASCII (American Standard Code for Information Interchange):

Computer Programming Language Evolution

Programming Languages:

C++ Program Example:

/*
This program demos a (very) small C++ program.
Name:
Date:
Course:
Algorithm (pseudocode): (used in some homework assignments)
Also, be sure to document (comment) your code, see below.

compile: cl SampleProgram.cpp (VS.NET), or bcc32 SampleProgram.cpp (Borland)
run: SampleProgram
*/

#include<iostream>
using std::cout; //for cout
using std::cin; //for cin
using std::endl; //for endl

//initialize constants

//initialize global variables

//prototype functions

int main()
{
  //initialize local variables

  cout << "My first C++ program." << endl;
  cout << "The sum of 2 and 3 = "<< 5 << endl;
  cout << "7 + 8 = " << 7 + 8 << endl;

  cout << "\nPress Enter key to exit...";
  cin.get();  // make DOS window stay open

  return 0;
}

Sample Run:
My first C++ program.
The sum of 2 and 3 = 5
7 + 8 = 15
Sample Program

Compiling and Running a C++ Program

Compiling Source Files and Running Programs:

Borland:

  1. Choose > Start > Run > Type cmd > OK
  2. Navigate to location of source file
    Example: cd c:\testcpp\deitel\ch1
  3. compile command:
    Example: bcc32 SampleProgram.cpp
  4. run command:
    Example: SampleProgram
VS.NET:
  1. Choose > Start > Programs > Microsoft Visual Studio .NET 2??? > Visual Studio .NET Tools > Visual Studio .NET 2??? Command Prompt
  2. Navigate to location of source file
    Example: cd c:\testcpp\deitel\ch1
  3. compile command:
    Example: cl SampleProgram.cpp
  4. run command:
    Example: SampleProgram
VS.NET command-line compiler

***When compiling, don't forget bcc32 (Borland) or cl (VS.NET), and .cpp file extension!
"cl" in VS.NET is lower-case "CL"
***When running, no need to add file exension.


Borland (notice title bar):
Compiling and
Running a C++ Program

VS.NET (notice title bar):
Compiling and
Running a C++ Program


Processing a Program

Code and execute program written in a high-level language (e.g., C++):

  1. Use text editor to create source program
  2. In C++, statements that begin with # symbol called preprocessor directives.
    Processed by program called preprocessor.
  3. Compiler:
    1. Checks program obeys rules (i.e., syntax, BUT not logic), AND...
    2. Translates program into machine language (object program)
  4. Linker: Combines object program with other programs (libraries) provided by SDK to create executable code (Software Development Kit (SDK) may be used to create a program)
  5. Loader: Loads executable program into main memory
  6. Last step: execute program
Processing a C++ Program


Programming Cycle

Problem Solving:

Software Lifecycle:
  1. Analyze problem
  2. Design solution (algorithm - independent of language)
  3. Implement algorithm (code)
  4. Test code
  5. Maintenance (modify program when requirements change)

Structured Programming

Structured Design/Programming:


Object-Oriented Programming

Object-Oriented Design (OOD)/Programming:


ANSI/ISO STANDARD C++

(Brief) History of C++: