History of Programming Languages and Programming Language History of Programming Languages and Programming Language by wgl10043

VIEWS: 353 PAGES: 49

									History of Programming


Programming Language
What does a computer
   program do?

A computer program is:
a set of instructions that tell a computer
    how to perform a particular task.

A computer program is like…
              …a recipe

– A recipe is a set of instructions to tell a cook
  how to make a particular dish.
– It describes the ingredients (the data) and the
  sequence of steps (the process) needed to
  convert the ingredients into the cake.

What is programming?

       Programming is …
-- the effort in coming up with a set of
  instructions that describe how a problem
  can be solved.

• We always think a “program” is a computer
  language, but actually, programs can be in
  many “languages” and in many forms….

       Let’s look at an example…

               A simple program…
•   An English language example:
    – On the back of a shampoo bottle:
      1.   Wet Hair
      2.   Lather
      3.   Rinse
      4.   Repeat

   Interpretations & Assumptions..
• Notice those 4 instructions
  (wet hair, lather, rinse, repeat)
  makes several assumptions:
   – “Lather” also implies pouring
     some shampoo from the bottle
     onto either your hand or head

   – Step 4 really means “repeat

   Major difference between humans &
• Humans have judgment & free will.
  – They will not follow any instruction they
    determine not required or nonsensical

• Computers will do EXACTLY what is told
  with no judgment or sanity checks…


Give those
instructions to
your computer
and it will never
get out of the

So how does a program tell the computer
     exactly what needs to be done?
• Just as you speak to a friend in a language that
  he/she understands, you need to 'speak' to the
  computer in a given language it understands.
• The only language that the computer understands
  is called binary or machine language.
• Programs interact with the computer using
  machine language.
• Machine language is just made up of 0’s and 1’s.

How much can you communicate
    using only 0’s and 1’s?
• More than you think!!!
          …but it’s not easy…

…so right from the start, it’s been desired to
 have some type of translation process to get
 English translated into binary (and back)

       Think of that “translation process” as being like an interpreter…

Chinese President Hu Jintao                               Barack Obama

Consider the American and Chinese presidents talking at a summit
meeting –
   •One speaks in English, then an interpreter repeats what has been
   said in Chinese
   •The other replies in Chinese and the interpreter again repeats the
   sentence, this time in English.
  So let’s look back at how that
translation process evolved over
            the years…

      In the beginning there was no
          translation process…
• Early programmers (early 1950’s)
  actually had to enter the binary codes
  themselves, (the 1’s and the 0’s!!!)
• Instructions were entered through the
  front panel switches of the computer

• Coding in binary is regarded as
  working in a:
  – First Generation Programming Language (1GL)   16
     Initial Translation Efforts..
• Entering the 0’s and 1’s was very time
• So, effort was spent creating a language that
  would reduce this effort

• The assembler language was thus created:
  – It translates English equivalents (really, a symbolic
    representation) to machine language

 Example of Assembler language
297D:0100    MOV AX,0006       ; Puts value 0006 at register
297D:0103    MOV BX,0004        ;Puts value 0004 at register
297D:0106    ADD AX,BX          ;Adds BX to AX contents
 The only                       ;Causes to of the Program
297D:0108 thing that this program does isendsave two
              INT 20
   values in two registers and add the value of one to
   the other.

 • In a high level language such as RealBasic, we’d
   just do something like: result = 6 + 4                18
        Another Assembler example
-e 102 'Hello, How are you ?' 0d 0a '$‘ ; the string
- a125
0C1B:0125       MOV DX,0102 ; Copies string to DX register
0C1B:0128       MOV CX,000F ; # times for the string display (0xf =15)
0C1B:012B       MOV AH,09      ; Copies 09 value to AH register
0C1B:012D       INT 21         ; Displays string
0C1B:012F       DEC CX         ; Decrements value of CX by 1
0C1B:0130       JCXZ 0134      ; Jump, if CX equals zero to instruction 0134
0C1B:0132       JMP 012D       ; Jumps to direction 012D
0C1B:0134       INT 20         ; Ends the program
 • This program displays a character string on the screen 15

             Assembler Languages
