posts - 37,comments - 7,trackbacks - 0

1. No varible should hold a reference to a concrete class.
      If you use new, you'll be holding a reference to a concrete class. Use a factory to get around that.

2. No class should derive from a concrete class.
      If you derive from a concrete class, you're depending on a concrete class. Derive from an abstraction, like an interface or an abstraction class.

3. No method should override an implemented method of any of its base classes.
      If you override an implented method, then your base class wasn't really an abstraction to start with. Those methods implemented in the base class are meant to be shared by all your subclasses.

posted on 2005-08-12 09:42 Dave 阅读(87) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问