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

I have seen many articles on MVC some of which have a single class for the Model while others (like mine) take out all database access and put it into its own class. I have seen a few that split the Model into smaller classes, but I do not agree with this approach AS IS MY RIGHT!!! Just because some people like multiple classes does not mean that everyone should follow the same design, and I happen to be in the camp that doesn’t.

Considering that the title of this discussion is “Would you agree this is the definition of a framework?” all I have done is agree with the four characteristics documented in https://en.wikipedia.org/wiki/Software_framework and pointed out that my framework has all four characteristics while many of the other so-called frameworks do not.

I do not have a single Controller in my application that has to deal with all possible actions on all possible Models and Views.

I do not have a single View which has to deal with all different types of output - HTML, PDF, or CSV.

I do not have a single Model which has to deal with all the tables in the database.

What I DO have is an architecture where each user transaction, and I have over 2,500, uses a Model (sometimes more than one) a View and a Controller, where each is chosen from a list of possibilities at run time.

  • I have 40 Controllers, one for each Transaction Pattern
  • I have 3 Views, one for HTML output, one for PDF output, and another for CSV output.
  • I have 300+ Models, one for each table in the database.
  • I have 4 Data Access Objects, one for MySQL, one for PostgreSQL one for Oracle, and another for SQL Server.

Each of these components is responsible for (or concerned with) a separate piece of logic in the application so as far as I am concerned this is an acceptable interpretation and implementation of SRP.

Again, Robert C. Martin says Classes should be small and that a 70 method class is too large. He says classes should have few instance variables, you have a class with 50+. You are redefining what SRP means to retrospectively fit it to your existing code. You have redefined it.

And now you’re putting words in peoples mouths again. He said coupling because he means coupling and yes they have different meanings. Once again, you demonstrate you don’t understand coupling which as I’ve said before is the root of most of your misunderstandings as SRP and DI are related to it.

Coupling is when one class or method requires the existence of another to function. With inheritance, the subclass requires the base class. This is a very simple concept. This is tight coupling because there is no way to make the subclass use a different base class without re-coding it.

From the wikipedia page (Because you seem to like it) https://en.wikipedia.org/wiki/Coupling_(computer_programming) :

coupling increases between two classes A and B if:

Ahas an attribute that refers to (is of type) B.
A calls on services of an object B.
A has a method that references B (via return type or parameter).
A is a subclass of (or implements) class B.

See that last point?

Which shows they’re related concepts, not the same. Again, you seem to struggle with nuance.

Because they are related concepts. What you seem to miss is that “Separation of Concerns” is a term with a specific meaning and so is “Single Responsibility Principle”. It’s like saying “First Law of Thermodynamics” and “Second law of thermodynamics” Funnily enough they both use the word “Thermodynamics” yet relate to different principles. The same is true here, you’re focussing far too much on the individual words and ignoring the concepts they describe. You’re saying the first and second law of thermodynamics are the same because the word “thermodynamics” appears on both wikipedia pages. What a nonsensical argument.

While you have a fairly competent grasp of the basics, you have fallen into the same trap that anyone who is self-taught falls into: picking up bad habits and not being aware of alternative (better) approaches because you haven’t been taught them as well as lacking a proper understanding of the underlying theory. It’s all well and good being able to play some chords on the guitar but it doesn’t mean you know anything about how to read sheet music or any of the theory behiind it. Have you ever had any formal training on OOP? I can tell that the answer is a clear no or if you did it was a very introductory level.

While you may have gone to a couple of “training days” which gave you a basic grasp of objects and classes, those of us with degrees did 3 years learning about the nuances of this stuff. I’m currently doing a PhD (While working in industry) on the topic of OOP, best practices and software metrics. It’s safe to say I know considerably more about OOP than you do.

No, you purposefully mis-interpret them by quoting single sentences out of context because you want to use them to justify your existing code.

The difference, of course, is I’m not the one saying Robert C. Martin is wrong, disagreeing with experts from Google, Apple and Microsoft and I use primary sources (ie not wikipedia) to back up my claims. Your claims are based on hearsay, opinion and tertiary sources.

Riiight… there’s no such thing as “industry standard” or “academically recognised terms”. Where do you come up with this nonsense, do you even think about how stupid it sounds when you type it out?