• Developed in the mid 1950’s
• Considered a “low level” language because:
   – It is specific to a particular computer architecture (will only
     run on a very specific computer model)
      • An example: If we were to write an assembler language program to
        run in H209 – it would NOT work in H210 because we have iMacs in
        here and H210 has Mac Minis!
   – And because you would have to know very low-level details
     about the computer in order to be able to write a program
     using Assembler

• Assembler language is considered a second generation
  programming language (2GL)                         20
          Assembler languages..
• Assembler languages use a translation process
  called “an assembler” to translate assembly
  language statements into machine code.
• There is a1:1 mapping from each mnemonic
  statement into a machine instruction

(contrast that with high level languages – a single
  statement results in many machine instructions)
   Assembler Languages (con’t)
• Some use of 2GLs (Assembler Language)
  still used today:
  – When direct hardware
    manipulation is needed
    or for critical performance

  – Example: device drivers,
    real time systems
    (for high performance)

An improvement, but more desired…
 • So 2GL had its uses – but more translation
   capabilities were desired…

 • It was desired that programming languages
   be more easily understood
 • It was also desired that the same program
   could be run on different types of

• First introduced in the late 1950’s
   – Introduced concept of structured programming (did not have to
     directly work with registers; could also use algebraic expressions)
   – Introduced a level of abstraction away from the hardware. This
     made it more “user friendly” – making it easier to learn & use
   – Used translation processes called “compilers” and “interpreters”
   – Introduced database management systems
• Early examples:
   – Fortran (1956) – used for science & math (lots of precision)
   – COBOL (1959) –used for business purposes
• “Modern” examples:
   – BASIC (1964) – used for regular folks to write easy programs
   – C, C++ -- general purpose
   – JAVA (1995) -- used as applets on web pages               24
150 REM Variable names:
160 REM          N$ -- patient name
170 REM          D$ -- doctor name
180 REM          R -- room number
200 REM Data to be processed
210 DATA “JOE SMITH”, “WARD’, 213       BASIC example – displays
220 DATA “TIM KERNS”, “NANCE” 112        room#, patient name, &
230 DATA “MARY LEO” “GOLD” 102               doctor name
250 REM Processing
270 PRINT “ “
280 READ N$, D$, $
290 IF N$ = “END OF FILE” THEN 330
      PRINT R, N$, D$
      READ N$, D$, R
      Go TO 350
330 PRINT “ “
340 END                                                      25
      4th generation programming
            languages (4GL)
• First appeared in the1970’s
• Languages designed with a specific purpose in
  mind – such as the development of commercial
  business software.

  Some Different types of 4GLs
     in the 1970-1990 era
• Report generators – PostScript
• Data manipulation & analysis – MAPPER,
• Data Query Languages -- SQL
• Screen painters – Oracle
• Web Development – ColdFusion, CSS

                 Is there a 5GL?
There’s no agreed upon answer…
• Some sources claim that the:
  a 5GL language is programming
  that uses a visual or graphical
  development interface
• Other sources claim that:
  “systems used in the field of
  artificial intelligence, fuzzy
  logic, and neural networks” are
  5GL languages.
C++          RealBasic         Java          SQL

      Ruby               PHP          Perl
         High-Level Language (>2GL)

       Assembly Language (2GL)
        Machine Language (1GL)

                Quick Recap:
• High level (3GL, 4GL)
  – closer to human languages and further from machine
  – Easier to understand, write, and maintain.
  – Must be translated into machine language by a compiler
    or interpreter
• Low-level (2GL)
  – very close to machine languages (2GL)
  – Dependent on a certain type of hardware

Programming Concepts

     Structured Programming
