| | | | | |

Concept of Proper Type

  • Type should be responsible for its own data
    • keep data protected from client tampering
    • keep data protected from other programs
  • Type should be responsible for its own behavior
    • document behavior
    • make behavior available to clients
    • implement behavior separately out of public view
  • Type should be responsible for its own existence
    • when a client needs a variable of proper type, asking for it should be enough
    • when a client is finished with a variable, it should go away peacefully

    C strings fail on all counts


| | Top of Page | 3. C Strings, Proper Type, and String Objects - 5 of 17