TABLE OF CONTENTS
Class Design
1.
Provide consistent and intuitive class interface.
5
2.
Provide common properties of classes in a base class.
9
3.
Do not expose implementation details in the public interface of the class.
12
4.
Consider providing...
More
TABLE OF CONTENTS
Class Design
1.
Provide consistent and intuitive class interface.
5
2.
Provide common properties of classes in a base class.
9
3.
Do not expose implementation details in the public interface of the class.
12
4.
Consider providing helper classes while designing large classes.
14
5.
Keep the data members private.
18
6.
Provide lowest possible access to methods.
23
7.
Strive for loose coupling between classes.
26
8.
Beware of order of initialization problems.
29
9.
Write unit tests for classes.
31
10.
Avoid low-level code.
34
Object Creation and Handling
11.
Avoid calling virtual functions in constructors.
37
12.
Consider providing factory methods.
43
13.
Make constructor private if there are only static members in the class.
45
14.
Avoid creating unnecessary temporary objects.
47
15.
Prefer creating immutable objects.
52
16.
Consider creating and using null objects.
54
17.
Provide special objects with read only access in the class itself
Less