The reason terms get blurred is because people such as yourself glance at a wikipedia page, assume you fully understand it (Even though wikipedia is a summary, it’s not a comprehensive guide) and then end up with a skewed interpretation of the original concept… and then blog about it. Which is why arbitrary blogs are not primary sources.

Considering that everyone here who has looked at your code has agreed that it is difficult to read I can only disagree. I’ve yet to see anyone apart from yourself say that your default_table class is “easy to understand”. It’s actually incredibly difficult. Even Bob Martin displayed disgust when scott linked it to him on twitter.

“Inversion of control” !== “I don’t have to write code”. Laravel is a framework, as are all the others, as they are in control of the execution flow, rather than the developer of the application.

1 Like

Wouldn’t you say these are 3 different responsibilities? If not, why not?

And, continuing on this line of thought, you noted a very good quote about SoC. Here it is again.

You nicely highlight the word responsibility, but ignored what is being said. Look at the last sentence.

A boundary is any logical or physical constraint which delineates a given set of responsibilities.

Responsibilities, not responsibility. It is plural, not singular. In other words, they could have written this.

A boundary is any logical or physical constraint which delineates a given set of classes, where each class represents a single responsibility.

So, can you now still stay so stubborn and insist SRP and SoC are the same thing? I’ll answer it for you. You can’t. You cannot use the definition of SoC to legitimize your monster class and at the same time use that definition to say your monster class also follows SRP. The above proves SoC and SRP are two different concepts. And thus, we are back to your monster class breaking SRP.


1 Like

set of responsibilities as well. Not just plural but actually labels it as a set of them. SRP then relates to one of these responsibilities.

This should be the nail in tony’s coffin on this argument but I guarantee he won’t admit he’s wrong.

Yes, I find it hard to understand how someone can be so lost in their own perspective and, at the same time, be so blind to think their perspective is completely correct too, when it really isn’t. The fact Tony’s framework works is only an attest to Tony’s fortitude, of which he can be proud of. However, it is not an attest of his competency as a developer. The fact his framework works to any satisfaction of any customer doesn’t prove that the fundamental concepts of OOP and of proper software design are also a given. A functional software and a proper software design, along with following OOP concepts correctly, are NOT mutually inclusive, which I feel is another incorrect perspective Tony has. “My Framework works, so the underlying development must all be perfectly correct from any development stand point!” When we start to point out this perspective is incorrect and Tony loses argumentative ground, his non-sequitur argument is something along the lines of, “I write code that works and not code to suit the fancies of other coders.”

It is fine to have that perspective, but when you have it, you should actually just stay in the wings and be quiet. But no, not Tony. He not only goes out of his way to write long winded blogs about how wrong most everyone else is, he has the arrogance to call those other devs doing normal things, like using DI regularly, as mindless monkeys. This is hard for me to understand and I hope I will never be that way.


This is a perfectly fine attitude to have. The problem is coupling that with saying “My code is perfect and follows all best practices such as SRP” then arguing the definition of SRP in order to pretend his code complies with it.

I’d be perfectly happy if tony was to say “My code works and does what it needs to. It breaks some programming principles and best practices but I don’t care”

I agree completely.


The first characteristic clearly says that the flow of control is dictated by the framework and not the caller. This surely means that it is the framework which calls the developer’s code and not the other way around.

Any decision based on a simple count is ridiculous. Suppose I had a class for a database table which had 50 columns and I had a setter and getter for each. There’s 100 methods straight away, and the class doesn’t even do anything constructive yet.

When measuring software quality any “coupling” produced by inheritance can be totally ignored. It is only when module A calls module B that the degree of coupling can be affected by the developer.

Both articles use the terms “responsibility” and “concern” in exactly the same context, so the terms are not merely related they are identical and interchangeable. I have yet to see any article which states that these two principles are different, explains why they are different, and gives examples of the different results produced by each.

Just like you do.

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.

I have not redefined SRP. I have follows the description found 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

No, they are NOT different responsibilities. All those operations form a cohesive unit and therefore belong in the same class. To split them into artificially small classes would convert a modular system into a fragmented system and make it less readable. I am not the only one with this opinion. This is what Tom DeMarco wrote in his book Structured Analysis and System Specification:

