SlideShare una empresa de Scribd logo
1 de 35
Seminar 4: Wrapping up Programming Paradigms [The Paradigms - Group 2]
2 Previous Seminar
3 This Seminar
Assigning Responsibilities Responsibilities includes the behaviors exhibited by a class or the knowledge which a class holds. Knowledge Behaviors
Assigning Responsibilities Main Task Use of scenarios androle play for the discovery of responsibilities. Scenario: Withdrawing cash from ATM Actor Customer Receipt Printer Class Actor ATM
Assigning Responsibilities “Focus on What the classes need to do, not how they do it.”  Asking how a class behaves will result deriving false semantic distinctions which disallow the use of polymorphism.
Assigning Responsibilities Let’s get it started… Responsibility Detection Guidelines
Assigning Responsibilities Responsibility Detection Guidelines Brainstorm to identify a set of candidate responsibilities for the core classes.  Strive for inclusion of responsibilities  rather than exclusion
Assigning Responsibilities Responsibility Detection Guidelines Think in a more complex way will have most responsibilities listed in one of two classes. Account Class Deposit  Class BankCard Class Insignificant to reuse Insignificant to reuse Inflexible to reuse BalanceInquiry Class Withdrawal Class Insignificant to reuse Insignificant to reuse
Assigning Responsibilities Responsibility Detection Guidelines Reduce classes to “records”, which they simply know what information they hold. Interacts Aim to have distinct role for each classes to encourage reuse!
Assigning Responsibilities Responsibility Detection Guidelines Abstract related classes which have common responsibilities to build hierarchies of classes. All of them execute a final transaction
Assigning Responsibilities Responsibility Detection Guidelines Abstract class make clear and cohesive responsibility assignment and take advantage ofuse polymorphism!
Assigning Responsibilities Responsibility Detection Guidelines Experiment with different configuration of classes or assignments of responsibilities. Changing the CRC cards are easier than changing the code later in the project.
Assigning Collaborators Guidelines Using Scenarios and Role Play Using Class Hierarchy Using Dependencies Using Client, Servers and Contract Map
Use Scenarios and Role Play Make a list of scenarios using the CRC core classes Fill in the cards as you role play the different scenario Assigning Collaborators Many practitioners uses role play and scenarios before listing the responsibilities for each classes
Using Class Hierarchy Hierarchy is a signal for collaboration Look up a hierarchy to class that is more abstract responsibilities Look down a hierarchy to carry out more specialize responsibilities Look for class that share same responsibilities Assigning Collaborators
Example 19 Assigning Collaborators Transactions Withdrawal Deposit BalanceInquiry ExecuteFinancialTransaction() ExecuteFinancial Transaction() ExecuteFinancial Transaction() ExecuteFinancial Transaction()
Using Dependencies A class that depend on another for information Assigning Collaborators When dealing with dependencies think of encapsulation
Example 21 Assigning Collaborators Transaction ReceiptPrinter ExecuteFinancial Transaction() printReceipt()
Using Client, Servers and Contract Map Client is a class that requires service from another Servers are providers for the services Assigning Collaborators A Class can be a server and a client in a system
Using Client, Servers and Contract Map Contracts can be used to track client server collaboration  Using role play can rapidly mapped out the collaboration Assigning Collaborators Alternative in using client server would be identifying of message passing in the system
Example of Contract Assigning Collaborators Contract 1: Access and Modify Account Balance Server: Account Client: withdrawal, Transfer, Deposit, Inquiry Description: Defines the manner in which account can be accessed or modified
Warning!!!! Collaborations can be hard to spot before role play Try to avoid class with the same responsibilities
Guidelines Look for “Kind-of” relationship Do not confuse “Part-of ” with “Kind-of” Name Key Abstractions Look for Framework
Look for “Kind-of” relationship Find classes that  Share Same Responsibilities Share Same Behavior Belong Together
Example Transactions Withdrawal Deposit BalanceInquiry # completeTransaction() # completeTransaction() # completeTransaction() # completeTransaction() 29
Do not confuse “Part-of ” with “Kind-of” Part-of DO NOT: Shared same behavior A class maybe part of another class A and also a kind of another class B
Name Key Abstractions Name a key abstraction class identify abstract classes that do not draw on colloquial ways of talking about system diagram A single class that have choices depending on situation
Example
Look for Framework This take advantage of successful framework rather then inventing them Using of analysis pattern to help looking for your own frameworks “Party” Pattern
34 The CRC Card Technique
Thank you! End of Presentation

