I think Tony had a bad day today. LOL!
I think Tony had a bad day today. LOL!
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:
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:
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.
In article http://people.ucalgary.ca/~far/Lectures/SENG421/PDF/oocross.pdf (which YOU quoted as a reference in an earlier post) it clearly says the following in section A.4
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”]
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.
Post edited by cpradio
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.
I won’t agree to that because it doesn’t.
what the hell are you talking about? You said:
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.
Then you would be violating DRY you bad, bad programmer.
That’s true, that would be another rule though
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.
In characteristic #1 which states
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?
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?
I am not stretching either of these definitions. For example https://en.wikipedia.org/wiki/Separation_of_concerns says the following
In https://en.wikipedia.org/wiki/Single_responsibility_principle it says the following:
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?
Ok. This is where your thinking is a bit off.
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 does NOT say they are the same thing. Not at all.
In this article
Bob is talking about SoC and never mentions once SRP or the word responsibility.
In this article
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!