So you are saying that the meaning of a word changes when it switches from singular to plural?? What a load of BS.

SRP is exactly the same as SoC
responsibility = concern
responsibilities = concerns

I would qualify that by changing it to “It breaks some people’s interpretation of programming principles and best practices but I don’t care”.

I repeat what I have said many times before, all these programming principles such as SRP, SoC et cetera are all badly written as they are imprecise and open to huge amounts of interpretation and mis-interpretation. I tend to follow a moderate and balanced interpretation while others lie you, take an extremist view. Moderates and extremists will NEVER agree on anything.

You seem to think that academic theory can automatically be applied in the real world which is where you are wrong. In the real world, the commercial world, we have to strike a balance between academic theory and commercial reality. Sometimes striving for complete perfection is too expensive or too time consuming, so we stop when we reach “good enough”. It is a question of balance. In this article http://www.loosecouplings.com/2011/02/non-di-code-spaghetti-code.html the author wrote about DI, but it could be about any OO principle:

The application is the caller, not the framework, which means the developer has to write code to call into the framework. Once the application has called into the framework, the framework dictates the flow of control, which can include executing developer-written extensions, but it doesn’t mean the framework doesn’t have to be called into by the caller first. The developer has to write code to do that, or have that code generated for them by a boilerplate.

Are you saying, a person can simply ignore the meaning of a sentence, because a certain word is found within it and can be taken completely out of context? What a load of BS.

SoC is about the software as a whole. It defines the need for separation of concerns, each concern being a set of responsibilities. You can say your monster class along with the other separated concerns follows SoC.

However, SRP is about the proper formatting of singular classes and defines that a class should have a single responsibility and reason for change. With that definition, your 9000 class clearly breaks SRP.

Here are some:


Here is an SE question, where everyone who answers is agreeing and they all agree they mean different things.

Here is another SE question with a pretty good answer that also says the two concepts are different.

Here is a Microsoft article on key principles of programming, where the two concepts are presented as two different points.


This is a really good article on the separation of concerns. It doesn’t help my argumentation against your misinterpretation of SoC meaning SRP, but it also never mentions the two being the same and it is a great article all the same.


Here is a tutorial, where they say,

The SoC-Principle is strongly related to the Single Responsibility Principle (SRP) with concerns being a superset of responsibilities. In an ideal case, each responsibility consists of exactly one concern namely it’s core functionality. Often though multiple concerns are mixed inside one responsibility since it’s technically sometimes unavoidable. Therefore keep in mind that the SoC does not say ‘one responsibility should have only one concern’, but it says ‘concerns should be separated’.


Now, for your second challenge. (the first one of finding an MVC framework with only three classes was a fail).

Find an article on the Internet, where it is clearly stated that SoC and SRP are exactly the one and the same concepts.


1 Like

[quote=“tony_marston404, post:212, topic:191138”]
ny decision based on a simple count is ridiculous. Suppose I had a class for a database table which had 50 columns and I had a setter and getter for each. There’s 100 methods straight away, and the class doesn’t even do anything constructive yet.[/quote]

While that’s true to an extent, it gives a good overview of complexity. If you read clean code by Robert C. Martin it says specifically that classes should be small… smaller than that. I.e. as small as possible. If you read the section on functions it says the same thing. You have broken SRP please stop arguing this point.

That depends entirely on which metric you use. Some count inheritance, some split coupling up for more precise measurements and have metrics for incoming/outgoing (Efferent coupling vs afferent coupling) and coupling caused by inheritance.

Not that this matters at all. You said:

it is quite wrong to say that inheritance automatically produces tight coupling.

Which is 100% wrong. Bob Martin said:

One of the problems with implementing an abstract class with inheritance is that the derived class is so tightly coupled to the base class

So that’s two things you need to stop arguing because you are totally in the wrong and just backtracking and trying to weasel your way out at this point. Stop, it’s just making you look foolish.

Both articles on thermodynamics use the word “thermodynamics” in the same context. The difference is that the “First law of thermodynamics” describes a specific concept related to it and so does the “Second law of thermodynamics”. The exact same is true here. I already said you’re too hung up on the individual words and not the concepts and all you do is repeat yourself. That’s 3. Stop.

