จรรยา ตันอนุชิตติกุลjournal of economics 18/2 2014, jul.—dec. 7 ได้รับผลประโยชน์สุทธิที่เพิ่มขึ้น
อ. จรรยา สายนุ้ย CS.313...
-
Upload
aleesha-bruce -
Category
Documents
-
view
230 -
download
1
Transcript of อ. จรรยา สายนุ้ย CS.313...
![Page 1: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/1.jpg)
อ.จรรยา สายนุ้ยCS.313 ภาควิ�ชาวิ�ทยาการคอมพิ�วิเตอร�
![Page 2: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/2.jpg)
Outline1. Problem Solving
Definition Problem Problem Solving
Strategies Techniques Tools Approach
2. Programming Principle Programming
Language Programming Design Programming
Paradigms
![Page 3: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/3.jpg)
Problem Solving DefinitionProblem
.......................................................................................................
.........................
.......................................................................................................
.........................
.......................................................................................................
.........................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
![Page 4: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/4.jpg)
Problem Domainsciences : mathematics , statistics ,
chemistry , physics, biology business : inventory , accounting education : registration , evaluation banking : ATM , loaning , report others : restaurant , transportation , hotel ,
department store
![Page 5: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/5.jpg)
Problem Solving Strategies
Divide and Conquer Dynamic Programming Greedy Algorithms etc.
(Algorithm Design Techniques)
![Page 6: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/6.jpg)
Problem Solving Techniques Top-down Stepwise Refinement Structured Programming Modular Design Bottom-up Approach Recursion
![Page 7: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/7.jpg)
Problem Solving Tools Pseudo Code Flowchart Programming Languages EditorDebugger
![Page 8: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/8.jpg)
Problem Solving ApproachSoftware Development Method or Software
Life CycleUse computers in problem solving consists of
6 steps :1. Requirement Specification2. Analysis3. Design4. Implementation5. Testing And Verification6. Documentation
![Page 9: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/9.jpg)
Software Life Cycle1. 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
![Page 10: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/10.jpg)
Software Life Cycle2. Analysis
Input Output Constraints/Conditions Formulas
![Page 11: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/11.jpg)
Software Life Cycle3. Design
![Page 12: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/12.jpg)
Software Life Cycle3.1 Algorithm designAlgorithm Definition
Algorithm : a method of solution described as a sequence of steps to be performed in a specific logical order.
![Page 13: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/13.jpg)
Software Life Cycle3.1 Algorithm designSatisfied Requirements :
Unambiguousness Generality Correctness Finiteness
![Page 14: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/14.jpg)
Software Life Cycle3.1 Algorithm design Representation Strategy
Pseudocoding Flowcharting HIPO Chart
![Page 15: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/15.jpg)
Software Life Cycle3.1 Algorithm design
TechniquesGreedy Method Divide and Conquer Dynamic Programming Backtracking Algorithms etc.
![Page 16: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/16.jpg)
Software Life Cycle3.2 Data design
Input/OutputProcessTypes : constant/variables ,global/localRepresentation: number , text , etc. Structure: array, file , queue , tree , etc. Manipulation: operators , functions
.........................................................................................................................................
.......................
...........................................................................................................................
.....................
...................................................................................................................................
......................................
...................................................................................................................................
..................
![Page 17: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/17.jpg)
Software Life Cycle4. Implementation or Coding Programming Languages
writability readability modifiability reusability
![Page 18: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/18.jpg)
Software Life Cycle4. 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
![Page 19: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/19.jpg)
Software Life Cycle4.Implementation or Coding Programming Errors
design errors syntax/compilation errors linker errors run-time errors warning diagnostic message
![Page 20: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/20.jpg)
Software Life Cycle4. 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
![Page 21: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/21.jpg)
Software Life Cycle4. 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
![Page 22: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/22.jpg)
Software Life Cycle4. 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
![Page 23: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/23.jpg)
Software Life Cycle4. Implementation or Coding Debugging techniques
linker errors Some errors prevent the linker to
create the executable moduleFunction prototypes do not match their
definitionssolution: correct prototypes
![Page 24: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/24.jpg)
Software Life Cycle4. Implementation or Coding Debugging techniques
run-time/execution errorswhile 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
![Page 25: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/25.jpg)
Software Life Cycle4. Implementation or Coding Strategies for defensive
correction : errors debug defence : to prevent abnormal
termination /errors preparing to manage errors if (a < o) { … } using exception handler
![Page 26: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/26.jpg)
Software Life Cycle5. 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
![Page 27: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/27.jpg)
Software Life Cycle5. 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
![Page 28: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/28.jpg)
Software Life Cycle: Example1.Requirement Specification
เขี�ยนุ้โปรแกรมหาระยะทางระหวิ�างจด 2 จดค!อ (x1 ,y1 ) และ (x2 ,y2 )
ส#ตรค!อ
)()( 122
122 yyxx
![Page 29: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/29.jpg)
Software Life Cycle : Example2. Analysis
Input: integer x1 , y1 , x2 และ y2Output : float & positive value
Formulas : )()( 122
122 yyxx
![Page 30: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/30.jpg)
Software Life Cycle: Example3. Algorithm Design
Pseudocode1. Read x1 , y1 , x2 , y22. dist = sqrt((x1 - x2)2 + (y1 - y2)2)
3. Write dist4. end
![Page 31: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/31.jpg)
Software Life Cycle: Example4. Implementation or Coding
#include <stdio.h>#include <math.h>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);
}
![Page 32: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/32.jpg)
Software Life Cycle: Example5. Testing And Verification verifying: compile and debug data test:3 0 0 4 output: 5.0
![Page 33: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/33.jpg)
Software Life Cycle6. Documentation
System documentation Program documentation User documentation
![Page 34: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/34.jpg)
Software Life Cycle6. Documentation
System documentation Context Diagram Dataflow Diagram Database Design : E-R diagram ,
Relational model , Data dictionary System modules/flowchart
![Page 35: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/35.jpg)
Software Life Cycle6. Documentation
Program documentation Flowchart / Pseudocode Program Listing Sufficient in-program : comment ,
indentation
![Page 36: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/36.jpg)
Software Life Cycle6. DocumentationUser documentation
Interfaces Input Examples Output Examples Error messages : causes & effect
![Page 37: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/37.jpg)
Programming Principles Programming Languages Program Design Programming Paradigms
![Page 38: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/38.jpg)
Programming 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
![Page 39: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/39.jpg)
Program Design modular design
top-down approachbottom-up approach
stepwise refinement structured programming etc.
![Page 40: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/40.jpg)
Programming paradigmsimperative paradigmfunctional paradigmlogic paradigmobject-oriented paradigm
![Page 41: อ. จรรยา สายนุ้ย CS.313 ภาควิชาวิทยาการคอมพิวเตอร์](https://reader035.fdocuments.net/reader035/viewer/2022062314/56649e6f5503460f94b6ccdb/html5/thumbnails/41.jpg)
Practice make perfect