Recently, a “famous” blogger in the field of programming, yegor bugayenko, published a post on his blog in which he discusses how the single-responsibility principle is a hoax: the most common misunderstanding regarding responsibilities is finding the right grain to achieve. again, probably my fault - it comes from my mathematical extraction.īut given the above definition of the single-responsibility principle, it is clear that there is no mathematical rigor to it.Įvery developer, using their own experience can give a different meaning to the word there should be no space left for interpretation. Well, this is probably a problem with me, but i never thought that a principle should be defined in such a way that two different people can understand it the same way. The dark side of the single-responsibility principle The design that completely adheres to the single-responsibility principle is the following.Īrranging the dependencies among classes as depicted in the above class diagram, the geometrical application does not depend on user interface stuff anymore. Moreover, having more than one responsibility means that every time a change to a requirement linked to the user interface comes, there is a non-zero probability that the classĬould be changed, too. : drawing a rectangle on a gui and calculating the area of that rectangle. to explain the principle, the author uses an example that is summarized in the following class diagram. robert uses a very attractive sentence to define it:Ī class should have only one reason to change.īoom. The single-responsibility principle is one of the most famous of the five. Stands for dependency inversion principleĭespite the resonant names and the clearly marketing intent behind them, in the above principles are described some interesting best practices of object-oriented programming. Stands for interface segregation principle Stands for single-responsibility principle each letter of the word solid refers to a programming principle: uncle bob, collected in the bookĪgile principles, patterns, and practices in c#Ī series of articles that represent the basis of clean programming - the principles are also known as solid. let me explain how.Īs is normal for all the big stories, i think it is better to start from the beginning. well, maybe i found a way to standardize the application of this principle during the development process. every developer is left to their own experiences and knowledge to define what a responsibility is. its definition does not give any rigorous detail on how to apply it. in particular, i thought that the single-responsibility principle was one of the most powerful among these principles, yet one of the most misleading. in my opinion, uncle bob did a great job when he first defined them in his books. I am a big fan of the solid programming principles by robert c.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |