In these 2-3 years, many projects I see, such as Qihahaga Open Source C # CMS, continuous and non Classes in the form of continuous interface . Why? Is there any good reason? TDD? joke? A design pattern? ...
Its main reason is that it makes the technology easy. This in turn allows the software to have more flexibility and it is easy to reuse and reconnect the existing code. For example, where it is useful, various types of unit tests (as you have been mentioned), but are also included among other types of "regular" code reuse.
A simple example:
Say that you have a method that calculates EPOOK salary. As part of your signature, it accepts the object that calculates their benefits, an example of the benefit collector says:
is calculated ... ( BenefitCalculator bc, ...) Basically, there is only one class profit collector in your design but later, it has come to know that you need more than one category, eg . Because different algorithms (possibly to support different countries, or because the algorithm is considered user-configurable ... should be used) in different parts of the software. In that case, instead of the existing implementation of the benefit collector it means to make Bloat a new class (SAS), e.g.
P>, you are very bad , Because you can not implement different implementations if you use< P> You can apply the interface to all classes.is calculated (... IBenefitCalculator bc, ...)
This is actually a special case of "loose coupling": as much as possible the demand from other parts of the code. In this case, do not demand a certain class; Instead, just ask for some methods, which is an interface.
Comments
Post a Comment