It is implied. If you have to write vast amounts of code in order to pass control to the framework, then it is YOU who are in control and not the framework.
Oh tony, come on! Stop this nonsense, please. Context! âCarâ and âAutomobileâ can be used interchangeably. Yet âTrain Carâ and âAutomobileâ are not the same. Shocking!
I point you again to:
and
Oh look, they both use the word âThermodynamicsâ but they mean different things. The principles SRP and SoC could be called First Law of Concerns and Second Law of Concerns, the name they have been given is 100% irrelevant, itâs just a short hand way of describing the concept they use the same words but describe different concepts. Iâm not sure why you struggle with this so much.
Bolded for emphasis:
The terms SRP and SoC are just labels for the concepts they describe. The fact they happen to use synonyms has no bearing on the concepts themselves.
This is your thought process here: Concept X has a name with a synonym for concept Y, therefore Concept X and Concept Y are the same thing.
We say âBig Bang Theoryâ. Big is a synonym for âLargeâ, That doesnât mean Big Bang Theory and Large Hadron Collider mean the same thing despite them both using the words âbigâ and âlargeâ. This is basically the exact argument you are making!
I know why Tony struggles with it so much. Because, if he didnât and would agree that SoC and SRP are two different concepts, then it would mean he would have to agree his 9000 line class is actually breaking SRP.
If you are âSeparating your Concernsâ into modules it doesnât necessarily mean you are implementing âSingle Responsibility Principleâ. I could have a 100 modules all doing the same thing just called different names. Technically I have followed SoC (poorly) but not SRP. They are two different things although if you are following them correctly there should be an overlap.
Each Model class IS as small as possible as it is only responsible for the business rules associated with a single database table. It does not contain any Controller logic, or View logic or Database logic so it does not contain any code which should be in a different object. In that respect the size is perfect - nether too big nor too small. To break it up into artificially smaller units would decrease cohesion, increase coupling and decrease readability. That would not be a good idea.
This clearly states that when measuring software quality that any coupling brought about by inheritance is totally irrelevant and can be ignored.
I can only repeat what I said earlier - the coupling which exists when one object calls another is totally different from the so-called coupling which exists when one class inherits from another. When measuring software quality all inheritance coupling is irrelevant and can be ignored. Just because the word âcouplingâ is used in two different contexts does not prove that they mean the same thing.
The word âthermodynamicsâ has nothing to do with a discussion on âresponsibilityâ and âconcernâ, so stop going off at a tangent. SRP and SoC are NOT different, so stop wasting your time in trying to convince me otherwise.
[quote=âTomB, post:219, topic:191138â]
tony_marston404:
I qualified that statement with that is universally accepted by all programmers. Just because one group produces a piece of paper with âbest practicesâ as its title does not mean that everyone else immediately falls into line. Different groups have their own idea of whatâs best for them.
Thatâs simply not true though is it. Nobody apart from you is arguing about the definitions of these terms.[/quote]
If you bothered reading what has been published on the internet you would see that for every opinion there are numerous differing opinions. There is no single opinion which is universally accepted as the only opinion which is allowed to exist (except in the minds of extremists like you) so I am exercising my God-given right and choosing my OWN opinion.
Who are YOU to say who is qualified to express an opinion and who is not? The fact that my opinion is different from yours does not automatically make it wrong.
Saying that I have broken SRP simply by counting the number of methods is unscientific and therefore unacceptable. Each Model class is responsible for the business rules associated with a single database table, so it DOES follow SRP.
I totally disagree with everything he said in that article as it goes far beyond what he said in http://blog.8thlight.com/uncle-bob/2014/05/01/Design-Damage.html and http://blog.8thlight.com/uncle-bob/2014/05/08/SingleReponsibilityPrinciple.html in which he clearly states that separating the code which is responsible for GUI, business rules and database is all that is required to produce a âgoodâ design. By applying SRP in an extreme way you will end up with a system which is comprised of classes with a single method and methods with a single line of code. Is that your idea of perfection??? I have seen this stupid idea put into practice, and it resulted in a library for sending emails which contained over 100 classes, most of which fitted the single-method-single-line-of-code pattern. Now THAT is what I would call an unmaintainable mess!
I prefer to go along with Tom DeMarco who, is his book Structured Analysis and System Specification said the following
It is a question of balance, of trade-offs. Not only do you have to know when to apply a principle, you also have to now when to stop. That is the difference between us - I am a moderate, so I know when to stop. You, on the other hand, are an extremist, which means that you will only stop when you can go no further, even if it means that you throw yourself off a cliff just like all the other lemmings.
Yes they do and yes I have.
The article which YOU quoted to reinforce this point clearly says that inheritance coupling should not be used as a measure of software quality.
I am not the one who is stretching an interpretation of these principles to their limits. If you bothered to read what I wrote you would clearly see that I am trying to follow moderate and reasonable interpretations of these principles which I take to a certain point and then stop. It is you (and others like you) who are attempting to apply these principles further and further with even more ridiculous and extreme interpretations.
My code follows the principles of OOP (the original principles, not the modern extremist ones). It is correctly layered according to what Robert C. Martin wrote on SRP/SoC. It has high levels of cohesion, low levels of coupling, high levels of code reuse and is readable and maintainable. It may not be âperfectâ in your eyes, but to most people this would be âgood enoughâ.
I do not redefine any of these programming principles, I simply use a moderate interpretation instead of an extremist one.
It follows my moderate interpretation of those programming principles. The fact that you choose to interpret those same principles in a more extreme fashion does not automatically mean that my interpretations are wrong and therefore invalid.
My abstract class, which is inherited by every Model class in my application, contains all the methods necessary to provide default behaviour for every Model class and allows it to communicate seamlessly with every Controller, View and Data Access Object. It also contains empty methods into which the developer can insert code to override the default behaviour. In that respect it is perfect. The fact that you cannot envisage ever having a class of that size simply means that you lack both vision and experience as you obviously have never worked on an enterprise application which had to deliver the same level of functionality and flexibility.
You are presenting it as THE definition and not one of the possible definitions. There is no single definition of OOP or any of the principles involved in OOP which has not been defined and redefined many times over by different people or different organisations. There is no single definition of anything in OOP which is universally accepted as the ONLY definition, so stop trying to tell me otherwise.
You are the one being nonsensical. I am discussing several articles which use the terms âresponsibilityâ and âconcernâ to man the same thing, and you keep trying to derail the discussion by bring in irrelevant and unconnected words.
Rubbish! Both SRP and SoC talk about how to break a monolithic piece of code into more manageable modules, each with a single âconcernâ or âresponsibilityâ so it that respect they mean EXACTLY the same thing as they produce EACTLY the same result.
I agree that âBig Bang Theoryâ and âLarge Hadron Colliderâ do not mean the same thing. That is because âbigâ and âlargeâ are adjectives whereas âconcernâ and âresponsibilityâ DO mean the same thing because they are both nouns.
I am not struggling I am merely refusing to give in to a preposterous argument.
I will NEVER agree that these two principles are different for the simple reason that when applied to the same piece of monolithic code they will produce the same result.
And I linked you to wikipediaâs page where it explains that it is a tertiary source.
Please stop taking me out of context.
Once again itâs Tony marson saying âThe definitions are wrong!!!â without anything to back up his claims. Just stop.
More avoiding the question⌠the question you were asked was âis your Default_Table class perfect or âgood enoughâ?â You didnât answer it.
Tony stop throwing around the words moderate and exterimist, it doesnât fit at all. You have stretched terms so far beyond their original definition they lose all meaning, this is in no way âmoderateâ.
So now it matters if itâs a noun or an adjective, ok by that logic âPlay Groundâ and âDumping groundâ are the same thing because they both use the same noun. Please stop this nonsense, itâs getting ridiculous.
Space craft/Hover craft, crash barrier/barrier reef, computer chip/fish & chips⌠the examples are endless.
So what? It is the primary source for most people as it comes at the top of the list in every search engine.
Then read what I wrote, especially the bit that says âin that respect it is perfectâ.
Those two terms DO fit. My interpretation of those principles is moderate and reasonable as I go so far and then stop. I do not stretch those interpretations to mean something extra. It is YOU who are stretching the meanings in order to provide unreasonable, immoderate and extreme interpretations.
To a reasonable person SRP and SoC mean the same thing as they were designed to produce the same results. Only an extremist would say otherwise.
And so is your capacity for including irrelevant arguments. The two terms under discussion are âresponsible forâ and âconcerned withâ which every reasonable person would consider to mean the same thing.
If you have to write large volumes of code before you hand control over to the framework, then how can you say that the flow of control is dictated by the framework?
Thatâs not what a primary source is! Are you really arguing with the definition of âprimary sourceâ now?
You appear to lack expertise in exactly everything!
How would you improve it? Making it smaller?
[citation needed]
Again, you;re inferring this by stretching the original definition to the point it becomes meaningless.
You capacity for misunderstanding is huge isnât it?
Do you know what an analogy is? I donât think you do. By your logic âPlay groundâ and âdumping groundâ are the same thing because they both use the same noun.
If youâre going to make this argument you need to move away from âBUT THEY BOTH USE THE SAME WORDâ as I said itâs like saying âLarge hadron colliderâ and âbig bang theoryâ are the same because they both use the work âBigâ.
Stop this nonsensical avoiding the question. Your entire argument is dead. You need to prove that SoC and SRP are the same thing. Saying âThey use synonymsâ is an invalid argument because it ignores the fact that SRP and SoC are labels for concepts the words used to name these concepts is irrelevant. We could rename âSRPâ to âRevenge of Catsâ and SoC to âThe Kitten Parlourâ, it doesnât make any difference to the discussion as long as everyone knows the new name. In fact, the only reason we have these labels is so that in discussions like this we can quickly and convey the concept weâre describing. Where that breaks down is where uneducated/unqualified people such as yourself donât understand the concept being described by the label.
If it is already perfect then how could I possibly improve it? Making it smaller by removing functionality would not really be an improvement now would it?
Any reasonable person would say that both of these descriptions talk about breaking down a programâs functionality into separate sections, modules or classes, so when either of these principles is applied to the same piece of monolithic code then the results would be the same. If the results are the same then surely the concepts are the same? How could you possible class this interpretation as being âunreasonableâ or âstretching the original definition to the point it becomes meaninglessâ?
I have already. I have pointed you to several articles, even ones written by Robert C. Martin, which say they are the same thing, so stop saying that they are not.
Ok then your argument about code being âgood enoughâ is 100% moot.
Youâve provided articles that contain both terms, nothing else. Itâs a big leap to suggest this means theyâre the same thing.
One talks about modules one talks about classes. This is a clear distinction as a module can be a group of classes. As has been explained to you repeatedly, SoC refers to a large section of code e.g. a module which can be fulfilled by multiple classes. For example, in Java we use the Swing library for GUIs. The GUI is a concern, to make this GUI I need to use classes such as JFrame, JTextField, JLabel, JButton, ActionLister, etc. I can also write my own components to use. All of these classes are used together to fulfil a concern.
SRP states that each class should have its own responsibility. In the example above the JTextField class has a single responsibility of displaying a Text Field on the screen. This can be used as part of the GUI concern. Again, weâve explained this a dozen or more times.
Combining the code from all the classes, JLabel, JTextField, JButton and JFrame into one class would still fulfil SoC as itâs all GUI code but not SRP because the single class now has more than one responsibility (the code for displaying a label, the code for displaying a button, the code for displaying a text field and the code for displaying a window) violating SRP.
Iâm bored of explaining this so lets go back to the topic at hand and ignore these definitions. Answer this: What is the single reason to change for your Default_Table class?
SoC isnât about a monolithic piece of code. It talks about a whole large program or application and separating that program into sections or layers, so that one area concerning certain aspects of the program can be changed and possibly reused apart from the other aspects of the program.
SoC and SRP are related, but are most definitely NOT the same. If they were, then it wouldnât be necessary to have two distinct Wikipedia articles explaining the two related but different concepts.
You keep saying other people think the same way as you about it, yet you have not one source from the Internet, where that is proven. Find one article, where the author says they are the exact same concepts and mean the exact same thing. You canât. So, that must mean you are wrong and you are.
Bob is talking about SRP and he goes on to explain âwhat a reason for change isâ and it being âpeopleâ. The reason for change come from the people responsible for the functioning of that part of the application.
Well, Iâll end this argument now. Since you are the only one who determines a need for a change in your ugly, antiquated, beast of a 9KLoC monster class, I can safely say, it follows SRP. Have fun with it Tony, it is all yours!