CSCE 315 Lecture 10

From Notes
Jump to navigation Jump to search

« previous | Friday, February 10, 2012 | next »


Information Hiding

  1. Identify areas that are likely to change
  2. Create clasess for each of those items
  3. Limit connections to that class and/or create an interface that's unlikely to change

Keep Coupling Loose

  • Relations to other classes/routines
  • Small size (fewer parameters and methods)
  • Avoid global variables
  • Keep it flexible

Types of Coupling

  • Data-Parameter (good)
    • Data passed as parameter lists
    • Primitive data types
  • Simple-object (good)
    • Module instantiates that object
  • Object-parameter (meh)
    • Object 1 requires Object 2 to pass an Object 3
  • Semantic (bad)
    • One object makes use of other modules or knowledge about other modules
    • ex: Module 1 passes a control flag to Module 2,Module 2 uses global data that Module 1 modifies

DESIGN PATTERNS

Common software patterns to outline design