Upload
vuongcong
View
220
Download
0
Embed Size (px)
Citation preview
Lecture Outline
Software development and design
Structured analysis and design
Object-Oriented analysis and design
Function
Object-Oriented programming
Software development and design
Software
ชดค าสงหรอโปรแกรมทใชควบคมการท างานของเครองคอมพวเตอรทเขยนขนดวยภาษาคอมพวเตอร
สรางขนเพอแกปญหาของผใชและท างานตามทผใชตองการไดอยางถกตอง
Structured Analysis and Design
Data Oriented
Data Flow Diagrams (DFD)
Entity Relationship Diagrams (ERD)
Action Oriented
Finite State Machine (FSM)
Object-Oriented Analysis
Builds a real-world model from requirements
client interviews
domain knowledge
real-world experience
The model addresses three aspects of objects
class structure and relationships
sequencing of interactions and events
data transformations and computations
Models of Object-Oriented Analysis
Class Model
static structure
what objects are in the system?
how are they related?
Dynamic Model
behavioral aspects
what events occur in the system
when do they occur and in what
order?
Functional Model
data transformations
“what” does the system do
Data-Oriented
Action-Oriented
Both Data and Actions
Object Oriented Analysis and Design
The Unified Modeling Language (UML)
ตวอยาง
Use-case diagram Class diagram
UML DiagramsStructural
: element of spec. irrespective of time
Class
Component
Deployment
Object
Composite structure
Package
Behavioral: behavioral features of a system / business process
Activity
State machine
Use case
Interaction
Interaction: emphasize object interaction
• Communication (collaboration)
• Sequence
• Interaction overview
• Timing
Functions
What we call them:
functions, methods, modules
Functions are a core construct in OO and
non-OO programs
Principals of good functions apply in either
language
But less of a problem in OO – can you think why?
Functions
Functional decomposition แยกปญหาใหเปนสวนยอย
ใช function แกปญหาทละสวน มลกษณะเปนล าดบชน
Problems
การควบคมและการประสานงาน รวมอยท Main method
การเปลยนแปลงท าใหเกดผลกระทบมาก
Cohesion and Coupling
Cohesion (การเกาะยด) การเกาะยด คอระดบของความสมพนธภายใน module
หาก module มการเกาะยดสง แสดงวาสามารถท างานดวยตวของมนเองระดบหนง และมการเรยกใชหรอผกยดกบโปรแกรมตาง module นอย
Coupling (การปฏสมพนธ) การตดตอสงขอมลระหวาง module
ถาระบบใดมปฏสมพนธระหวาง module มาก การยดเกาะภายในจะมโอกาสลดนอยลง
Goal
Flexibility, independence of modules
Looser connections, less brittle system
Reusability
Loosely-coupled modules, each highly
cohesive
Object Oriented Programming
Object
Attributes, Methods and Events.
Inheritance
Encapsulation
Polymorphism
Programming Languages
ภาษาคอมพวเตอรใชในการสรางซอฟแวร แบงเปน 3 กลมหลก ๆ
Machine languages
Assembly languages
High-Level languages
Machine Languages
เปนเลขฐานสอง ประกอบดวย 0 และ 1 มความยากในการเขยนโปรแกรมเนองจาก
เปนภาษาทมนษยเขาใจไดยาก ความผดพลาดเพอ 1 จดกท าใหโปรแกรมลมเหลวได ตวอยาง
1110100010101 111010101110 10111010110100 1010001110111
Assembly Languages
เกดจากการออกแบบตวอกษรภาษาองกฤษใหแทนค าสงรหสเลขฐานสองเรยกวา รหส mnemonic
คอมพวเตอรตองแปลเปนภาษาเครองกอนประมวลผล ตวอยาง
ADD 1001010, 1011010
High-Level Languages
เปนภาษาทท าใหการเขยนโปรแกรมงายขน ใกลเคยงกบภาษามนษย แบงเปน สองกลมหลก
Procedural (Structural) languages
Object-Oriented Languages
Procedural Languages
เปนภาษาระดบสง ทมลกษณะเปนค าสงเรยงล าดบเปนขนตอน และเปนโครงสราง
ตวอยาง C
COBOL
Fortran
LIPS
Perl
Object-Oriented Languages
ใหความสนใจท modeling data ไมใชโครงสราง เขยนโปรแกรมโดยใชแบบแปลนของแบบจ าลอง Classes
ตวอยาง C++
Java
VB.NET