Introduction to programming - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Introduction to programming

Description:

Pascal is one language among others such as:- C, ... Blaise Pascal, 1623-1662 ... Pascal language was named after the 17th century mathematician, Blaise Pascal ... – PowerPoint PPT presentation

Number of Views:68
Avg rating:3.0/5.0
Slides: 23
Provided by: Carls92
Category:

less

Transcript and Presenter's Notes

Title: Introduction to programming


1
Introduction to programming
  • Carl Smith
  • National CertificateYear 2 Unit 4

2
Unit objectives
  • Apply simple analysis and design techniques to
    the software development process.
  • Develop basic high-level code using an
    appropriate procedural programming language.
  • Use suitable testing methods to ascertain the
    correctness of a working piece of code.
  • Produce appropriate documentation for a given
    program application.

3
Programming languages
  • Pascal is one language among others such as-
  • C, C, VB, JAVA, COBOL, ADA, BASIC, Fortran
  • Each has strengths and weaknesses for various
    tasks, for example COBOL is ideal for data
    processing

4
Why Pascal?
  • Experts consider Pascal is ideal for students
    studying computer science courses because-
  • It forces structure, very elegant
  • Easy to learn
  • Very powerful

5
Blaise Pascal, 1623-1662
  • The Pascal language was named after the 17th
    century mathematician, Blaise Pascal who invented
    a calculating machine called the Pascaline
    which could add and subtract and worked with
    eight rotating gears. Tax clerks of the era
    viewed it as a threat to their jobs and it was
    never adopted!

6
Program development
  • Good program development is performed in 4 main
    steps(which match the unit objectives -
    strangely!)

7
Program development
  • In fact there are 6 steps-
  • Analyse the problem
  • Develop algorithm
  • Write code
  • Run the program
  • Test the results
  • Document the program


Step 2
8
Analysis Phase
  • Analysis is not a trivial task
  • Before you can code you need to know exactly
    what you are to do
  • You need a clear and precise statement of what is
    to be done
  • You need to understand what data is available and
    what is to be assumed
  • You need to know what output is desired and the
    form it should take

9
Development (Develop/Write/Run) Phase
  • Develop an Algorithm, which is- A finite
    sequence of effective statements that when
    applied to a problem, will solve it
  • Write code for the program when the algorithm
    solves the problem
  • (Compile) and Run the program-
  • At this point you may discover typing or logic
    errors!...

10
Testing phase
  • Test that the results are correct and in the form
    you like
  • Prove that your program produces the correct
    solution in all cases-
  • e.g. with arithmetic operations this may mean
    checking with a calculator or even pencil and
    paper!
  • After this phase you may need to go back to the
    development or even analysis phases so the whole
    process becomes a cycle

11
Documentation phase
  • It is very important to fully document a working
    program
  • He writer knows how the program works
    (hopefully!) but if others are to modify it they
    must know the logic used
  • Documentation can also be included in the
    development phase as remarks within the pseudo
    and actual code

12
Developing Algorithms
  • Algorithms for solving problems can be developed
    by-
  • Stating the problem
  • Dividing the problem into major sub-tasks
  • Dividing each sub-task into smaller tasks
  • Repeating the process until each task is easily
    solved
  • This is known as Top Down design

13
Software Life-Cycle
  • Analysis
  • Design
  • Coding
  • Testing/Verification
  • Maintenance
  • Obsolescence

14
What is programming?
  • Giving the computer a logical set of instructions
    to perform a specific task
  • That is, taking the design algorithm and
    converting it to code that the computer
    understands

15
Compiled v Interpreted
  • Languages either run Interpreted that is each
    line of code is interpreted into pseudo machine
    code (binary) at run time
  • Or Compiled, which is the whole program is
    compiled, prior to running it, into pseudo
    machine code
  • Interpreted languages tend to be slower in
    execution but are easier to develop and debug
    because the interpreter is available to pin point
    errors at run time
  • Pascal is a compiled language but the compiler is
    part of the Turbo Pascal development
    environment

16
Turbo Pascal 7
  • MSDOS based environment
  • Therefore 8.3 filenames
  • Support for the mouse but mainly used via the
    keyboard
  • Runs in a window or full screen under Windows
    95/98 or 2000

17
Turbo Pascal v7 Main
18
Turbo Pascal v7 - Editor
19
Output name program
20
Program Components
  • Remarks Self documenting code
  • Program Structure
  • Declarations Variables/Constants Data Types
  • Input, Output Formatting
  • Arrays
  • Decisions IF
  • Iteration - Looping
  • Arithmetic and regular expressions
  • Commands, Procedures and Functions In Built
    and User Defined


Nesting
21
Pascal - Program Structure
  • Program ltnamegt
  • Uses Crt - output to screen
  • Const
  • ltlist of constantsgt
  • Var
  • ltlist of variablesgt
  • ltlist of subprogramsgt
  • BEGIN
  • END.


Program Name
Declarationsection

Executablesection
22
Summary
  • We covered-
  • National Certificate Unit 4 objectives
  • The software development cycle
  • The software life cycle
  • Intro to Turbo Pascal 7
  • Program Elements and structure
  • Any Questions?
Write a Comment
User Comments (0)
About PowerShow.com