0% found this document useful (0 votes)
78 views40 pages

Unit 1 - Programming: Lecture 1 - Introduction

This document provides an introduction to a programming course, including topics like problem solving, algorithms, the program development process, and course materials. The introduction covers defining problems, designing algorithms and flowcharts, coding programs, testing and debugging code, and documenting programs. It also includes examples and activities to illustrate key concepts.

Uploaded by

Bob Long
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views40 pages

Unit 1 - Programming: Lecture 1 - Introduction

This document provides an introduction to a programming course, including topics like problem solving, algorithms, the program development process, and course materials. The introduction covers defining problems, designing algorithms and flowcharts, coding programs, testing and debugging code, and documenting programs. It also includes examples and activities to illustrate key concepts.

Uploaded by

Bob Long
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 40

UNIT 1 -

PROGRAMMING
LECTURE 1 - INTRODUCTION
TOPICS

 Course introduction
 Problem solving and algorithm
 Program development steps
 Practice

Unit 1 - Programming / Lecture 1 - Introduction 2


COURSE INTRODUCTION

 This unit introduces students to the core concepts of programming


with an introduction to algorithms and the characteristics of
programming paradigms
 On successful completion of this unit students will be able to design
and implement a simple computer program in a chosen language (C#)
within a suitable IDE (Visual Studio .NET)

Unit 1 - Programming / Lecture 1 - Introduction 3


LEARNING OUTCOMES

 LO1: Define basic algorithms to carry out an operation and outline the
process of programming an application.
 LO2: Explain the characteristics of procedural, object-orientated and
event-driven programming, conduct an analysis of a suitable Integrated
Development Environment (IDE)
 LO3: Implement basic algorithms in code using an IDE.
 LO4: Determine the debugging process and explain the importance of a
coding standard
Unit 1 - Programming / Lecture 1 - Introduction 4
COURSE MATERIALS

 Login to CMS (http://cms.greenwich.edu.vn/) with student account (


[email protected])
 Choose correct class
 Enroll by class name (GCH0x0x)
 CMS Folder:
o Slides o Assignment 1
o Demo o Assignment 2

Unit 1 - Programming / Lecture 1 - Introduction 5


COURSE PREPARATION

 Drawing tools (choose one):


o Visio
o Draw.io or Lucichart (online)
o Astah (recommendation, using student email to register full version)
 IDE
o Visual Studio Community 2017

Unit 1 - Programming / Lecture 1 - Introduction 6


COURSE READING

 Slides on CMS
 C# 6.0 and .NET Framework 4.6
o http://library.books24x7.com/toc.aspx?bookid=104367
o Registered with student email
 Mohammad Rahman, Expert C#5.0 with .NET 4.5 Framework

Unit 1 - Programming / Lecture 1 - Introduction 7


PROBLEM SOLVING

It’s a creative process, it is an act of


o Defining a problem
o Determining the cause of the problem
o Identifying, prioritizing, and selecting alternative for a solution
o Implementing a solution

Unit 1 - Programming / Lecture 1 - Introduction 8


ALGORITHM
 An algorithm is a step-by-
step description of the
solution to a problem
 An algorithm must be
o Definite
o Finite
o Precise and Effective
o Implementation
independent
Unit 1 - Programming / Lecture 1 - Introduction http://www. incredibleegg.org 9
STEPS IN PROGRAM DEVELOPMENT

The various steps involved are


o Defining or Analyzing the problem
o Design (Algorithm)
o Coding
o Documenting the program
o Compiling and running the program
o Testing and Debugging
o Maintenance
Unit 1 - Programming / Lecture 1 - Introduction 10
ANALYZING OR DEFINING THE PROBLEM

The problem is defined by doing a preliminary investigation


Defining a problem helps us to understand problem clearly
It is also known as Program Analysis

Unit 1 - Programming / Lecture 1 - Introduction 11


TASKS IN DEFINING A PROBLEM

 Followings are the tasks in order to


define a problem
o Specifying the input requirements
o Specifying the output requirements
o Specifying the processing requirements

Unit 1 - Programming / Lecture 1 - Introduction 12


SPECIFYING THE INPUT REQUIREMENTS

The input specification is obtained by answering following questions


o What specific values will be provided as input to the program?
o What format will the values be?
o For each input item, what is the valid range of values that it may assume?
o What restrictions are placed on the use of these values?

Unit 1 - Programming / Lecture 1 - Introduction 13


SPECIFYING THE OUTPUT REQUIREMENTS

The output specification is obtained by answering the following


questions
o What values will be produced?
o What is the format of these values?
o What specific annotation, headings, or titles are required in the report?
o What is the amount of output that will be produced?

Unit 1 - Programming / Lecture 1 - Introduction 14


SPECIFYING THE PROCESSING REQUIREMENTS

The processing requirement is obtained by answering following


questions
o What is the method (technique) required in producing the desired output?
o What are the validation checks that need to be applied to the input data?
o What calculations are needed?

Unit 1 - Programming / Lecture 1 - Introduction 15


ACTIVITY: FIND FACTORIAL NUMBER

Input?
Output?
Process?

Unit 1 - Programming / Lecture 1 - Introduction 16


ACTIVITY FIND FACTORIAL NUMBER

Input: Positive integer number


Output: Factorial of that number
Process: Solution technique which transforms input to output. Factorial
of a number can be calculated by the formula n!=1*2*3*…*n

Unit 1 - Programming / Lecture 1 - Introduction 17


USE-CASE DIAGRAM

Use case diagrams are used to gather the requirements of a system


So when a system is analyzed to gather its functionalities use cases are
prepared and actors are identified.
The purposes of use case diagrams can be as follows:
o Used to gather requirements of a system
o Used to get an outside view of a system
o Identify external and internal factors influencing the system
o Show the interacting among the requirements are actors
Unit 1 - Programming / Lecture 1 - Introduction 18
MAIN ELEMENTS OF USE-CASE DIAGRAM

Unit 1 - Programming / Lecture 1 - Introduction 19


ACTIVITY: DRAW USE-CASE DIAGRAM

You are hired to develop FAI’s library system with following description
Admin who could
- Manage books, readers (staff, lecturers, and students), etc.
- Manage borrow/return books
Users (staff, lecturers, students) who could
- View/search books
- Reserve books
- Borrow/return books
Please draw Use-case diagram for this scenario
Unit 1 - Programming / Lecture 1 - Introduction 20
STEPS IN PROGRAM DEVELOPMENT

The various steps involved are


o Defining or Analyzing the problem
o Design (Algorithm)
o Coding
o Documenting the program
o Compiling and running the program
o Testing and Debugging
o Maintenance
Unit 1 - Programming / Lecture 1 - Introduction 21
DESIGN

A design is the path from the problem to a solution in code


The well designed program is likely to be:
o Easier to read and understand later
o Less of bugs and errors
o Easier to extend to add new features
o Easier to program in the first place

Unit 1 - Programming / Lecture 1 - Introduction 22


MODULAR DESIGN

Once the problem is defined clearly, several design methodologies can


be applied
An important approach is Top-Down program design
It is structured design technique
o It breaks up the problem into a set of sub-problems called Modules
o It creates a hierarchical structure of the modules

Unit 1 - Programming / Lecture 1 - Introduction 23


FLOWCHART

Flowchart is a diagrammatic representation of an algorithm


It uses different symbols to represent the sequence of operations,
required to solve a problem
It serves as a blueprint or a logical diagram of the solution to a problem

Unit 1 - Programming / Lecture 1 - Introduction 24


FLOWCHART SYMBOLS (1/2)

Unit 1 - Programming / Lecture 1 - Introduction 25


FLOWCHART SYMBOLS (2/2)

Unit 1 - Programming / Lecture 1 - Introduction 26


ACTIVITY: DRAWING FLOWCHART

 Draw a flowchart for the algorithm to


find factorial number in previous
activity

Unit 1 - Programming / Lecture 1 - Introduction 27


CODING

An algorithm expressed in programming languages is called Program


Writing a program is called Coding
The logic that has been developed in the algorithm is used to write
program

Unit 1 - Programming / Lecture 1 - Introduction 28


DOCUMENTING THE PROGRAM

Document explains
o How the program works and how to use the program (user manual)
o How to maintain the program (developer manual)
Details of particular programs, or particular pieces of programs, are
easily forgotten or confused without suitable documentation

Unit 1 - Programming / Lecture 1 - Introduction 29


FORMS OF DOCUMENTATION

Documentation comes in two forms


o External documentation, which includes things such as reference manuals,
algorithm descriptions, flowcharts, and project workbooks
o Internal documentation, which is part of the source code itself (essentially, the
declarations, statements, and comments)

Unit 1 - Programming / Lecture 1 - Introduction 30


COMPILING AND EXECUTING THE PROGRAM

Compilation is a process of translating a source program into machine


understandable form
The compiler is system software
o It examines each instruction for its correctness
o It does the translation
During the execution
o Program is loaded into the computer’s memory
o The program instructions are executed
Unit 1 - Programming / Lecture 1 - Introduction 31
TESTING

Testing is the process of executing a program with the deliberate intent of


finding errors
Testing is needed to check whether the expected output matches the actual
output
Testing is done during every phase of program development
Initially, requirements can be tested for its correctness
Then, the design (algorithm, flow charts) can be tested for its exactness and
efficiency
o Structured walk through is made to verify the design
Unit 1 - Programming / Lecture 1 - Introduction 32
TEST CRITERIA

Programs are tested with several test criteria and the important ones
are given below
o Test whether each and every statement in the program is executed at least one
(Basic path testing)
o Test whether every branch in the program is traversed at least once (control
flow)
o Test whether the input data flows through the program and is converted to an
output (data flow)

Unit 1 - Programming / Lecture 1 - Introduction 33


DEBUGGING

Debugging is a process of correcting the errors


o Programs may have logical errors which cannot be caught during compilation
o Debugging is the process of identifying their root causes
o One of the ways is to print out the intermediate results at strategic points of
computation
o Another way is to use support from the IDE
Testing vs Debugging
o Testing means detecting errors
o Debugging means diagnosing and correcting the root causes
Unit 1 - Programming / Lecture 1 - Introduction 34
MAINTENANCE

Program maintenance
o Continuing process of maintenance and modification
o To keep pace with changing requirements and technologies
Maintainability of the program is achieved by
o Modularizing it
o Providing proper documentation for it
o Following standards and conventions (naming conventions, using symbolic
constants, etc.)
Unit 1 - Programming / Lecture 1 - Introduction 35
WHAT IS A PROGRAMMING LANGUAGE?

It is an art of making a computer to do the required operations


o By means of issuing sequence of commands to it
It can be defined as
o A vocabulary (unique set of characters/keywords)
o A set of grammatical rules (syntax)
The term programming languages usually refers to high-level languages
o E.g., BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal

Unit 1 - Programming / Lecture 1 - Introduction 36


TYPES OF PROGRAMMING LANGUAGES

There are two major types of programming languages


o Low level languages (LLL)
o High level languages (HLL)

Unit 1 - Programming / Lecture 1 - Introduction 37


WHAT MAKES A GOOD LANGUAGE?

Every language has its strengths and weaknesses


FORTRAN is good for numeric data but not good to organize large program
PASCAL is good for structured and readable programs, but it is not as
flexible as C
C++ has powerful object-oriented features, but it is complex and difficult to
learn
The choice of PL depends on type of the computer used, type of program,
and the expertise of the programmer
Unit 1 - Programming / Lecture 1 - Introduction 38
DEVELOPMENT ENVIRONMENTS

Programming on Host Environment:


o The environment under which a program is designed, coded, tested &
debugged
Operating on Target Environment
o The external environment which supports the execution of a program Target

Hello.c Hello.exe
Hello.exe
Unit 1 - Programming / Lecture 1 - Introduction 39
SUMMARY

 Draw a mind-map to summary the content of this lecture

Unit 1 - Programming / Lecture 1 - Introduction 40

You might also like