SlideShare una empresa de Scribd logo
1 de 31
CH1. Object-Oriented Paradigm
© Taka Wang, 2017 1
Naive Problem
If I were to give you the task of wri2ng code to access a descrip2on
of shapes that were stored in a database and then display them.
© Taka Wang, 2017 2
Structural Programming thinking - possible steps
1. Locate the list of shapes in the database. (
)
2. Open up the list of shapes. ( )
3. Sort the list according to some rules. ( )
4. Display the individual shapes on the monitor. (
)
© Taka Wang, 2017 3
Func%onal Decomposi%on ( )
4a. Iden)fy the type of shape. ( )
4b. Get the loca-on of the shape. ( )
4c. Call the appropriate func2on that will display the shape, giving
it the shape’s loca2on. (
Func2on)
© Taka Wang, 2017 4
Func%onal Decomposi%on
1. (subprograms)
subprograms
(Why not delega7on?) << >>
2. Func7on
module
Func7on module << >>
© Taka Wang, 2017 5
1. ( )
2.
(OO )
3.
© Taka Wang, 2017 6
Dealing with Changes: Func2onal Decomposi2on
4c. Call the appropriate func2on that will display the shape, giving
it the shape’s loca2on. (
Func2on)
© Taka Wang, 2017 7
Dealing with Changes: Func2onal Decomposi2on
4c. Call the appropriate func2on that will display the shape, giving it the
shape’s loca2on. ( Func2on)
Using Modularity to Contain Varia2on
function: display shape
input: type of shape, description of shape
action:
switch (type of shape)
case square: put display function for square here
case circle: put display function for circle here
© Taka Wang, 2017 8
1. ( )
( )
2. type of shape, descrip5on of shape
( array of points )
© Taka Wang, 2017 9
Func%onal Decomposi%on
1. Weak cohesion (Cohesion refers to how “closely the opera6ons in a
rou6ne are related; cohesion as clarity because the more that
opera6ons are related in a rou6ne (or a class), the easier it is to
understand things.)
2. Tight Coupling (Coupling refers to “the strength of a connec6on
between two rou6nes. Coupling is a complement to cohesion.)
The goal is to create rou/nes with internal integrity (strong cohesion) and
small, direct, visible, and flexible rela/ons to other rou/nes (loose
coupling).
© Taka Wang, 2017 10
You are an instructor at a conference. People in your class have
another class to a5end following yours, but don’t know where it is
located. One of your responsibili>es is to make sure everyone
knows how to get to the next class.
© Taka Wang, 2017 11
1. Get list of people in the class.
2. For each person on this list, do the following:
1. Find the next class he or she is taking.
2. Find the loca;on of that class.
3. Find the way to get from your classroom to the person’s next
class.
4. Tell the person how to get to his or her next class.
© Taka Wang, 2017 12
1. A way of ge,ng the list of people in the class.
2. A way of ge,ng the schedule for each person in the class.
3. A program that gives someone direc<ons from your classrom to
any other classroom.
4. A control program that works for each person in the class and
does the reuqired steps for each person.
© Taka Wang, 2017 13
!
You would probably post direc2ons to go from this classroom to
the other classrooms and then tell everyone in the class, I have
posted the loca.ons of the classes following this in the back of the
room, as well as the loca.ons of the other classrooms. Please use
them to go to your next classroom.
© Taka Wang, 2017 14
1. Giving explicit direc+ons to everyone.
2. Giving general instruc+ons and then expect the each person will
figure out how to do the task individually. ( delega+on)
© Taka Wang, 2017 15
1.
2.
:
© Taka Wang, 2017 16
1.
2. ( )
3.
© Taka Wang, 2017 17
1. Conceptual: domain concepts
What am I responsibile for?
2. Specifica9on: interface
How am I used?
3. Implementa9on: How do I fulfill
my responsibili9es?"
© Taka Wang, 2017 18
(you are telling people what you want, not how to
do it.)
( )
© Taka Wang, 2017 19
Object-Oriented Paradigm
© Taka Wang, 2017 20
The objects were iden*fied by looking at the en**es in the
problem domain. I iden*fied the responsibili1es (or methods) for
each object by looking at what these en**es need to do.
© Taka Wang, 2017 21
Apply Fowler's Perspec/ves
• At the conceptual level, an object is a set of responsibili5es. (
)
• At the specifica-on level, an object is a set of methods
(behaviors) that can be invoked by other objects or by itself. (
)
• At the implementa-on level, an object is code and data and
computa5onal interac5ons between them.
© Taka Wang, 2017 22
Object-Oriented Approach
1. Start the control program.
2. Instan4ate the collec4on of students in the classroom.
3. Tell the collec4on to have the students go to their next class.
4. The collec4on tells each student to go to his or her next class.
5. Each student:
1. Finds where his next class is.
2. Determines how to get there.
3. Goes there.
6. Done.
© Taka Wang, 2017 23
Abstract and Polymorphism
• Student abstract class, GraduageStudent and RegularStudent classes.
• Abstract classes define what other, related, classes can do. Abstract
classes act as placeholders for other classes.
• Collec;on Student Concept (Abstract)
Student (Concrete)
•
Derived Class (Polymorphism)
© Taka Wang, 2017 24
1. Locate the list of shapes in the database. (
)
2. Open up the list of shapes. ( )
3. Sort the list according to some rules. ( )
4. Display the individual shapes on the monitor. (
)
© Taka Wang, 2017 25
Object-Oriented Approach (1/2)
© Taka Wang, 2017 26
Object-Oriented Approach (2/2)
1. ShapeDataBase
2. database object instan0ate
collec0on .
3. Collec0on
4. Collec0on
5. Collec0on
6.
© Taka Wang, 2017 27
• ( )
1. Concrete Class
2. Derived Class
•
1. Collec6on Sor6ng algorithm
The object-oriented approach has limited the impact of changing
requirements.
© Taka Wang, 2017 28
1.
2. (
depend on interface, not implementa4on)
3. The internals of an object are unknown to other objects. (
< >)
© Taka Wang, 2017 29
Take away
1.
2. (
)
3. OO
4. (placeholder and delega5on)
5. ( )
© Taka Wang, 2017 30
Thank you1
1
( )
© Taka Wang, 2017 31