• A long time ago a man called Edsger
  Dijkstra came up with a concept called
  structured programming – meaning that all
  programs could be structured in the
  following four ways:

   1:Sequences of Instructions
                     Step 1

                     Step 2

                     Step 3

                     Step 4

-- when the program flows from one step to the
            next in strict sequence.             33
                 Step 1


      Path 1                  Path 2

-- when the result of the test condition
   determines what path is executed        34

                     Repeated Steps


-- when program steps are repeated continuously until some
test condition is reached – then control continues beyond the
                                        Shared Module
       Step 1

       Step 2

       Step 3

       Step 4
-- A mini-program that can be executed from within the main
program and invoked as often as needed
--Also known as sub-routine, procedure, or function.
Components that programs need..
• Data to work with..
• Operations (add, subtract, compare…)
• Input/Output
  – The ability to get
    data in
  – The ability to get
    the results out
      Two perspectives of a program
• The one perceived by the
   – The user has an executable
     file and knows nothing about
     how it works – it just does
   – The user executes the
     program to perform a task
     (eg., a word processor, a
     video game, an image editor
     – any software that can be
     installed & executed…)

     Two perspectives of a program
• The one perceived by the
   – The programmer has the
     “source file” that contains the
     instructions for the program.
   – The instructions are written
     in some programming
   – At some point, the
     instructions get translated to
     an executable file
   – The programmer needs to
     know exactly how it works..
Translating High Level Languages
         to Machine Code
• The programmer generates the source code
• Recall that high level languages use a
  translation program to convert to machine
  code (also known as binary code or machine

 How does the translation process
• Source code must first
  be examined for
  grammatical errors.
  (If errors are found –
  the translation stops)

• It is then translated
  into object code

Two general types of translation processes
• an interpreter follows this iterative process for each line of
  the program:
   – checks for proper syntax
   – translates the high-level instruction into machine code
   – executes

• A compiler follows this process:
   – Checks for proper syntax across the entire program
   – Then, translates the high-level instructions into machine code
     (across the entire program) and puts the result into an executable file

   – (A user can then execute the file whenever desired)

• Fyi: RealBasic is a compiled language..
               CLI Interface
•   The first personal computers operated using
    a CLI (command line interface).

•   Users would type commands directly into
    the computer to input or request output.

                    GUI Interface
•   A Graphical User Interface (GUI) is a user interface
    based on graphics (icons, pictures, menus). Users
    interact with the interface by directly manipulating
    the graphical elements (e.g., using a keyboard,
    mouse, joystick, touch screen, etc)

•   The GUI is common to all modern applications
    written for the Unix/Linux/Apple and Windows

              Programming in the GUI
•   When the GUI environment was in its early days,
    programmers found themselves spending countless
    hours writing instructions for typical GUI events:
    –   To react to buttons being pressed, to work scroll bars, to
        communicate with dialog boxes, and to interact with
    –   This detracted from what programmers were really trying
        to achieve in their programs…
•   Tasks that used to take a few lines of program code
    now needed pages to comply with GUI Standards 45
           This led to object oriented
•   In object-oriented/event-driven languages, the
    emphasis of a program was able to shift to the objects
    included in the user interface.
•   All the handling needed behind the event, called the
    “event handler”, is already taken care of..
    –   e.g., Detection of events such as mouse rollover, mouse
        click, key press, text field change were already handled and
        didn’t need to be coded by the programmer

                 Where we are..
•   C++, C#, Java, REALbasic, and Visual Basic
    are object-oriented/event-driven
    programming languages that are easy enough
    for a nonprogrammer to use, yet sophisticated
    enough to be used by professional

              Next Steps…
• Number system
  – we’ll be
    investigating how
    to convert between
    the number system
    we use & the
    number system
    computers use

                .. And after that…
Then with all of this great knowledge under our belts, we’ll
 jump into RealBasic and start some programming!!!


To top