Would you agree this is the definition of a PHP framework?

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 :smile:

Where?

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?

[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?

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?

1 Like

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.

Scott

Bob does NOT say they are the same thing. Not at all.

In this article

http://blog.8thlight.com/uncle-bob/2014/05/01/Design-Damage.html

Bob is talking about SoC and never mentions once SRP or the word responsibility.

In this article

http://blog.8thlight.com/uncle-bob/2014/05/08/SingleReponsibilityPrinciple.html

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!

Scott

All of the code that you reference in the article you linked to is executed after control is handed off to the framework, by the framework itself. The amount of code required to call the framework is very minimal. Regardless, none of that implies you have to write no code, because you obviously have to write some code to call the framework.

@tony_marston. Here’s the output of PHPMD (PHP Mess Detector) for your default_table class:

http://pastebin.com/CriTBUrF

What you might find particularly interesting are the lines:

/home/tom/Downloads/radicore/std.table.class.inc:7      The class Default_Table has 8961 lines of code. Current threshold is 1000. Avoid really long classes.
/home/tom/Downloads/radicore/std.table.class.inc:7      The class Default_Table has 342 public methods and attributes. Consider to reduce the number of public items under 45.
/home/tom/Downloads/radicore/std.table.class.inc:7      The class Default_Table has 110 fields. Consider to redesign Default_Table to keep the number of fields under 15.
/home/tom/Downloads/radicore/std.table.class.inc:7      The class Default_Table has 169 methods. Consider refactoring Default_Table to keep number of methods under 10.
/home/tom/Downloads/radicore/std.table.class.inc:7      The class Default_Table has an overall complexity of 1585 which is very high. The configured complexity threshold is 50.

and the multiple occurrences of:

The method getData_serial has a boolean flag argument $unbuffered, which is a certain sign of a Single Responsibility Principle violation.
 The method reset has a boolean flag argument $keep_orderby, which is a certain sign of a Single Responsibility Principle violation.

..etc

none of that implies you have to write no code, because you obviously have to write some code to call the framework.

Agreed. But the amount of code should be very small, and in a REALLY good framework this code would actually be generated for you by the framework itself, just as it is in RADICORE.

[citation needed]. Sorry this just isn’t true… and by no metric is radicore a “really good” framework.

edit: Whether it’s generated for you or not is 100% irrelevant. I’d argue that if code is structured in such a way that it can be “generated for you” then it’s poorly designed and likely breaking DRY. How similar is this generated code? If it’s generated then i’m going to assume very… breaking DRY.

They use the two terms in the same article without saying that the two terms are different, which confirms that they have the same meaning. That is not a big leap, it is a reasonable interpretation.

They both talk about breaking a program down into smaller units such as “sections” or “modules”. Both of those Wikipedia articles specifically use the word “class”. It is true that a “section” might be something like the Presentation/GUI layer in the 3-Tier Architecture which can be broken down into a separate Controller class and a View class, but that simply means that the smallest unit is still a class.

As for your Java examples, they are irrelevant as this is a PHP group, and everybody knows that PHP and Java are different languages which work differently.

When the processing of business rules for a database table needs to change. Is that simple enough? Bear in mind that I do not try to reclassify “business rules” into different categories so that different rules go into different classes. Even Robert C. Martin never suggested that.

You should also remember that my Default_Table class is an abstract class which is inherited by every one of my 300+ Model classes. Each of these concrete classes does not need to contain code for any method except for when it needs to override the default behaviour, in which case all the developer has to do is copy in the relevant customisable method (with a “cm” prefix) into which he can then insert code. Each concrete class therefore contains only a small number of methods, about 6 on average.

Sorry, what? So any article that uses two different terms without explicitly stating they are different means they are the same?

So by this definition:

Gravity or gravitation is a natural phenomenon b

Gravity is a natural phenomenon and all natural phenomenons are gravity. It doesn’t state anywhere that they’re not the same!! Do you even think before you type? You’re so far down this avenue of insanity you’ve lost all perspective.

https://en.wikipedia.org/wiki/Object-oriented_programming

You seem again to be making a distinction which isn’t there. They are two programming languages. We’re discussing OOP principles and the principles apply to OOP, not to a specific language. Try again. In PHP we build the GUI using template engines and form classes. I can use DomDocument, DomElement and other related classes to build the HTML. This would still follow SoC. However, if I merged the code for the template engines, form classes and DOM manipulation it would violate SRP.

It’s incredibly vague. By this definition I could removed all the methods from the class and still use this definition or I could apply it to this class:

class BusinessRules {
 public $exists = false;
}

Also it admits to breaking SRP:

If any of the business rules change, the class needs to change. How many business rules are there? Well it doesn’t matter because you specifically said rules. If we were following SRP, each rule would have its own class.

You may not think so, but both my previous and current business partners, and the customers who use it on a day-to-day basis to conduct their business, would disagree with your opinion. THEIR opinion is much more valuable to me than yours, so you might as well keep your opinion to yourself.

Each of the 2,500+ transactions in my application has its own transaction script, as described in http://www.tonymarston.net/php-mysql/infrastructure.html#component.script, which looks like the following:

<?php
$table_id = "person";                      // identify the Model
$screen   = 'person.detail.screen.inc';    // identify the View
require 'std.enquire1.inc';                // activate the Controller
?>

Each script therefore specifies a unique combination of Model, View and Controller, therefore there is no violation of DRY.