-
Designing with Reuse in Mind
- Objects can be reused in different systems, and code should be written with reuse in mind.
- This is where much of the thought is required in the design process.
-
Designing with Extensibility in Mind
-
Making Names Descriptive
- Following a naming convention for your classes, attributes, and methods is a similar subject.
- Making names descriptive is a good development practice that transcends the various development paradigms.
-
Abstracting Out Nonportable Code
- If you are designing a system that must use nonpotable, you should abstract this code out of the class.
-
Providing a Way to Copy and Compare Objects
- How objects are copied and compared.
- You must make sure that your class behaves as expected. and this means you have to spend some time designing how objects are copied and compared.
-
Keeping the Scope as Small as Possible
- Keeping the scope as small as possible goes hand-in-hand with abstraction and hiding the implementation
- Is to localize attributes and behaviors as much as possible.
-
A class should be responsible for itself
- The class design guideline that all objecs should be responsible for acting on themselves whenever possible.
- Here is that the call is identical; the context of the shape dictates how the system reacts.
-
Designing with Maintainability in Mind
-
Using Iteration in the development Process
- Using an iterative process is recommended.
- Create the code in small increments and then build and test it at each step.
- This testing process is not simply confined to coding.
-
Testing the Interface
- STRUBS: The minimal implementations of the interface.
- The implementation is nor necessary at this point.
- When the interface is complete and the implementation is under development , the database can then be connected and the stubs disconnected.
- As you find problems with the interface design, make changes and repeat the process until you are satisfied with the result.
-
Using Object Persistence
-
Serializing and Marshaling Objects
- We have already discussed the problem of using objects in environments that were originally designed for structure programming.
-
Primary storage devices
- Flat file system: You can store an object in a flat file by serializing the object. This has very limited use.
- Relational database: Some sort of middleware is necessary to convert an object to a relational model.
- OO database: This may be more efficient way to make objects persistent, but most companies have all their data in legacy systems.
-
Designing Error Handling into a Class
-
Documenting a Class and Using Comments
- The topic of comments and documentation comes up in every programming books and article, in every code review.
- Many people have said all this before.
- One of the most crucial aspects of a good design, whether it's a design for a class or something else, is to carefully document the process.
-
Building Objects with the intent to Cooperate
- When designing a class, make sure you are aware of how other objects will interact with it.
- This is a fact in the life of a class.
-
Designing Robust Constructors (and Perhaps Destructors)
- A constructor should put an object into an initial, safe state.
- You also need to make sure the object is constructed properly in the default condition.
- The destructors include proper clean - up functions. This clean - up pertains to releasing system memory that the object acquired at some point.
-
Identifying the Public Interfaces
-
Minimum Public Interface
- Makes the class as concise as possible.
- The goal is to provide the user with the exac interface to do the job right.
- Creating a class is a business proposition, and as with all steps in the design process, it is very important that the users are involved with the design.
-
Hiding the Implementation
- Has already been covered in great detail.
- A class is most useful if the implementation can change without affecting the users.
-
Modeling Real - World Systems
- One of the primary goals of OOP is to model real-world systems in ways similar to the ways in which people actually thinks
- Designing classes is the object - oriented way to create these models.
- When creating classes, you should design them in a way that represents the true behavior of the object.