zoukankan      html  css  js  c++  java
  • snippets from ObjectOriented Thought Process (1)

    Properly constructed classes are designed in two parts—the interface and the implementation.

    Perhaps the most important issue when designing a class is identifying the audience, or users, of the class. for the interface to a class should contain only what the user needs to know.

    One goal regarding the implementation should be kept in mind: A change to the implementation should not require a change to the user's code.

    When designing a class, the rule of thumb is to always provide the user with as little knowledge of the inner workings of the class as possible. To accomplish this, follow these simple rules:

            1.Give the users only what they absolutely need. In effect, this means the class has as few interfaces as possible. When you start designing a class, start with a minimal interface.

            2.Public interfaces are all the users will ever see. You should initially hide the entire class from the user. 

            3.It is vital to design classes from a user's perspective and not from an information systems viewpoint. Too often designers of classes (not to mention any other kind of software) design the class to make it fit into a specific technological model. Even if the designer takes a user's perspective, it is still probably a technician user's perspective, and the class is designed with an eye on getting it to work from a technology standpoint, and not from ease of use for the user.(Important!)

           4.Users are the ones who will actually use the software.

  • 相关阅读:
    day 56
    Windows API 第16篇 GetLogicalDrivers 获取驱动器位掩码
    Windows API 第15篇 GetVolumeInformation 获取磁盘卷(驱动器)信息
    GetCommandLine CmdLineToArgvW
    Windows API 第14篇 DeleteAndRenameFile
    windows API 第13篇 MoveFileEx
    Windows API 第12篇 MoveFile
    _strupr _wcsupr _mbsupr
    复制字符串 _strdup _wcsdup _mbsdup
    windows API 第 11 篇 GetCurrentDirectory SetCurrentDirectory
  • 原文地址:https://www.cnblogs.com/gamix/p/228021.html
Copyright © 2011-2022 走看看