Más contenido relacionado

La actualidad más candente

[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)Muhammad Hammad Waseem
 
Theory and evaluation metrics for learning disentangled representations
Theory and evaluation metrics for learning disentangled representationsTheory and evaluation metrics for learning disentangled representations
Theory and evaluation metrics for learning disentangled representationsKien Duc Do
 
Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...
Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...
Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...Kien Duc Do
 
Complex Relations Extraction
Complex Relations ExtractionComplex Relations Extraction
Complex Relations ExtractionNaveed Afzal
 
Final sdp ppt
Final sdp pptFinal sdp ppt
Final sdp pptnancy_17
 
G6 m2-a-lesson 8-t
G6 m2-a-lesson 8-tG6 m2-a-lesson 8-t
G6 m2-a-lesson 8-tmlabuski
 

La actualidad más candente (8)

[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)
 
Theory and evaluation metrics for learning disentangled representations
Theory and evaluation metrics for learning disentangled representationsTheory and evaluation metrics for learning disentangled representations
Theory and evaluation metrics for learning disentangled representations
 
Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...
Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...
Semi-Supervised Learning with Variational Bayesian Inference and Maximum Unce...
 
Complex Relations Extraction
Complex Relations ExtractionComplex Relations Extraction
Complex Relations Extraction
 
Final sdp ppt
Final sdp pptFinal sdp ppt
Final sdp ppt
 
