Fundamentals of Programming - PowerPoint PPT Presentation

1 / 36
About This Presentation
Title:

Fundamentals of Programming

Description:

Programming is a skill that must be developed. Driving a car cannot be learned by reading ... BASIC stands for Beginner's All-purpose Symbolic Instruction Code. ... – PowerPoint PPT presentation

Number of Views:3431
Avg rating:3.0/5.0
Slides: 37
Provided by: dccl9
Category:

less

Transcript and Presenter's Notes

Title: Fundamentals of Programming


1
Fundamentals of Programming
  • Week 1

2
Our teaching assistant is
  • Feng Zou, Fanny
  • Please feel free to contact her or myself by
    e-mail with any questions.
  • Her e-mail address is
  • phenix_at_cs.cityu.edu.hk

3
The Skill of programming
  • Programming is a skill that must be developed
  • Driving a car cannot be learned by reading a book
    only, you must practice
  • Programming is also a skill and cannot be learned
    by reading a book only, YOU MUST PRACTICE
  • Attend class sessions and do assignments

4
Objectives of Todays Lecture
  • Brief introduction to the Course
  • Brief introduction to Computers
  • Fields, Records, Files and folders
  • Visual Basic

5
CS2372 Fundamentals of Computer programming
  • On-line textbook
  • Microsoft Visual Basic 6, VB6
  • Course Aims Objectives This course aims to
    introduce the concepts and techniques of problem
    solving using a commonly used programming
    language, such as Visual Basic, with emphasis on
    record-keeping systems and user interfaces.

6
Course objectives
  • Upon completion, students should be able to
  • analyze simple problems and formulate solutions
  • develop computer programs for quality problem
    solving
  • practice good programming discipline and style.

7
Keywords from Syllabus
  • Software development process environment
  • analysis,
  • conceptualization,
  • design,
  • Programming,
  • debugging,
  • testing,
  • editor,
  • compiler,
  • interpreter.
  • Problem solving techniques
  • simplification and organization,
  • abstraction, hierarchy,
  • top-down problem decomposition.
  • Programming techniques
  • basic data types, control structures, iteration,
    recursion, division of programs.
  • Elements of good programming style
  • programming for change,
  • extensibility,

8
Assessment Pattern
  • Percentage distribution of marks for coursework,
    examination, other
  • 30 Coursework Work, Course work will consist of
  • assignments 15 and a
  • individual project 15
  • 70 Exam (Examination duration 2 hours)
  • Grading pattern Standard (AAA-...F) For a
    student to pass the course, at least 30 of the
    maximum mark for the examination must be
    obtained.

9
Major Components of a Computer System
  • Hardware
  • The physical devices
  • Software
  • Computer programs in the form of instructions for
    the Hardware

10
Hardware
  • Input
  • Keyboard, Mouse, Etc.
  • Systems Unit
  • Memory (RAM), Central Processing Unit (CPU)
  • Output
  • Monitor, Printer, Etc.
  • Secondary Storage
  • Disk Drives

11
Random Access Memory (RAM)
  • Holds both programs and data
  • Stores both intermediate and final results of
    Processing.
  • Is Volatile, that is, losses all content once
    power is off!

12
Programming Languages
  • Machine Language (0s and 1s)
  • Assemblers (one level above machine language)
  • High level languages (problem oriented)

13
Machine Language
  • The language used by the computer to execute the
    program
  • All assembler and High Level languages must be
    converted into machine language prior to being
    executed.
  • Assembled
  • Compiled
  • or interpreted

14
High Level Languages
  • Computer programming languages that are easier to
    learn
  • Could use English like statements, graphic,
    fomulas, Etc.
  • Some examples are Java, C, and Visual basic

15
Software
  • Instructions direct the hardware
  • A grouping of instructions to solve a problem is
    called a program

16
Programming
  • Using Visual Basic

17
What is Programming?
  • A program is a set of instructions to tell the
    computer what to do.
  • A programmer or Software Engineer writes programs
    or software

