Determine how fine the interface should be?

The more details I put into the interface, the less it is reused. On the other hand, the less detail, the more ethereal and useless it becomes. Is there a standard set of recommendations on how to weigh this for different situations?

+4
source share
3 answers

I just co-authored an article on detailing components (size) of components, and one of our conclusions is that there is no easy way to determine “which right”. No, there is no standard set of recommendations.

I can give you a couple of academic links on this subject just in case you are interested:

  • Genero, M., Piattini, M., Calero, C. (eds.): Metrics for conceptual software models. Imperial College Press, London, UK (2005)
  • Shekhovtsov V.A .: On the conceptualization of quality. paper presented at Dagstuhl Conceptual Modeling Workshop, April 27-30, 2008 (preprint on the conference website) (2008)
0
source

I am a big fan of SOLID principles. The self in SOLID leads me to believe that clients should not be forced to implement interfaces that they do not need or use. In other words, if you have an abstract class or interface, then the developer should not be forced to implement parts that they do not need.

Ray Houston wrote a good article about this (looking at a membership provider) here .

+2
source

Consider the human genome as a class.

Each instance (cell object) has all the functions of the genome for it. (Although not all cell objects have access to all functions, with the possible exception of stem cells).

I raise this point because I saw many instances of single classes trying to perform many functions, instead of having multiple classes, each of which performs one function.

This is equivalent to a grain of sand with instructions encoded in it to build a castle. For the development of errors evolution has benefited billions of years. Engineers simply do not have the opportunity or time for this.

0
source

Source: https://habr.com/ru/post/1302558/


All Articles