Cohesion and coupling software desgin engineering
Cohesion and coupling  software desgin engineeringCohesion and coupling  software desgin engineering
Cohesion and coupling software desgin engineering
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
G6 m2-a-lesson 8-t
G6 m2-a-lesson 8-tG6 m2-a-lesson 8-t
G6 m2-a-lesson 8-t
 

Destacado

Application Of Software Design Pattern
Application Of Software Design PatternApplication Of Software Design Pattern
Application Of Software Design Patternguest46da5428
 
SOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNS
SOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNSSOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNS
SOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNSshubbhi
 
A Semi-naive Bayes Classifier with Grouping of Cases
A Semi-naive Bayes Classifier with Grouping of CasesA Semi-naive Bayes Classifier with Grouping of Cases
A Semi-naive Bayes Classifier with Grouping of CasesNTNU
 
Overview of Software QA and What is Software Quality
Overview of Software QA and What is Software QualityOverview of Software QA and What is Software Quality
Overview of Software QA and What is Software QualityUniversity of Dhaka
 
Design pattern
Design patternDesign pattern
Design patternOmar Isaid
 
Android (software) Design Pattern
Android (software) Design PatternAndroid (software) Design Pattern
Android (software) Design PatternArif Huda
 
Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012Irene-Angelica Chounta
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software EngineeringManish Kumar
 
Naive Bayes with Conditionally Dependent Data
Naive Bayes with Conditionally Dependent DataNaive Bayes with Conditionally Dependent Data
Naive Bayes with Conditionally Dependent Datatim_hare
 
Cost of software quality ( software quality assurance )
Cost of software quality ( software quality assurance )Cost of software quality ( software quality assurance )
Cost of software quality ( software quality assurance )Kiran Hanjar
 
Code style 2014-07-18-pub
Code style 2014-07-18-pubCode style 2014-07-18-pub
Code style 2014-07-18-pubpersia cai
 
Observer Software Design Pattern
Observer Software Design Pattern Observer Software Design Pattern
Observer Software Design Pattern Nirthika Rajendran
 
Qlync RD 第三屆讀書會候選清單
Qlync RD 第三屆讀書會候選清單Qlync RD 第三屆讀書會候選清單
Qlync RD 第三屆讀書會候選清單Li-Wei Yao
 
DMTM 2015 - 05 Association Rules
DMTM 2015 - 05 Association RulesDMTM 2015 - 05 Association Rules
DMTM 2015 - 05 Association RulesPier Luca Lanzi
 
被遺忘的資訊洩漏 / Information Leakage in Taiwan
被遺忘的資訊洩漏 / Information Leakage in Taiwan被遺忘的資訊洩漏 / Information Leakage in Taiwan
被遺忘的資訊洩漏 / Information Leakage in TaiwanShaolin Hsu
 
程式の工業革命 初稿
程式の工業革命 初稿程式の工業革命 初稿
程式の工業革命 初稿HoShi YoRu
 
Asp.net mvc 概觀介紹
Asp.net mvc 概觀介紹Asp.net mvc 概觀介紹
Asp.net mvc 概觀介紹Alan Tsai
 

Destacado (20)

Application Of Software Design Pattern
Application Of Software Design PatternApplication Of Software Design Pattern
Application Of Software Design Pattern
 
SOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNS
SOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNSSOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNS
SOFTWARE QUALITY ASSURANCE AND DESIGN PATTERNS
 
A Semi-naive Bayes Classifier with Grouping of Cases
A Semi-naive Bayes Classifier with Grouping of CasesA Semi-naive Bayes Classifier with Grouping of Cases
A Semi-naive Bayes Classifier with Grouping of Cases
 
Lecture10 - Naïve Bayes
Lecture10 - Naïve BayesLecture10 - Naïve Bayes
Lecture10 - Naïve Bayes
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Overview of Software QA and What is Software Quality
Overview of Software QA and What is Software QualityOverview of Software QA and What is Software Quality
Overview of Software QA and What is Software Quality
 