18
Programming Languages
  • We cannot program a computer using Natural
    languages such as Chinese or English too
    ambiguous
  • Programming languages are very structured to
    eliminate ambiguity
  • A Computer Programming Language provides an
    unambiguous and precise way of specifying a set
    of instructions to a computer

19
Programming languages
  • The set of instructions created by the software
    engineer is passed through a program that will
    convert the High Level Programming Language into
    machine instructions!
  • Types of Translations
  • Assemble (assembler Language)
  • Compile (High Level Language)
  • Interpret

20
Some Elements of a High Level Language
  • Variables
  • Operators
  • Boolean Type operations
  • Relational operations
  • Objects

21
Variables
  • A variable is a place to store values being used
    in the program
  • As the name implies, the value stored can change
    during the execution of the program

22
Setting variables
  • Setting a variable means that we put a value in
    the variable
  • Gender female
  • Interest .12
  • Balance 200
  • Balance Balance Interest (note that the
    variable changes after this statement
    (instruction))

23
Fields, Records, Files and Folders
  • Folders are like folders in a file cabinet a
    folder will hold files.
  • Files can be of many types, the could be a
    program, text, picture etc.
  • Records are structured groups of items relating
    to an application payroll record
  • Fields are the individual items of data Name,
    student number, program, etc.

24
Folder Terms
  • Root Folder
  • Path
  • File Specification

25
V Basic Background
  • BASIC stands for Beginners All-purpose Symbolic
    Instruction Code.
  • BASIC was developed by John Kemeny and Thomas
    Kurtz in mid-1960s at Dartmouth.
  • Visual Basic was released in 1991 by the
    Microsoft Corporation

26
V Basic Terminology
  • Form
  • Control
  • Object
  • Properties
  • Event

27
Designing a V Basic Program
  • Design the appearance of the window that the user
    sees.
  • Determine the events that the controls on the
    window should recognize.
  • Write the event procedures for those events

28
V Basic
  • A language used to create windows applications.
  • Programs are developed with a Graphical User
    Interface or GUI.
  • The instructions executed in the program are
    controlled by events

29
Problem Solving
  • Two aspects
  • Program Development Cycle
  • Programming tools

30
major steps in the Program development Cycle
  • Analyze Define the problem
  • Design Plan the solution to the problem
  • Develop the Interfaces to the program
  • Code Translate to programming language
  • Debug and Test Make sure program is error free
  • Documentation Organize all the requred materials
    to describe the program.

31
Some Programming Tools
  • Flowcharting
  • Pseudo code
  • Hierarchy Charts

32
Flowcharting
  • A visual representation of the program using
    predefined symbols
  • One of the first tools used to examine the logic
    of a program graphically

33
Flowcharting
  • Programmer draws flowchart before coding.
  • The 5 flowchart symbols are
  • Flow line
  • Terminal
  • Input/Output
  • Processing
  • Decision
  • Off page connector

34
Why Flowcharting?
  • An aid in developing the logic of a program.
  • Verification that all possible conditions have
    been considered in a program.
  • Provides means of communication with others about
    the program.
  • A guide in coding the program.
  • Documentation for the program.

35
Flowcharting Tutorial
  • The hyperlink below describes flowcharts
  • Go to it and study the concepts.
  • Flowchart a program that will take a temperature
    in Either Fahrenheit (F) or Centigrade (C) grade
    and convert it to the other The formulas are
    below.
  • C ( F - 32) / 1.8
  • F  C 1.8 32
  • The user will input either an F to indicate
    that the input temperature is Fahrenheit or a C
    to indicate that the input temperature is
    Centigrade.
  • If the temperature is F covert it to C if C
    Convert to F.
  • Output the results with a message that states
  • ___ degrees C is equal to ___ degrees F
  • FLOW CHARTS

36
Programming Tutorial
  • Go to the site
  • Small basic compiler
  • Download the free basic compiler from one of the
    sites.
  • Write, compile and debug your program that you
    flowcharted in the flowchart tutorial.
  • execute the program.
  • Email the listing of your program to
  • phenix_at_cs.cityu.edu.hk
Write a Comment
User Comments (0)
About PowerShow.com