Title: CS.313 ??????????????????????????
1????????????????????????????????????????????
- ?.????? ???????
- CS.313 ??????????????????????????
2Outline
- Problem Solving
- Definition
- Problem
- Problem Solving
- Strategies
- Techniques
- Tools
- Approach
- Programming Principle
- Programming Language
- Programming Design
- Programming Paradigms
3Problem Solving Definition
- Problem
- .................................................
..................................................
............................. - .................................................
..................................................
............................. - .................................................
..................................................
............................. - Problem Solving
- The process of transforming the description of a
problem into the solution of that problem by
using own knowledge of the problem domain and be
relying on the ability to select and use
appropriate problem solving strategies,
techniques and tools
4Problem Domain
- sciences mathematics , statistics , chemistry ,
physics, biology - business inventory , accounting
- education registration , evaluation
- banking ATM , loaning , report
- others restaurant , transportation , hotel ,
department store
5Problem Solving Strategies
(Algorithm Design Techniques)
- Divide and Conquer
- Dynamic Programming
- Greedy Algorithms
- etc.
6Problem Solving Techniques
- Top-down Stepwise Refinement
- Structured Programming
- Modular Design
- Bottom-up Approach
- Recursion
7Problem Solving Tools
- Pseudo Code
- Flowchart
- Programming Languages
- Editor
- Debugger
8Problem Solving Approach
- Software Development Method or Software Life
Cycle - Use computers in problem solving consists of 6
steps - Requirement Specification
- Analysis
- Design
- Implementation
- Testing And Verification
- Documentation
9Software Life Cycle
- Requirement Specification
- what the problem is
- what is needed to solve
- what the solution should provide
- any constraints and special conditions to
concern - depend on familiarity with the problem domain
10Software Life Cycle
- Analysis
- Input
- Output
- Constraints/Conditions
- Formulas
11Software Life Cycle
- Design
- 3.1 Algorithm design
- definition
- requirement
- strategy
- techniques
- 3.2 Data design
- Input/Output
- Process
- Types
- Representation
- Structure
- manipulation
12Software Life Cycle
- 3.1 Algorithm design
- Algorithm Definition
- Algorithm a method of solution described as a
sequence of steps to be performed in a specific
logical order.
13Software Life Cycle
- 3.1 Algorithm design
- Satisfied Requirements
- Unambiguousness
- Generality
- Correctness
- Finiteness
14Software Life Cycle
- 3.1 Algorithm design
- Representation Strategy
- Pseudocoding
- Flowcharting
- HIPO Chart
15Software Life Cycle
- 3.1 Algorithm design
- Techniques
- Greedy Method
- Divide and Conquer
- Dynamic Programming
- Backtracking Algorithms
- etc.
16Software Life Cycle
- 3.2 Data design
- Input/Output
- Process
- Types constant/variables ,global/local
- Representation number , text , etc.
- Structure array, file , queue , tree , etc.
- Manipulation operators , functions
..................................................
..................................................
..................................................
..........
..................................................
..................................................
............................................
..................................................
..................................................
..................................................
...................
..................................................
..................................................
.................................................
17Software Life Cycle
- Implementation or Coding
- Programming Languages
- writability
- readability
- modifiability
- reusability
18Software Life Cycle
- Implementation or Coding
- Important as designing skill
- programming is the art of designing efficient
algorithms to meet requirements - Programming errors
- Debugging techniques
- Strategies for defensive
- Programming
19Software Life Cycle
- Implementation or Coding
- Programming Errors
- design errors
- syntax/compilation errors
- linker errors
- run-time errors
- warning diagnostic message
20Software Life Cycle
- Implementation or Coding
- Debugging techniques
- The ability to debug programs is another
problem-solving skill that is as important as the
ability to design programs - Debugging is the process of finding and
correcting errors in computer programs
21Software Life Cycle
- Implementation or Coding
- Debugging techniques
- design errors
- quite difficult to debug , no error message ,
incorrect output sometimes - incorrect formula , wrong program logic ,
inappropriate data type - careful review in analysis and design , use
variety of testing data
22Software Life Cycle
- Implementation or Coding
- Debugging techniques
- syntax/compilation errors
- Detect by compilers
- Something missing / undeclared var.
- Easy , just correct error sources
- warning diagnostic message
- Strange but can still proceed
- Unreferenced var.
- Get rid of causes or ignore
23Software Life Cycle
- Implementation or Coding
- Debugging techniques
- linker errors
- Some errors prevent the linker to create the
executable module - Function prototypes do not match their
definitions - solution correct prototypes
24Software Life Cycle
- Implementation or Coding
- Debugging techniques
- run-time/execution errors
- while executing , difficult to debug, abnormal
termination - divide by zero , type mismatch ,index is out of
range, domain error - trace/step watch some variables value , error
handling
25Software Life Cycle
- Implementation or Coding
- Strategies for defensive
- correction errors debug
- defence to prevent abnormal termination
/errors - preparing to manage errors
- if (a lt o)
- using exception handler
26Software Life Cycle
- Testing And Verification
- program verification
- the process of ensuring that a program meets
user requirements - one of the techniques that can be used for
program verification is program testing
27Software Life Cycle
- Testing And Verification
- program testing
- the process of executing a program to demonstrate
its correctness - testing methods
- test data
- testing modules driver , stub
- top-down testing
- bottom-up testing
- blackbox .vs. whitebox
28Software Life Cycle Example
- Requirement Specification
- ??????????????????????????????? 2 ?????? (x1 ,y1
) ??? (x2 ,y2 ) - ???????
29Software Life Cycle Example
- Analysis
- Input integer x1 , y1 , x2 ??? y2
- Output float positive value
- Formulas
30Software Life Cycle Example
- Algorithm Design
- Pseudocode
- Read x1 , y1 , x2 , y2
- dist sqrt((x1 - x2)2 (y1 - y2)2)
- Write dist
- end
31Software Life Cycle Example
- Implementation or Coding
- include ltstdio.hgt
- include ltmath.hgt
- void main()
- int x1, x2, y1, y2
- float dist
- scanf(d d d d, x1, y1, x2, y2)
- dist sqrt((x2-x1)(x2-x1)(y2-y1)(y2-y1))
- printf(distance f\n,dist)
-
32Software Life Cycle Example
- Testing And Verification
- verifying compile and debug
- data test 3 0 0 4
- output 5.0
33Software Life Cycle
- Documentation
- System documentation
- Program documentation
- User documentation
34Software Life Cycle
- Documentation
- System documentation
- Context Diagram
- Dataflow Diagram
- Database Design E-R diagram , Relational
model , Data dictionary - System modules/flowchart
35Software Life Cycle
- Documentation
- Program documentation
- Flowchart / Pseudocode
- Program Listing
- Sufficient in-program comment , indentation
36Software Life Cycle
- Documentation
- User documentation
- Interfaces
- Input Examples
- Output Examples
- Error messages causes effect
37Programming Principles
- Programming Languages
- Program Design
- Programming Paradigms
38Programming Languages
- Why programming languages ?
- to enable the user to enlist the help of a
computer in solving problems in the domain of
interest - to enable the user to bridge the gap between
problem and machine domain
39Program Design
- modular design
- top-down approach
- bottom-up approach
- stepwise refinement
- structured programming
- etc.
40Programming paradigms
- imperative paradigm
- functional paradigm
- logic paradigm
- object-oriented paradigm
41