Design pattern
Design patternDesign pattern
Design pattern
 
Android (software) Design Pattern
Android (software) Design PatternAndroid (software) Design Pattern
Android (software) Design Pattern
 
Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012Time series analysis of collaborative activities-CRIWG2012
Time series analysis of collaborative activities-CRIWG2012
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software Engineering
 
Naive Bayes with Conditionally Dependent Data
Naive Bayes with Conditionally Dependent DataNaive Bayes with Conditionally Dependent Data
Naive Bayes with Conditionally Dependent Data
 
Cost of software quality ( software quality assurance )
Cost of software quality ( software quality assurance )Cost of software quality ( software quality assurance )
Cost of software quality ( software quality assurance )
 
Code style 2014-07-18-pub
Code style 2014-07-18-pubCode style 2014-07-18-pub
Code style 2014-07-18-pub
 
Observer Software Design Pattern
Observer Software Design Pattern Observer Software Design Pattern
Observer Software Design Pattern
 
Creational Design Patterns
Creational Design PatternsCreational Design Patterns
Creational Design Patterns
 
Qlync RD 第三屆讀書會候選清單
Qlync RD 第三屆讀書會候選清單Qlync RD 第三屆讀書會候選清單
Qlync RD 第三屆讀書會候選清單
 
DMTM 2015 - 05 Association Rules
DMTM 2015 - 05 Association RulesDMTM 2015 - 05 Association Rules
DMTM 2015 - 05 Association Rules
 
被遺忘的資訊洩漏 / Information Leakage in Taiwan
被遺忘的資訊洩漏 / Information Leakage in Taiwan被遺忘的資訊洩漏 / Information Leakage in Taiwan
被遺忘的資訊洩漏 / Information Leakage in Taiwan
 
程式の工業革命 初稿
程式の工業革命 初稿程式の工業革命 初稿
程式の工業革命 初稿
 
Asp.net mvc 概觀介紹
Asp.net mvc 概觀介紹Asp.net mvc 概觀介紹
Asp.net mvc 概觀介紹
 

Similar a Design Pattern Explained CH1

Orchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at ScaleOrchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at ScaleStian Håklev
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingmustafa sarac
 
A New Approach of Learning Hierarchy Construction Based on Fuzzy Logic
A New Approach of Learning Hierarchy Construction Based on Fuzzy LogicA New Approach of Learning Hierarchy Construction Based on Fuzzy Logic
A New Approach of Learning Hierarchy Construction Based on Fuzzy LogicIJERA Editor
 
Data Structures 2004
Data Structures 2004Data Structures 2004
Data Structures 2004Sanjay Goel
 
Assessment 2......
Assessment 2......Assessment 2......
Assessment 2......Shakila Bano
 
Generating domain specific sentiment lexicons using the Web Directory
Generating domain specific sentiment lexicons using the Web Directory Generating domain specific sentiment lexicons using the Web Directory
Generating domain specific sentiment lexicons using the Web Directory acijjournal
 
Placement management system
Placement management systemPlacement management system
Placement management systemSurya Teja
 
Understanding Software Cohesion Metrics: Experimental Assessment of Conceptua...
Understanding Software Cohesion Metrics:Experimental Assessment of Conceptua...Understanding Software Cohesion Metrics:Experimental Assessment of Conceptua...
Understanding Software Cohesion Metrics: Experimental Assessment of Conceptua...Bruno C. da Silva
 
The Valladolid Presentation - Nov, 16, 2011
The Valladolid Presentation - Nov, 16, 2011The Valladolid Presentation - Nov, 16, 2011
The Valladolid Presentation - Nov, 16, 2011sdemetri
 
An Empirical Study on How Developers Reason about Module Cohesion
An Empirical Study on How Developers Reason about Module CohesionAn Empirical Study on How Developers Reason about Module Cohesion
An Empirical Study on How Developers Reason about Module CohesionBruno C. da Silva
 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsMichael Heron
 