Más contenido relacionado

Destacado

Tugas assholihati imah
Tugas assholihati imahTugas assholihati imah
Tugas assholihati imah
Ifmach Moetz
 
Eragiketak zatikiekin
Eragiketak zatikiekinEragiketak zatikiekin
Eragiketak zatikiekin
burdinkoldo1d
 
Digital technology A.S
Digital technology A.SDigital technology A.S
Digital technology A.S
sarahlambe
 
Teaching note on cash budgeting (1)
Teaching note on cash budgeting (1)Teaching note on cash budgeting (1)
Teaching note on cash budgeting (1)
Saumya Sood
 
What is ‘real’ about my magazine
What is ‘real’ about my magazineWhat is ‘real’ about my magazine
What is ‘real’ about my magazine
sarahlambe
 
New consumer trends 2011 food 2.0
New consumer trends 2011 food 2.0New consumer trends 2011 food 2.0
New consumer trends 2011 food 2.0
margietzo
 
Fotosslidher
FotosslidherFotosslidher
Fotosslidher
G_I_S
 
Prezentācija1 ltv
Prezentācija1 ltvPrezentācija1 ltv
Prezentācija1 ltv
Jose Duarte
 
Collegio rotondi presentation
Collegio rotondi presentationCollegio rotondi presentation
Collegio rotondi presentation
Jose Duarte
 
Presentation1
Presentation1Presentation1
Presentation1
nooch33
 

Destacado (20)

Enterprise IT - between ugly and sexy
Enterprise IT - between ugly and sexyEnterprise IT - between ugly and sexy
Enterprise IT - between ugly and sexy
 
Tugas assholihati imah
Tugas assholihati imahTugas assholihati imah
Tugas assholihati imah
 
Cátalogo Baltic Wood
Cátalogo Baltic WoodCátalogo Baltic Wood
Cátalogo Baltic Wood
 
Eragiketak zatikiekin
Eragiketak zatikiekinEragiketak zatikiekin
Eragiketak zatikiekin
 
Mobile Learning; Beyond the Hype
Mobile Learning; Beyond the HypeMobile Learning; Beyond the Hype
Mobile Learning; Beyond the Hype
 
Воспитание космонавтов продаж - как вырастить продавца в ИТ
Воспитание космонавтов продаж - как вырастить продавца в ИТВоспитание космонавтов продаж - как вырастить продавца в ИТ
Воспитание космонавтов продаж - как вырастить продавца в ИТ
 
Digital technology A.S
Digital technology A.SDigital technology A.S
Digital technology A.S
 
Teaching note on cash budgeting (1)
Teaching note on cash budgeting (1)Teaching note on cash budgeting (1)
Teaching note on cash budgeting (1)
 
Ibm co -yang han
Ibm co -yang hanIbm co -yang han
Ibm co -yang han
 
Camera shots
Camera shotsCamera shots
Camera shots
 
KarmaSnap Benefits For Non Profits
KarmaSnap Benefits For Non ProfitsKarmaSnap Benefits For Non Profits
KarmaSnap Benefits For Non Profits
 
What is ‘real’ about my magazine
What is ‘real’ about my magazineWhat is ‘real’ about my magazine
What is ‘real’ about my magazine
 
New consumer trends 2011 food 2.0
New consumer trends 2011 food 2.0New consumer trends 2011 food 2.0
New consumer trends 2011 food 2.0
 
Zarf
ZarfZarf
Zarf
 
Fotosslidher
FotosslidherFotosslidher
Fotosslidher
 
Prezentācija1 ltv
Prezentācija1 ltvPrezentācija1 ltv
Prezentācija1 ltv
 
