Top Banner
Object Oriented Concepts and Programming เสถียร หันตา คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา
30

Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Jun 12, 2018

Download

Documents

vuongcong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Object Oriented Concepts and Programming

เสถยร หนตาคณะเทคโนโลยสารสนเทศและการสอสารมหาวทยาลยพะเยา

Page 2: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Lecture Outline

Software development and design

Structured analysis and design

Object-Oriented analysis and design

Function

Object-Oriented programming

Page 3: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Software development and design

Software

ชดค าสงหรอโปรแกรมทใชควบคมการท างานของเครองคอมพวเตอรทเขยนขนดวยภาษาคอมพวเตอร

สรางขนเพอแกปญหาของผใชและท างานตามทผใชตองการไดอยางถกตอง

Page 4: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Software Development

Software Development Life Cycle

Page 5: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Software Analysis and Design

Structured Analysis and Design

Object Oriented Analysis and Design

Page 6: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Structured Analysis and Design

Data Oriented

Data Flow Diagrams (DFD)

Entity Relationship Diagrams (ERD)

Action Oriented

Finite State Machine (FSM)

Page 7: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

DFD Level 0

DFD Level 1

Page 8: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

DFD Level 3

Page 9: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

DFD

Page 10: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

ER Diagram

Page 11: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

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

Page 12: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

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

Page 13: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Object Oriented Analysis and Design

The Unified Modeling Language (UML)

ตวอยาง

Use-case diagram Class diagram

Page 14: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

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

Page 15: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Structured analysis and design

Page 16: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Object oriented analysis and design

Page 17: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...
Page 18: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

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?

Page 19: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Functions

Functional decomposition แยกปญหาใหเปนสวนยอย

ใช function แกปญหาทละสวน มลกษณะเปนล าดบชน

Problems

การควบคมและการประสานงาน รวมอยท Main method

การเปลยนแปลงท าใหเกดผลกระทบมาก

Page 20: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Functions

Functions, Methods, Modules

Cohesion

Coupling

Page 21: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Cohesion and Coupling

Cohesion (การเกาะยด) การเกาะยด คอระดบของความสมพนธภายใน module

หาก module มการเกาะยดสง แสดงวาสามารถท างานดวยตวของมนเองระดบหนง และมการเรยกใชหรอผกยดกบโปรแกรมตาง module นอย

Coupling (การปฏสมพนธ) การตดตอสงขอมลระหวาง module

ถาระบบใดมปฏสมพนธระหวาง module มาก การยดเกาะภายในจะมโอกาสลดนอยลง

Page 22: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Goal

Flexibility, independence of modules

Looser connections, less brittle system

Reusability

Loosely-coupled modules, each highly

cohesive

Page 23: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Object Oriented Programming

Object

Attributes, Methods and Events.

Inheritance

Encapsulation

Polymorphism

Page 24: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Programming Languages

ภาษาคอมพวเตอรใชในการสรางซอฟแวร แบงเปน 3 กลมหลก ๆ

Machine languages

Assembly languages

High-Level languages

Page 25: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Machine Languages

เปนเลขฐานสอง ประกอบดวย 0 และ 1 มความยากในการเขยนโปรแกรมเนองจาก

เปนภาษาทมนษยเขาใจไดยาก ความผดพลาดเพอ 1 จดกท าใหโปรแกรมลมเหลวได ตวอยาง

1110100010101 111010101110 10111010110100 1010001110111

Page 26: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Assembly Languages

เกดจากการออกแบบตวอกษรภาษาองกฤษใหแทนค าสงรหสเลขฐานสองเรยกวา รหส mnemonic

คอมพวเตอรตองแปลเปนภาษาเครองกอนประมวลผล ตวอยาง

ADD 1001010, 1011010

Page 27: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

High-Level Languages

เปนภาษาทท าใหการเขยนโปรแกรมงายขน ใกลเคยงกบภาษามนษย แบงเปน สองกลมหลก

Procedural (Structural) languages

Object-Oriented Languages

Page 28: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Procedural Languages

เปนภาษาระดบสง ทมลกษณะเปนค าสงเรยงล าดบเปนขนตอน และเปนโครงสราง

ตวอยาง C

COBOL

Fortran

LIPS

Perl

Page 29: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

Object-Oriented Languages

ใหความสนใจท modeling data ไมใชโครงสราง เขยนโปรแกรมโดยใชแบบแปลนของแบบจ าลอง Classes

ตวอยาง C++

Java

VB.NET

Page 30: Object Oriented Concepts and Programming · Data Flow Diagrams (DFD) ... client interviews ... หาก module มีการเกาะยึดสูง ...

OO Terms and Conceptso Object and Classo Inheritance, Encapsulation and

Polymorphismo Relationship and Interaction between

classes

OO Analysis and Designo Object Modeling with UMLo UML Diagramso Tools

Mapping UML model into OO Programming Languageso Java Language