SE18_Lec 08_UML Class Diagram
SE18_Lec 08_UML Class DiagramSE18_Lec 08_UML Class Diagram
SE18_Lec 08_UML Class DiagramAmr E. Mohamed
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patternsAmit Kabra
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityShubham Narkhede
 

Similar a Design Pattern Explained CH1 (20)

Orchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at ScaleOrchestration Graphs: Enabling Rich Learning Scenarios at Scale
Orchestration Graphs: Enabling Rich Learning Scenarios at Scale
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
TRiPODの紹介
TRiPODの紹介TRiPODの紹介
TRiPODの紹介
 
E3
E3E3
E3
 
A New Approach of Learning Hierarchy Construction Based on Fuzzy Logic
A New Approach of Learning Hierarchy Construction Based on Fuzzy LogicA New Approach of Learning Hierarchy Construction Based on Fuzzy Logic
A New Approach of Learning Hierarchy Construction Based on Fuzzy Logic
 
A Multi-level Methodology for Developing UML Sequence Diagrams
A Multi-level Methodology for Developing UML Sequence DiagramsA Multi-level Methodology for Developing UML Sequence Diagrams
A Multi-level Methodology for Developing UML Sequence Diagrams
 
Data Structures 2004
Data Structures 2004Data Structures 2004
Data Structures 2004
 
Ooad 2
Ooad 2Ooad 2
Ooad 2
 
Ooad
OoadOoad
Ooad
 
Assessment 2......
Assessment 2......Assessment 2......
Assessment 2......
 
Generating domain specific sentiment lexicons using the Web Directory
Generating domain specific sentiment lexicons using the Web Directory Generating domain specific sentiment lexicons using the Web Directory
Generating domain specific sentiment lexicons using the Web Directory
 
Placement management system
Placement management systemPlacement management system
Placement management system
 
Understanding Software Cohesion Metrics: Experimental Assessment of Conceptua...
Understanding Software Cohesion Metrics:Experimental Assessment of Conceptua...Understanding Software Cohesion Metrics:Experimental Assessment of Conceptua...
Understanding Software Cohesion Metrics: Experimental Assessment of Conceptua...
 
The Valladolid Presentation - Nov, 16, 2011
The Valladolid Presentation - Nov, 16, 2011The Valladolid Presentation - Nov, 16, 2011
The Valladolid Presentation - Nov, 16, 2011
 
An Empirical Study on How Developers Reason about Module Cohesion
An Empirical Study on How Developers Reason about Module CohesionAn Empirical Study on How Developers Reason about Module Cohesion
An Empirical Study on How Developers Reason about Module Cohesion
 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design Patterns
 
SE18_Lec 08_UML Class Diagram
SE18_Lec 08_UML Class DiagramSE18_Lec 08_UML Class Diagram
SE18_Lec 08_UML Class Diagram
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
 
Java unit 7
Java unit 7Java unit 7
Java unit 7
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 

Más de Jamie (Taka) Wang

Más de Jamie (Taka) Wang (20)

20200606_insight_Ignition
20200606_insight_Ignition20200606_insight_Ignition
20200606_insight_Ignition
 
20200727_Insight workstation
20200727_Insight workstation20200727_Insight workstation
20200727_Insight workstation
 
20200723_insight_release_plan
20200723_insight_release_plan20200723_insight_release_plan
20200723_insight_release_plan
 
20210105_量產技轉
20210105_量產技轉20210105_量產技轉
20210105_量產技轉
 
20200808自營電商平台策略討論
20200808自營電商平台策略討論20200808自營電商平台策略討論
20200808自營電商平台策略討論
 
20200427_hardware
20200427_hardware20200427_hardware
20200427_hardware
 
20200429_ec
20200429_ec20200429_ec
20200429_ec
 