Collegio rotondi presentation
Collegio rotondi presentationCollegio rotondi presentation
Collegio rotondi presentation
 
Blog optimization adding google+ author tag
Blog optimization   adding google+ author tagBlog optimization   adding google+ author tag
Blog optimization adding google+ author tag
 
Todorov
TodorovTodorov
Todorov
 
Presentation1
Presentation1Presentation1
Presentation1
 

Similar a Programming Paradigm Seminar 4

Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Aravinth NSP
 
M03 1 Structuraldiagrams
M03 1 StructuraldiagramsM03 1 Structuraldiagrams
M03 1 Structuraldiagrams
Dang Tuan
 
Object oriented software engineering
Object oriented software engineeringObject oriented software engineering
Object oriented software engineering
Varsha Ajith
 

Similar a Programming Paradigm Seminar 4 (20)

Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Chapter 8 ooad
Chapter  8 ooadChapter  8 ooad
Chapter 8 ooad
 
Ooa 1 Post
Ooa 1 PostOoa 1 Post
Ooa 1 Post
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptx
 
Uml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netUml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot net
 
Software System Engineering - Chapter 10
Software System Engineering - Chapter 10Software System Engineering - Chapter 10
Software System Engineering - Chapter 10
 
2 class use case
2 class use case2 class use case
2 class use case
 
Ooad
OoadOoad
Ooad
 
Ooad
OoadOoad
Ooad
 
Oos Short Q N
Oos Short Q NOos Short Q N
Oos Short Q N
 
Applying UML and Patterns (CH1, 6, 9, 10)
Applying UML and Patterns (CH1, 6, 9, 10)Applying UML and Patterns (CH1, 6, 9, 10)
Applying UML and Patterns (CH1, 6, 9, 10)
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
M03 1 Structuraldiagrams
M03 1 StructuraldiagramsM03 1 Structuraldiagrams
M03 1 Structuraldiagrams
 
Object oriented software engineering
Object oriented software engineeringObject oriented software engineering
Object oriented software engineering
 
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPTCS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
 
Modeling Object Oriented Applications by Using Dynamic Information for the I...
Modeling Object Oriented Applications by Using Dynamic  Information for the I...Modeling Object Oriented Applications by Using Dynamic  Information for the I...
Modeling Object Oriented Applications by Using Dynamic Information for the I...
 
Chapter 7 ooad
Chapter 7 ooadChapter 7 ooad
Chapter 7 ooad
 
Fragility in evolving software
Fragility in evolving softwareFragility in evolving software
Fragility in evolving software
 

