10 Characteristics of Good Program Design
This is a list of goals that a developer should try and have in their software design. Some goals contradict other ones, but that is where you have to decide what is best for your program.
The main goal in any program should be to minimize complexity. As a developer most of your time will be maintaining or upgrading existing code. If it is a complete mess, then your life is going to be that much harder. Try and avoid those solutions where you use a one line complex solution to replace 20 lines of easy to read code. In a year, when you come back to that code, it will take you that much longer to figure out what you did.
Ease Of Maintenance
This is making your code easy to update. Find where your code is most likely going to change, and make it easy to update. The easier you make it, the easier your life is going to be down the road. Think of it as a little insurance for your code.
So What is loose coupling? It is when one portion of code is not dependant on another to run properly. It is bundling code into nice little self reliant packages that don’t rely on any outside code. How do you do this? Make good use of abstraction and information hiding.
This means that you design your program so that you can add or remove elements from your program without disturbing the underlying structure of the program. A good example would be a plug-in.
Write code that will be able to be used in unrelated projects. Save yourself some time. Again information hiding is your best bet for making this happen.
This refers to having a large number of classes that use a given class. This implies that you are making good use of utility classes. For example you might have a bunch of classes that use the Math class to do calculations.
Low to medium Fan-out
This refers to having a low to medium amount of classes used by any given class. If you had a class that includes 7 or more classes this is considered high fan out. So try and keep the number of classes you include down to a minimum. Having a high fan-out suggests that the design may be too complex.
Simply put, design a system that can be moved to another environment. This isn’t always a requirement of a program, but it should be considered. It might make your life easier if you find out your program does have to work on different platforms.
Leanness means making the design with no extra parts. Everything that is within the design has to be there. This is generally a goal if you have speed and efficiency in mind. A good example of where this might come in handy is creating a program that has to run on a system with limited resources (cell phone, older computers)
Try and standardize your code. If each developer puts in their own flavor of code you will end up with an unwieldy mess. Try to layout common approaches for developers to follow, and it will give your code a sense of familiarity for all developers working on it.