20200607_insight_sync
20200607_insight_sync20200607_insight_sync
20200607_insight_sync
 
20220113_product_day
20220113_product_day20220113_product_day
20220113_product_day
 
20200429_software
20200429_software20200429_software
20200429_software
 
20200602_insight_business
20200602_insight_business20200602_insight_business
20200602_insight_business
 
20200408_gen11_sequence_diagram
20200408_gen11_sequence_diagram20200408_gen11_sequence_diagram
20200408_gen11_sequence_diagram
 
20190827_activity_diagram
20190827_activity_diagram20190827_activity_diagram
20190827_activity_diagram
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
20161220 - microservice
20161220 - microservice20161220 - microservice
20161220 - microservice
 
20160217 - Overview of Vortex Intelligent Data Sharing Platform
20160217 - Overview of Vortex Intelligent Data Sharing Platform20160217 - Overview of Vortex Intelligent Data Sharing Platform
20160217 - Overview of Vortex Intelligent Data Sharing Platform
 
20151111 - IoT Sync Up
20151111 - IoT Sync Up20151111 - IoT Sync Up
20151111 - IoT Sync Up
 
20151207 - iot strategy
20151207 - iot strategy20151207 - iot strategy
20151207 - iot strategy
 
20141210 - Microservice Container
20141210 - Microservice Container20141210 - Microservice Container
20141210 - Microservice Container
 
20161027 - edge part2
20161027 - edge part220161027 - edge part2
20161027 - edge part2
 

Último

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 