Programming Paradigm Seminar 4

  • 1. Seminar 4: Wrapping up Programming Paradigms [The Paradigms - Group 2]
  • 4.
  • 5. Assigning Responsibilities Responsibilities includes the behaviors exhibited by a class or the knowledge which a class holds. Knowledge Behaviors
  • 6. Assigning Responsibilities Main Task Use of scenarios androle play for the discovery of responsibilities. Scenario: Withdrawing cash from ATM Actor Customer Receipt Printer Class Actor ATM
  • 7. Assigning Responsibilities “Focus on What the classes need to do, not how they do it.” Asking how a class behaves will result deriving false semantic distinctions which disallow the use of polymorphism.
  • 8. Assigning Responsibilities Let’s get it started… Responsibility Detection Guidelines
  • 9. Assigning Responsibilities Responsibility Detection Guidelines Brainstorm to identify a set of candidate responsibilities for the core classes. Strive for inclusion of responsibilities rather than exclusion
  • 10. Assigning Responsibilities Responsibility Detection Guidelines Think in a more complex way will have most responsibilities listed in one of two classes. Account Class Deposit Class BankCard Class Insignificant to reuse Insignificant to reuse Inflexible to reuse BalanceInquiry Class Withdrawal Class Insignificant to reuse Insignificant to reuse
  • 11. Assigning Responsibilities Responsibility Detection Guidelines Reduce classes to “records”, which they simply know what information they hold. Interacts Aim to have distinct role for each classes to encourage reuse!
  • 12. Assigning Responsibilities Responsibility Detection Guidelines Abstract related classes which have common responsibilities to build hierarchies of classes. All of them execute a final transaction
  • 13. Assigning Responsibilities Responsibility Detection Guidelines Abstract class make clear and cohesive responsibility assignment and take advantage ofuse polymorphism!
  • 14. Assigning Responsibilities Responsibility Detection Guidelines Experiment with different configuration of classes or assignments of responsibilities. Changing the CRC cards are easier than changing the code later in the project.
  • 15.
  • 16. Assigning Collaborators Guidelines Using Scenarios and Role Play Using Class Hierarchy Using Dependencies Using Client, Servers and Contract Map
  • 17. Use Scenarios and Role Play Make a list of scenarios using the CRC core classes Fill in the cards as you role play the different scenario Assigning Collaborators Many practitioners uses role play and scenarios before listing the responsibilities for each classes
  • 18. Using Class Hierarchy Hierarchy is a signal for collaboration Look up a hierarchy to class that is more abstract responsibilities Look down a hierarchy to carry out more specialize responsibilities Look for class that share same responsibilities Assigning Collaborators
  • 19. Example 19 Assigning Collaborators Transactions Withdrawal Deposit BalanceInquiry ExecuteFinancialTransaction() ExecuteFinancial Transaction() ExecuteFinancial Transaction() ExecuteFinancial Transaction()
  • 20. Using Dependencies A class that depend on another for information Assigning Collaborators When dealing with dependencies think of encapsulation
  • 21. Example 21 Assigning Collaborators Transaction ReceiptPrinter ExecuteFinancial Transaction() printReceipt()
  • 22. Using Client, Servers and Contract Map Client is a class that requires service from another Servers are providers for the services Assigning Collaborators A Class can be a server and a client in a system
  • 23. Using Client, Servers and Contract Map Contracts can be used to track client server collaboration Using role play can rapidly mapped out the collaboration Assigning Collaborators Alternative in using client server would be identifying of message passing in the system
  • 24. Example of Contract Assigning Collaborators Contract 1: Access and Modify Account Balance Server: Account Client: withdrawal, Transfer, Deposit, Inquiry Description: Defines the manner in which account can be accessed or modified
  • 25. Warning!!!! Collaborations can be hard to spot before role play Try to avoid class with the same responsibilities
  • 26.
  • 27. Guidelines Look for “Kind-of” relationship Do not confuse “Part-of ” with “Kind-of” Name Key Abstractions Look for Framework
  • 28. Look for “Kind-of” relationship Find classes that Share Same Responsibilities Share Same Behavior Belong Together
  • 29. Example Transactions Withdrawal Deposit BalanceInquiry # completeTransaction() # completeTransaction() # completeTransaction() # completeTransaction() 29
  • 30. Do not confuse “Part-of ” with “Kind-of” Part-of DO NOT: Shared same behavior A class maybe part of another class A and also a kind of another class B
  • 31. Name Key Abstractions Name a key abstraction class identify abstract classes that do not draw on colloquial ways of talking about system diagram A single class that have choices depending on situation
  • 33. Look for Framework This take advantage of successful framework rather then inventing them Using of analysis pattern to help looking for your own frameworks “Party” Pattern
  • 34. 34 The CRC Card Technique
  • 35. Thank you! End of Presentation

