1 international diploma in computer studies (idcs) 11th august 30th november 2008 p rogramming m...
TRANSCRIPT
1
International Diploma In International Diploma In Computer Studies (IDCS)Computer Studies (IDCS)
11th August 11th August
30th November 200830th November 2008
PProgrammingrogramming
MMethodsethods
(PM)(PM)
2
Programming Programming Methods (CT)Methods (CT)Programming Programming Methods (CT)Methods (CT)
Chapter 3Chapter 3
SECTION ASECTION ADDATA ANALYSIS ATA ANALYSIS AND PROBLEMSAND PROBLEMS
Chapter 3Chapter 3
SECTION ASECTION ADDATA ANALYSIS ATA ANALYSIS AND PROBLEMSAND PROBLEMS
3
The software development The software development processprocess
Create structure diagrams for Create structure diagrams for structured programsstructured programs
Explain the different variables Explain the different variables typestypes
Organize InformationOrganize Information Analyze problemsAnalyze problems
Chapter OBJECTIVES:Chapter OBJECTIVES:
4
The software development processThe software development process Data structures and data structures Data structures and data structures
diagramsdiagrams Organizing informationOrganizing information Fixed and Variable recordsFixed and Variable records
Chapter CONTENTS:Chapter CONTENTS:
5
Chapter 3Chapter 3Data Analysis and Data Analysis and
ProblemsProblems
Chapter 3Chapter 3Data Analysis and Data Analysis and
ProblemsProblems
PART 1PART 1ProgramProgram
Development Development ProcessProcess
PART 1PART 1ProgramProgram
Development Development ProcessProcess
6
There are There are many different types of many different types of programsprograms which vary in complexity which vary in complexity from simple ones written as a hobby, from simple ones written as a hobby, to complex programs written by to complex programs written by profession programmers.profession programmers.
Which are part of a large systemWhich are part of a large system
1.1 Introduction1.1 Introduction
7
ExampleExample : Hospital : Hospital Information SystemInformation System
Hospital information SystemHospital information SystemHospital information SystemHospital information System
Personnel DB
(Nurses, Doctors, etc)
Patients DB
(Emergency, OPD, etc)
Transaction DB
(Doctors + Patient,
Payments)
Inventory DB
(Drugs, Medical
Equipments)
8
Some examples of Programs:Some examples of Programs: A suite in a A suite in a production control systemproduction control system A simple A simple database programdatabase program A program to perform A program to perform statistical statistical
analysisanalysis on experimental results on experimental results A program to display the contents of A program to display the contents of
database by a web processdatabase by a web process orders orders and payments. and payments. e-commerce applicationse-commerce applications On line bankingOn line banking
An An interactive multimediainteractive multimedia program program game (user interaction)game (user interaction) Encyclopedia (e-encyclopedia/ informative)Encyclopedia (e-encyclopedia/ informative)
1.2 Introduction (cont.)1.2 Introduction (cont.)
9
Before writing any program we Before writing any program we need need
to know that:to know that: The The output requiredoutput required by the user from by the user from
the system the system The The processes necessaryprocesses necessary to produce to produce
this output for the userthis output for the user
The The data or inputdata or input to be processed to to be processed to create the output required create the output required
1.3 Introduction (cont.)1.3 Introduction (cont.)
10
ProgrammerProgrammer Responsible for Responsible for writing computer writing computer
programsprograms
1.4 Key Terms Definition1.4 Key Terms Definition
System AnalystSystem Analyst Responsible for the Responsible for the
development of an development of an information systeminformation system
DesignsDesigns and and modifiesmodifies systems by turning user systems by turning user requirements into a set requirements into a set of of functional functional specificationsspecifications, which are , which are the blueprint of the the blueprint of the systemsystem
11
1.5 Practical Analogy1.5 Practical Analogy An An Architect (system analyst)Architect (system analyst) and and
an an Engineer (programmer)Engineer (programmer)
12
System System AnalysisAnalysis
The The analysis of analysis of the role of a the role of a proposed proposed systemsystem and the and the identification of identification of a set of a set of requirementsrequirements that the that the system should system should meet - the meet - the starting point starting point for systems for systems design.design.
1.6 Key Terms Definition 1.6 Key Terms Definition (cont.)(cont.)
Final Design Final Design Expected Expected
OutputOutput
13
1.7 Program Specification1.7 Program Specification A A formal descriptionformal description of a system, or a of a system, or a
component or module of a system, component or module of a system, intended as a intended as a basis for further basis for further developmentdevelopment
CharacteristicsCharacteristics of a good specification of a good specification unambiguous, complete, verifiable, unambiguous, complete, verifiable,
consistent, modifiable, traceable, and usable consistent, modifiable, traceable, and usable after development after development
Details of the specification will be Details of the specification will be discovered during the discovered during the analysis analysis and and design stagesdesign stages of software of software development development
14
1.7 Program Specification Example 1.7 Program Specification Example (cont.)(cont.)
15
1.7 Practical Analogy: 1.7 Practical Analogy: Morning RoutineMorning Routine
PROCEDURES:PROCEDURES:
Step 1.Step 1. Get out of bed Get out of bed
Step 2.Step 2. Take a shower/bath Take a shower/bath
Step 3.Step 3. Dress yourself Dress yourself
Step 4:Step 4: Drink coffee/tea Drink coffee/tea
Step 5:Step 5: Take breakfast Take breakfast
Step 6:Step 6: Drive to work Drive to work
16
1.7 Example: Actual Computer 1.7 Example: Actual Computer Program (Salary Computation)Program (Salary Computation)
Logical Program:Logical Program:
Step 1:Step 1: Identify all variables Identify all variables
Actual Program Code: Actual Program Code: VBVB
No. of hours worked, Rate per No. of hours worked, Rate per hourhour
Basic pay, Deductions, Net payBasic pay, Deductions, Net pay
Step 2:Step 2: Initialize all variables Initialize all variables
identify data typeidentify data typeDim no_hours_worked, Dim no_hours_worked,
rate_per_hour, basic_pay rate_per_hour, basic_pay
deductions, net_pay as deductions, net_pay as IntegerInteger
Step 3:Step 3: Assign variables Assign variables
(temporary storage)(temporary storage)Let a = no_hours_workedLet a = no_hours_worked
Let b = rate_per_hourLet b = rate_per_hour
Let c = basic_payLet c = basic_pay
Let d = deductionLet d = deduction
Let e = net_payLet e = net_pay
Step 4:Step 4: Compute basic pay Compute basic pay c = a * bc = a * b
Step 5:Step 5: Compute net pay Compute net pay e = c – de = c – d
Step 6:Step 6: Store value of net Store value of net paypay
lblPay.Caption = elblPay.Caption = e
17
1.8 Definitions of Key 1.8 Definitions of Key TermsTerms
SpecificationSpecification A A formal descriptionformal description of a system or a of a system or a
component module of a system, component module of a system, intended as a basis for further intended as a basis for further developmentdevelopment
Specification LanguageSpecification Language A A languagelanguage that is used in expressing a that is used in expressing a
specification (e.g. Rational Rose UML)specification (e.g. Rational Rose UML)
Diagrammatic TechniqueDiagrammatic Technique A style of analysis that relies primarily A style of analysis that relies primarily
on the on the use of diagramsuse of diagrams (as opposed to (as opposed to text)text) DFD, flowcharts, MS ProjectDFD, flowcharts, MS Project
18
1.9 Software Life Cycle1.9 Software Life Cycle The The program developmentprogram development process is process is
part of the software lifecycle, part of the software lifecycle, characterized by the following stages:characterized by the following stages:
Requirements Requirements analysis analysis
Design Design CodingCoding TestingTesting ImplementatioImplementatio
n and supportn and support
19
1.10 Requirements 1.10 Requirements Analysis StageAnalysis Stage
An An accurate accurate and and complete set complete set of client and of client and user user requirementrequirementss is is produced to produced to determine determine the the characteristicharacteristics of an cs of an acceptable acceptable solutionsolution
20
Practical Analogy: Practical Analogy: Building a Building a HouseHouse
House Owner House Owner RequirementsRequirements
Building Building RequirementsRequirements
(Site, Access)(Site, Access)Draft PlanDraft Plan Purpose/Purpose/
ObjectivesObjectives
Develop Initial Layout
Add further design considerations
(Porch, Parking, Pool)
Evaluate Improve Design
Building Objectives Cost, Season
Contractor, Materials
Building Objectives Design
Objectives
Final Design
Iterate
Initial Logical Modules
21
1.10 Requirements 1.10 Requirements Analysis Stage (cont.)Analysis Stage (cont.)
The requirements analysis The requirements analysis specification specification
will contain:will contain: the the proposed system or solutionproposed system or solution, ,
which has been which has been agreed by the client agreed by the client and and developerdeveloper
a list of a list of existing tools, new tools,existing tools, new tools, required facilitiesrequired facilities and and peoplepeople available for developing the solution available for developing the solution
a a scheduleschedule for the next stages of the for the next stages of the project, including the deliverables for project, including the deliverables for each stage each stage
22
1.10 Requirements 1.10 Requirements Analysis Stage (cont.)Analysis Stage (cont.)
23
1.10.1 Deliverables 1.10.1 Deliverables Deliverables Deliverables
are the are the products of the products of the different different phasesphases throughout the throughout the development development process process
Provided for the client by the developer, Provided for the client by the developer, as as evidence that progressevidence that progress is being made is being made according to requirements according to requirements may be may be written documentswritten documents and and diagramsdiagrams
produced during the analysis and design produced during the analysis and design phases, phases, sample screen layoutssample screen layouts or or sample sample reportsreports
24
1.10.2 Requirements 1.10.2 Requirements Analysis - Analysis - ObjectivesObjectives
To define, in detail, To define, in detail, a solutiona solution that will that will fully fully meet the client and user meet the client and user requirementsrequirements (program specification) (program specification)
The program specification will include a The program specification will include a description of the: description of the: InputsInputs to the process to the process operations the systemoperations the system performs for each input performs for each input output obtainedoutput obtained for the corresponding input for the corresponding input
• If there is more than one program in the system, If there is more than one program in the system, the document is called a system specification the document is called a system specification
25
1.11 Design Stage1.11 Design StageHow the solution will be built to How the solution will be built to
satisfy thesatisfy the
requirements requirements Complex problems are Complex problems are divided into a set divided into a set
of sub-problems of sub-problems ProgramsPrograms and and modulesmodules are defined are defined
inputs, outputs, functions and processes inputs, outputs, functions and processes
The The use of formal program design use of formal program design techniquestechniques and programming standards and programming standards are recommended are recommended
The The most appropriate programming most appropriate programming languagelanguage will have been decided upon will have been decided upon during the development of the design during the development of the design
26
1.11 Design Stage (cont.)1.11 Design Stage (cont.)
27
1.12 Coding Stage1.12 Coding Stage Produce the Produce the
programsprograms that will that will make up make up the system the system
Complete Complete when all when all code is code is written and written and documenteddocumented, and , and compiles compiles without any without any errorserrors
28
1.12 Testing Stage1.12 Testing Stage Every Every program module needs to be program module needs to be
testedtested according to the test plan according to the test plan developed in the design phase developed in the design phase
NOTE: can be carried out while program is being developed can be carried out while program is being developed Remember, finding and fixing a fault a fault after software delivery software Remember, finding and fixing a fault a fault after software delivery software
delivery is 100 more expensive than finding and fixing it than finding and delivery is 100 more expensive than finding and fixing it than finding and fixing it during systems analysis or early designfixing it during systems analysis or early design
29
1.12 Testing Stage (cont.)1.12 Testing Stage (cont.) When the When the program is completedprogram is completed and all and all
separate modules have been tested, a separate modules have been tested, a full testfull test of the program is performed of the program is performed any errorsany errors in the program in the program will be will be
correctedcorrected and the test repeated and the test repeated If testing identifies If testing identifies changes requiredchanges required to to
the program design the program design analysis, design, coding and testing analysis, design, coding and testing
phases are repeated for the changes phases are repeated for the changes
30
1.12 Testing Stage (cont.)1.12 Testing Stage (cont.) Systems testSystems test
programs are programs are tested as a grouptested as a group The system must be tested The system must be tested in all in all
environments environments Alpha testAlpha test
test of the finished application completed test of the finished application completed internallyinternally
Beta testBeta test tested tested externally externally
SimulationSimulation used when used when live environmentlive environment test is not test is not
possible, e.g. (nuclear reactor control, traffic possible, e.g. (nuclear reactor control, traffic light control) light control)
31
1.13 Implementation 1.13 Implementation SupportSupport
If needs If needs change change andand the amendments the amendments required required are substantial, then the software lifecycle are substantial, then the software lifecycle would be applied to the amendments would be applied to the amendments
After installation it After installation it must be maintainedmust be maintained according to the needs of the users.according to the needs of the users.
When When all the all the previous stages previous stages have been have been completed completed satisfactorilysatisfactorily, the , the system is system is ready for ready for implementationimplementation
User User documentationdocumentation or or operating operating instructions may be instructions may be required required
32
1.14 Definitions of Key 1.14 Definitions of Key TermsTerms
LifecycleLifecycle The The complete complete
lifetime of a lifetime of a software software systemsystem from from initial initial conception conception through to through to final final obsolescence obsolescence
The term is most commonly used in The term is most commonly used in contexts where programs are contexts where programs are expected to have a expected to have a fairly long useful fairly long useful lifelife
33
1.14 Lifecycle Definition 1.14 Lifecycle Definition (cont.)(cont.)
LifecycleLifecycle Traditionally, a lifecycle is modeled Traditionally, a lifecycle is modeled
as a number of successive phases:as a number of successive phases: user requirements user requirements system requirementssystem requirements software requirementssoftware requirements overall design overall design detailed design detailed design component productioncomponent production component testing component testing integration and system testingintegration and system testing acceptance testing and releaseacceptance testing and release operation and maintenance operation and maintenance
34
Chapter 3Chapter 3Data Analysis and Data Analysis and
ProblemsProblems
Chapter 3Chapter 3Data Analysis and Data Analysis and
ProblemsProblems
PART 2PART 2STRUCTURE DIAGRAMSSTRUCTURE DIAGRAMS
PART 2PART 2STRUCTURE DIAGRAMSSTRUCTURE DIAGRAMS
35
2.1 Definitions of Key 2.1 Definitions of Key TermsTerms
Data StructureData Structure A way of describing the A way of describing the relationship of the relationship of the
componentcomponent parts to the whole parts to the whole
TechniqueTechnique A rectangle A rectangle containing a * means an iterationcontaining a * means an iteration
of all lower level boxes of all lower level boxes A box containing a A box containing a small circle represents a small circle represents a
choicechoice between alternative sets of data (a between alternative sets of data (a selection) selection)
*
IterationIteration
(Repetition)(Repetition)
SelectionSelection
36
2.2 Structured Diagram 12.2 Structured Diagram 1
37
2.3 Structured Diagram 22.3 Structured Diagram 2
38
2.3 Structured Diagram 32.3 Structured Diagram 3
39
2.4 Organizing Information 2.4 Organizing Information A A file file is composed of records is composed of records Each record Each record contains data organisedcontains data organised
in a defined structure in a defined structure The components of this structure are The components of this structure are
called called fieldsfields
40
2.4 Data Structure Diagram 2.4 Data Structure Diagram (cont.)(cont.)
41
2.5 Record Structure2.5 Record Structure The The fieldsfields in a record in a record must be must be
carefully designedcarefully designed to contain all the to contain all the data that may need to be referenced data that may need to be referenced for producing for producing information information this task would be this task would be performed in conjunction performed in conjunction
with the clientwith the client (e.g. name length, date (e.g. name length, date formats)formats) and the result would form part of and the result would form part of the program specification the program specification
42
2.6 General File Structure2.6 General File Structure
43
2.7 Fixed Length Records2.7 Fixed Length Records Number of characters allowed in each Number of characters allowed in each
record can be record can be predetermined predetermined (size (size specific)specific)
44
2.8 Variable Length 2.8 Variable Length RecordsRecords
Sometimes records in a file store Sometimes records in a file store variable variable amounts of data amounts of data
It is It is not sensiblenot sensible to allow spare to allow spare capacity in the field lengths capacity in the field lengths this would be this would be highly inefficienthighly inefficient use of the use of the
backing store backing store the more complex processing requirements the more complex processing requirements
needed to deal with variable length records needed to deal with variable length records may be justified may be justified
it is the it is the responsibility of the design responsibility of the design teamteam to ensure that the to ensure that the processing/storage trade-offprocessing/storage trade-off is is sensibly chosen sensibly chosen
45
Chapter SUMMARYChapter SUMMARY Program development process Program development process Structure diagrams Structure diagrams Organizing information Organizing information Fixed and variable length records Fixed and variable length records