Software development has become quite a hot topic of interest over the past few decades. However, it is only recently that the development of software has kicked up a notch due to the full blown use of computers and other mobile devices.
The point is not to create software anymore but to create the best of them all. This is a bit harder than most people can imagine but if you can get the design done well then you can be sure that you are on the right track.
There are some software design principles that every developer needs to learn to make sure they are doing it right. Here are some of the most basic principles to be employed:
Basic software design principles
• Open Close Principle (OPC)
Basically this principle dictates that software entities should always be open for extension but closed for modification.
These entities could include the likes of classes, modules, functions, libraries, packages etc. For instance, if you have a library with a set of classes you may want to extend it but not change the code that had already been written.
• Interface segregation principle
Do not depend upon interfaces that you do not use.
According to this principle, designers should take good care when writing their interfaces. The most important thing is to ensure that as a designer, you add only the methods that are meant to be there.
If unnecessary methods are added, the classes that will be implementing the interface will have to implement those methods too.
Interfaces that contain methods that are not specific to it are known as fat or polluted interfaces. These ones should be avoided at all costs.
Again, a client should not be forced to depend on those interfaces that they rarely use.
• Principle of dependency inversion
High level modules should never depend on the low level modules but rather both should be dependent on abstractions.
These abstractions should also not depend on details but rather the details depending on the abstractions.
In other words, according to this principle, high level modules should be decoupled from the low level ones introducing a layer of abstractions between the low level and high level classes.
Moreover, there is an inversion of dependency according to this principle.
Instead of writing the abstractions on basis of details, the details should be the ones based on the abstractions. This is a very important software design principle that is often forgotten for no reason.
• Single responsibility principle
According to this principle, there should be only one reason to change for a class.
The principle states that if a designer has two reasons to change for a class then the functionality has to be split into two classes.
Each class will then be handling one responsibility only.
If changes have to be made in a class that has more than one responsibility, the end result is that the functionality of other classes is also affected.
Basically, software design need not be super complicated as long as you follow the rules and you have a workflow.
The aforementioned are the most basic principles for designing functional software.
Following these principles will ensure that use of the software is effective and changes can be made in a straightforward way. You will not have to start all over again when you have to make a slight change in the design.