[citation needed]. You’re the one who spins Bob Martin’s work to apply it wrongly to your awful code.

That’s simply not true though is it. Nobody apart from you is arguing about the definitions of these terms. I said this before, but there are discussions about the best way to apply the concepts, however you are arguing that the concepts have entirely different meanings (Inheritance does not produce coupling, singletons don’t create tight coupling, SRP and SoC are the same thing). Nobody in the world apart from you is arguing with the definitions.

I say again: You simply are not qualified to have a say on this subject, you’ve proven yourself entirely ignorant of the topic.

You’ve said SRP and SoC are the same and applied it to a class with 120 methods and 50 variables.

Bob Martin said:

The first rule of classes is that they should be small. The second rule of classes is that they
should be smaller than that. No, we’re not going to repeat the exact same text from the
Functions chapter. But as with functions, smaller is the primary rule when it comes to
designing classes. As with functions, our immediate question is always “How small?”

Five methods isn’t too much, is it? In this case it is because despite its small number
of methods, SuperDashboard has too many responsibilities.
The name of a class should describe what responsibilities it fulfills. In fact, naming
is probably the first way of helping determine class size. If we cannot derive a concise
name for a class, then it’s likely too large. The more ambiguous the class name, the more
likely it has too many responsibilities. For example, class names including weasel words
like Processor or Manager or Super often hint at unfortunate aggregation of
We should also be able to write a brief description of the class in about 25 words,
without using the words “if,” “and,” “or,” or “but.” How would we describe the
SuperDashboard? “The SuperDashboard provides access to the component that last held the
focus, and it also allows us to track the version and build numbers.” The first “and” is a
hint that SuperDashboard has too many responsibilities.

So yes, you have redefined it. That’s 4 things you need to stop arguing because you are just in the wrong. You’re wrong, Tony, just admit it or stop this incessant nonsense.

Not only that, on functions and methods he says:

The first rule of functions is that they should be small. The second rule of functions is that
they should be smaller than that.

Every function in this program
was just two, or three, or four lines long. Each was transparently obvious. Each told
a story. And each led you to the next in a compelling order. That’s how short your functions
should be!

This implies that the blocks within if statements, else statements, while statements, and
so on should be one line long. Probably that line should be a function call. Not only does
this keep the enclosing function small, but it also adds documentary value because the
function called within the block can have a nicely descriptive name.

Oh look, you go against this as well and have functions that do far too much, shocking.

Tony, again, nobody apart from you is arguing about the definitions of the concepts, only how they can be applied. Nobody else says SoC and SRP are the same thing (And you still haven’t provided a source for this claim). Nobody else is saying “Inheritance doesn’t cause coupling”, nobody else is saying “a software framework must not be called”. It is you who is the extremist here, taking a concept and stretching it beyond all recognition in order to apply it to code which doesn’t fit the original definition… so that you can claim “My shockingly bad code follows SRP!/Doesn’t have tight coupling” or whatever concept it is you want to claim you’re following.

But for what feels like the hundredth time, just because occasionally it’s difficult to apply a concept in a real application doesn’t mean you get to redefine the meaning and then claim the code follows it.

Everyone has written code that doesn’t follow SRP, is tightly coupled or uses some bad practice, often it’s quicker to write initially. The difference is, you’re the only one who looks at that code and says “This follows SRP… let me go and find a line from a definition that proves it!!” everyone else says “The code works but it could be improved if there was more time”.

“Good enough” is perfectly fine, what’s not fine is saying that “Good enough” code follows best practices/is loosely coupled/follows SRP when it doesn’t. These concepts are not laws that you must follow, they are just indicators of code quality and flexibility. Please stop arguing about the definitions it’s making you look like a fool.

Question: is your Default_Table class “Good enough” or is it perfect? If it’s “good enough”, you’re saying it can be improved… how would you improve this class? If not, you’re saying that it’s perfect, there’s no room for improvement and your argument about “balance” is moot.


But in that case the amount of code that the developer has to write in order to activate the framework should be very small. In article http://www.sitepoint.com/crud-create-read-update-delete-laravel-app/ you should see from the volume of code that the developer is expected to write is anything other than small.