Último (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

Design Pattern Explained CH1

  • 2. Naive Problem If I were to give you the task of wri2ng code to access a descrip2on of shapes that were stored in a database and then display them. © Taka Wang, 2017 2
  • 3. Structural Programming thinking - possible steps 1. Locate the list of shapes in the database. ( ) 2. Open up the list of shapes. ( ) 3. Sort the list according to some rules. ( ) 4. Display the individual shapes on the monitor. ( ) © Taka Wang, 2017 3
  • 4. Func%onal Decomposi%on ( ) 4a. Iden)fy the type of shape. ( ) 4b. Get the loca-on of the shape. ( ) 4c. Call the appropriate func2on that will display the shape, giving it the shape’s loca2on. ( Func2on) © Taka Wang, 2017 4
  • 5. Func%onal Decomposi%on 1. (subprograms) subprograms (Why not delega7on?) << >> 2. Func7on module Func7on module << >> © Taka Wang, 2017 5
  • 6. 1. ( ) 2. (OO ) 3. © Taka Wang, 2017 6
  • 7. Dealing with Changes: Func2onal Decomposi2on 4c. Call the appropriate func2on that will display the shape, giving it the shape’s loca2on. ( Func2on) © Taka Wang, 2017 7
  • 8. Dealing with Changes: Func2onal Decomposi2on 4c. Call the appropriate func2on that will display the shape, giving it the shape’s loca2on. ( Func2on) Using Modularity to Contain Varia2on function: display shape input: type of shape, description of shape action: switch (type of shape) case square: put display function for square here case circle: put display function for circle here © Taka Wang, 2017 8
  • 9. 1. ( ) ( ) 2. type of shape, descrip5on of shape ( array of points ) © Taka Wang, 2017 9
  • 10. Func%onal Decomposi%on 1. Weak cohesion (Cohesion refers to how “closely the opera6ons in a rou6ne are related; cohesion as clarity because the more that opera6ons are related in a rou6ne (or a class), the easier it is to understand things.) 2. Tight Coupling (Coupling refers to “the strength of a connec6on between two rou6nes. Coupling is a complement to cohesion.) The goal is to create rou/nes with internal integrity (strong cohesion) and small, direct, visible, and flexible rela/ons to other rou/nes (loose coupling). © Taka Wang, 2017 10
  • 11. You are an instructor at a conference. People in your class have another class to a5end following yours, but don’t know where it is located. One of your responsibili>es is to make sure everyone knows how to get to the next class. © Taka Wang, 2017 11
  • 12. 1. Get list of people in the class. 2. For each person on this list, do the following: 1. Find the next class he or she is taking. 2. Find the loca;on of that class. 3. Find the way to get from your classroom to the person’s next class. 4. Tell the person how to get to his or her next class. © Taka Wang, 2017 12
  • 13. 1. A way of ge,ng the list of people in the class. 2. A way of ge,ng the schedule for each person in the class. 3. A program that gives someone direc<ons from your classrom to any other classroom. 4. A control program that works for each person in the class and does the reuqired steps for each person. © Taka Wang, 2017 13
  • 14. ! You would probably post direc2ons to go from this classroom to the other classrooms and then tell everyone in the class, I have posted the loca.ons of the classes following this in the back of the room, as well as the loca.ons of the other classrooms. Please use them to go to your next classroom. © Taka Wang, 2017 14
  • 15. 1. Giving explicit direc+ons to everyone. 2. Giving general instruc+ons and then expect the each person will figure out how to do the task individually. ( delega+on) © Taka Wang, 2017 15
  • 17. 1. 2. ( ) 3. © Taka Wang, 2017 17
  • 18. 1. Conceptual: domain concepts What am I responsibile for? 2. Specifica9on: interface How am I used? 3. Implementa9on: How do I fulfill my responsibili9es?" © Taka Wang, 2017 18
  • 19. (you are telling people what you want, not how to do it.) ( ) © Taka Wang, 2017 19
  • 21. The objects were iden*fied by looking at the en**es in the problem domain. I iden*fied the responsibili1es (or methods) for each object by looking at what these en**es need to do. © Taka Wang, 2017 21
  • 22. Apply Fowler's Perspec/ves • At the conceptual level, an object is a set of responsibili5es. ( ) • At the specifica-on level, an object is a set of methods (behaviors) that can be invoked by other objects or by itself. ( ) • At the implementa-on level, an object is code and data and computa5onal interac5ons between them. © Taka Wang, 2017 22
  • 23. Object-Oriented Approach 1. Start the control program. 2. Instan4ate the collec4on of students in the classroom. 3. Tell the collec4on to have the students go to their next class. 4. The collec4on tells each student to go to his or her next class. 5. Each student: 1. Finds where his next class is. 2. Determines how to get there. 3. Goes there. 6. Done. © Taka Wang, 2017 23
  • 24. Abstract and Polymorphism • Student abstract class, GraduageStudent and RegularStudent classes. • Abstract classes define what other, related, classes can do. Abstract classes act as placeholders for other classes. • Collec;on Student Concept (Abstract) Student (Concrete) • Derived Class (Polymorphism) © Taka Wang, 2017 24
  • 25. 1. Locate the list of shapes in the database. ( ) 2. Open up the list of shapes. ( ) 3. Sort the list according to some rules. ( ) 4. Display the individual shapes on the monitor. ( ) © Taka Wang, 2017 25
  • 26. Object-Oriented Approach (1/2) © Taka Wang, 2017 26
  • 27. Object-Oriented Approach (2/2) 1. ShapeDataBase 2. database object instan0ate collec0on . 3. Collec0on 4. Collec0on 5. Collec0on 6. © Taka Wang, 2017 27
  • 28. • ( ) 1. Concrete Class 2. Derived Class • 1. Collec6on Sor6ng algorithm The object-oriented approach has limited the impact of changing requirements. © Taka Wang, 2017 28
  • 29. 1. 2. ( depend on interface, not implementa4on) 3. The internals of an object are unknown to other objects. ( < >) © Taka Wang, 2017 29
  • 30. Take away 1. 2. ( ) 3. OO 4. (placeholder and delega5on) 5. ( ) © Taka Wang, 2017 30
  • 31. Thank you1 1 ( ) © Taka Wang, 2017 31