SlideServe
Menu
Préférences
© SlideServe · v2026

Class and Method Design

margo avatar
19 diapositives · 368 Views · Jul 16, 2014

This chapter explores critical concepts in low-level or detailed design, emphasizing the importance of understanding pre-existing classes and the necessity of some code for instantiating new classes. It defines coupling, method cohesion, and connascence as vital criteria in evaluating design quality. Various levels and types of coupling and cohesion are discussed, alongside the significance of method specifications. Designers are encouraged to optimize designs, create constraints, and use contracts to foster collaboration among modules and ensure robust system architecture.

Class and Method Design - slide 1
01 / 19Class and Method Design
1 / 17

Télécharger la présentation

Class and Method Design
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Class and Method Design Chapter 14

  2. Key Concepts • Low-level or detailed design is critical despite libraries and components • Pre-existing classes need to be understood and organized • Some, if not all code, is generally still needed to instantiate new classes

  3. DESIGN CRITERIA

  4. Coupling • Interdependency among modules • Interaction coupling through message passing

  5. Level Type Good No Direct Coupling Data Stamp Control Common or Global Bad Content or Pathological Types of Interactive Coupling

  6. “Single-mindedness of a module” Method cohesion Class cohesion Generalization/specialization cohesion Cohesion

  7. Types of Method Cohesion Level Type Good Functional Sequential Communicational Procedural Temporal or Classical Logical Bad Coincidental

  8. Types of Class Cohesion Level Type Good Ideal Mixed-role Mixed-domain Worse Mixed-instance

  9. Creating the need to change another module as a result of changing one Minimize overall connascence Minimize across encapsulation boundaries Maximize within encapsulation boundary Connascence

  10. OBJECT DESIGN ACTIVITIES

  11. Additional Specification • First review the current set of models • Sufficient but only necessary classes to solve problem • No missing attributes or methods • No extraneous attributes or methods • Examine visibility

  12. Signatures for each method • Name of the method • Parameters or arguments to pass • Type of value the method will return to the calling method

  13. Identify Opportunities for Reuse • Patterns • Framework • Class libraries • Components

  14. Method Name: Class Name: ID: Clients (Consumers): Associated Use Cases: Description of Responsibilities: Arguments Received: Type of Value Returned: Pre-Conditions: Post-Conditions: Simple Contract Format

  15. METHOD SPECIFICATION

  16. Syntax • No formal syntax specification • General information • Events • Message Passing • Algorithm Specification

  17. Structured English

  18. (Get CD-info module) Accept (CD_title) {Required} Accept (CD_artist) {Required} Accept (CD_category) {Required} Accept (CD_length) Return Pseudocode Example

  19. Summary • Translating the basic elements of OO analysis into design requires attention to prevent difficulties and conflicts in execution. • Coupling, cohesion, and connascenceare proposed for criteria for evaluating design. • The designer will look for opportunities to optimize the design, will create constraints and contracts, and will specify methods.