Notas del editor

  1. Discovering Candidate ClassesRead Requirements DocumentsUnderline nouns and noun phrasesAdd them to candidate class listBrainstorm to find other potential classesClarifying the ScopeSelecting Core ClassesArchitectural DesignIdentify hot spotsUse appropriate design patternsTake advantage of existing software frameworksEliminate Unnecessary ClassesRemove ghost classesCombine synonyms Distinguish attributes from classes
  2. Discovering Candidate ClassesRead Requirements DocumentsUnderline nouns and noun phrasesAdd them to candidate class listBrainstorm to find other potential classesClarifying the ScopeSelecting Core ClassesArchitectural DesignIdentify hot spotsUse appropriate design patternsTake advantage of existing software frameworksEliminate Unnecessary ClassesRemove ghost classesCombine synonyms Distinguish attributes from classes
  3. Behavior:Do things that meet the demands of the uses of the systemKnowledge: Supply information about themselves
  4. Strive for inclusion of relevant responsibilities rather than exclusion. Don't worry about duplication. Later refine the lists of responsibilities. Name each carefully. Given a set of core classes:Brainstorm to identify a set of candidate responsibilities for the core classes.
  5. Instead of having all responsibilities listed in one or two classes, which is more towards a procedural perspective. Does not take advantage of Polymorphism and encapsulation.ATM example: A tendency might be to give most of the responsibility to the Account class, which becomes a strong, busy "manager" procedure giving commands to relatively weak, ill-defined "worker" classes. Account is probably too inflexible to be directly reused; the other classes are probably too insignificant to be reused. Give each class a distinct role in the system. Strive to make each class a well-defined, complete, cohesive abstraction. Such a class has higher probability of being reused. ATM example: Give class Withdrawal the responsibility "Withdraw Funds", making it potentially useful to any other class needing to do a withdrawal. Give class Account the responsibility "Accept Withdrawal", which will, of course, be carried out by collaborating with Withdrawal. Factoring out complexity also involves identifying specialized behaviors that occurs repeatedly and, as appropriate, spinning off new classes. ATM example: The capturing and responding to user requests might be factored out into a new class Form with a responsibility "ask user for information".
  6. Instead of having all responsibilities listed in one or two classes, which is more towards a procedural perspective. Does not take advantage of Polymorphism and encapsulation.ATM example: A tendency might be to give most of the responsibility to the Account class, which becomes a strong, busy "manager" procedure giving commands to relatively weak, ill-defined "worker" classes. Account is probably too inflexible to be directly reused; the other classes are probably too insignificant to be reused. Give each class a distinct role in the system. Strive to make each class a well-defined, complete, cohesive abstraction. Such a class has higher probability of being reused. ATM example: Give class Withdrawal the responsibility "Withdraw Funds", making it potentially useful to any other class needing to do a withdrawal. Give class Account the responsibility "Accept Withdrawal", which will, of course, be carried out by collaborating with Withdrawal. Factoring out complexity also involves identifying specialized behaviors that occurs repeatedly and, as appropriate, spinning off new classes. ATM example: The capturing and responding to user requests might be factored out into a new class Form with a responsibility "ask user for information".
  7. Build hierarchies of classes. Abstract the essence of related classes by identifying where they have common responsibilities -- where they do the same thing, but do it differently -- same "what", different "how". That is, look for opportunities for the classes to use polymorphism to implement the same responsibility differently. The new parent classes may be abstract classes. That is, no actual objects may ever exist of that type. The abstract class exists to link together similar concrete types of objects. ATM example: Create an abstract class Transaction that is a superclass for Withdrawal, Deposit, etc. It can have an abstract responsibility "execute a financial transaction", that is implemented differently for each subclass
  8. Build hierarchies of classes. Abstract the essence of related classes by identifying where they have common responsibilities -- where they do the same thing, but do it differently -- same "what", different "how". That is, look for opportunities for the classes to use polymorphism to implement the same responsibility differently. The new parent classes may be abstract classes. That is, no actual objects may ever exist of that type. The abstract class exists to link together similar concrete types of objects. ATM example: Create an abstract class Transaction that is a superclass for Withdrawal, Deposit, etc. It can have an abstract responsibility "execute a financial transaction", that is implemented differently for each subclass
  9. The cards are either physical cards or electronic which are both inexpensive to erase. Don’t hesitate to make changes early in CRC cards, than make changes later in the code.
  10. Discovering Candidate ClassesRead Requirements DocumentsUnderline nouns and noun phrasesAdd them to candidate class listBrainstorm to find other potential classesClarifying the ScopeSelecting Core ClassesArchitectural DesignIdentify hot spotsUse appropriate design patternsTake advantage of existing software frameworksEliminate Unnecessary ClassesRemove ghost classesCombine synonyms Distinguish attributes from classes