CIT-73 Home http://www.c-jump.com/CIT73/CIT73syllabus.htm

Chapter 5, Design Guidelines


  1. Week 8, Chapter 5, Design Guidelines
  2. Public Interfaces
  3. Roles of Constructors
  4. Object Reuse
  5. Descriptive Names
  6. Keeping Scopes Small
  7. Maintainability
  8. The development process
  9. Development process stages
  10. Week 8 Reading: pages 71-84

1. Week 8, Chapter 5, Design Guidelines


2. Public Interfaces


3. Roles of Constructors


4. Object Reuse


5. Descriptive Names


6. Keeping Scopes Small


  • Data abstraction and hiding closely relates to the scopes of variables and operations.

  • In view of good design we must pursue the goal of localizing attributes and behaviors as much as possible.

  • This greatly improves debugging, testing, documentation, and extensibility of the entire system.

  • Keeping minimal scopes emphasizes good programming style.

  • Consider:

    
    public class Math {
        int temp = 0;
        public int swap( int a, int b ) {
            temp = a;
            a = b;
            b = temp;
            return temp;
        }
    }
    
    
  • Better:

    
    public class Math {
        public int swap( int a, int b ) {
            int temp = 0;
            temp = a;
            a = b;
            b = temp;
            return temp;
        }
    }
    
    

7. Maintainability


8. The development process


9. Development process stages


10. Week 8 Reading: pages 71-84