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

VIEWS: 353 PAGES: 49

									History of Programming
      Languages

         and

Programming Language
      Concepts
                         1
What does a computer
   program do?



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




                                             3
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.


                                                     4
What is programming?




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




                                             6
• 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…



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




                                         8
   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
     once”

                                      9
   Major difference between humans &
                  computers..
• 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…


                                                10
                    !!!

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

                          11
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.

                                               12
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)


                                             13
       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.
                                                                           14
  So let’s look back at how that
translation process evolved over
            the years…




                               15
      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
  system.

• 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
  consuming.
• 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

                                                      17
 Example of Assembler language
297D:0100    MOV AX,0006       ; Puts value 0006 at register
AX
297D:0103    MOV BX,0004        ;Puts value 0004 at register
BX
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
   times

                                                                       19
             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)
                                                  21
   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)


                                          22
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
   architectures…

                                                23
                              3GLs
• 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
190
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
240
250 REM Processing
260 PRINT “ROOM”, “PATIENT”, “DOCTOR”
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.




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

                                           27
                 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.
                                    28
C++          RealBasic         Java          SQL

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

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

                    Hardware
                                                   29
                Quick Recap:
• High level (3GL, 4GL)
  – closer to human languages and further from machine
    languages
  – 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


                                                         30
Programming Concepts




                       31
     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:




                                              32
   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
           2:Branches
                 Step 1


                    Test
                  condition




      Path 1                  Path 2



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

                     Repeated Steps




                           Test
                         Condition



-- when program steps are repeated continuously until some
test condition is reached – then control continues beyond the
                                                            35
loop
                     4:Modules
                                        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.
                                                        36
Components that programs need..
• Data to work with..
• Operations (add, subtract, compare…)
• Input/Output
  capability
  – The ability to get
    data in
  – The ability to get
    the results out
                                         37
      Two perspectives of a program
• The one perceived by the
  user
   – 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…)


                                      38
     Two perspectives of a program
• The one perceived by the
  programmer
   – The programmer has the
     “source file” that contains the
     instructions for the program.
   – The instructions are written
     in some programming
     language
   – At some point, the
     instructions get translated to
     an executable file
   – The programmer needs to
     know exactly how it works..
                                       39
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
  code)




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

• It is then translated
  into object code

                                41
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..
                                                                          42
               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.




                                               43
                    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
    environments.

                                                       44
              Programming in the GUI
                   Environment
•   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
        menus
    –   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
                environments…
•   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


                                                                 46
                 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
    programmers



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

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




                                                        49

								
To top