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

So these words have different meanings in a different context??? And you can change the meaning to whatever you like??? You remind me of a certain fictional character:

Many words have different meanings in different contexts. Murder can mean different things if it’s in relation to people or crows. Boot can mean different things depending if you’re talking about a car or a piece of footwear. Foil has a different meaning if you’re talking about the material or what you’re going to do to someone’s plan, etc, etc…

It’s nice to see it’s not just programming languages you struggle with.

Ironically “It means what I choose it to mean” sums up your stance incredibly well.

So I have to ask: do you have any qualifications at all or just 30 years experience? I’d expect someone who’d done so much as an undergraduate degree (even 30 years ago) to understand the difference between a primary, secondary and tertiary source, why primary sources are more authoritative than tertiary sources (like wikipedia) and a have a basic understanding of peer review.

And if you don’t have any qualifications what makes you think you know more than researchers at the top of the field or people doing PhD level research such as myself?

I never redefined any terms, I merely take one of the many existing opinions/interpretations of what a particular term means and apply that interpretation. The fact that some of these terms have so many interpretations - and in many cases contradictory interpretations - just proves that these terms, concepts or principles were so badly written in the first place.

I have NOT redefined what encapsulation means as I have closely followed many of the standard definitions which describe it as “The act of placing an entity’s data and the operations that perform on that data in the same class.”

I have NOT redefined what SRP and SoC mean as I have separated my code into the EXACT SAME three areas - GUI, business rules and database - that were described in TWO separate articles by Robert C. Martin.

I have NOT redefined “component” as the dictionary definition clearly states it as “constituent part”. In software these “constituent parts” could come under several different names - program, subprogram, subroutine, module, class, object.

I have NOT redefined “coupling” as my description at http://www.tonymarston.net/php-mysql/oop-for-heretics.html#coupling clearly uses https://en.wikipedia.org/wiki/Coupling_(computer_programming) as its source.

I repeat, I have implemented both the 3 Tier Architecture and the MVC design pattern, so far from being a monolithic piece of unmaintainable code I have created a proper modular system which is based on sound and proven architectural principles. I have been maintaining and enhancing this code for over 10 years, so it is far from being unmaintainable. Your only objection is that my implementation is different from yours, and you cannot understand how anything so different can be so successful. I have never said that my implementation is right and yours is wrong, I have merely said that my implementation is different. It is YOU who keeps saying “You’re not allowed to be different!!”

A “God” class is a class that tries to do everything. In other words it has GUI, business logic and database logic in a single class. That “monster” class of mine is an abstract class which contains all of the methods which may be used when a Controller calls a Model. It contains code which ONLY belongs in the Model as control logic, view logic and database logic is contained in totally separate modules.

If you look at http://www.tonymarston.net/php-mysql/your-code-is-crap.html#table1 you will see where I have documented the 42 methods which may be used in a single UPDATE operation, and you will not see any method which belongs in either a Controller, a View or a Data Access object.

Your theory that it must be a “God” class purely on the count of methods and lines of code is seriously flawed. You are jumping to a conclusion without examining the facts. The fact that many developers cannot envisage ever needing a class with that many methods simply shows a lack of vision and experience. I do not work on puny systems with limited flexibility, I work on enterprise applications which have to satisfy the varied needs of different large corporations. Have you ever worked on an enterprise application which has 300+ database tables, 450+ relationships and 2,500+ user transactions?

It does say “three interconnected parts”, and in OOP a “part” can be interpreted as a class or object.

There are millions of developers out there who assume that an implementation of the Model-View-Controller design pattern requires no more than 3 classes - one for the Model, one for the View, and one for the Controller - so it is not that unreasonable.

It is an abstract class which contains all the methods which may be used when a Controller calls a Model. The methods fall into one of the following categories

  1. Methods which allow it to be called by the layer above it (the Controller or the View)
  2. Methods which allow it to call the layer below it (the Data Access Object).
  3. Methods which sit between these two. Many of these are “customisable” methods which are empty, but could be filled with code in order to override the default behaviour.

Tae a look at http://www.tonymarston.net/php-mysql/your-code-is-crap.html#table1if you want a more detailed description.

Every one of those methods belongs in the Model and not in a Controller, View or Data Access Object, so to say that it is “too big” based on nothing more than a count just a joke. None of those methods belong anywhere else, so they are where they belong.

Where did I ever say that? I joined this discussion - which is about frameworks, by the way - by agreeing with the general definition to be found in https://en.wikipedia.org/wiki/Software_framework and explained how my own framework met the four characteristics, and it is YOU and others like you who repeatedly claim that my ideas are nonsense simply because you don’t like the way that I write code.

I have never said that I am right and everyone else is wrong, I have simply stated that my methods are different yet they still work. I am merely offering a different opinion but it is YOU who keeps saying that I am not allowed to be different.

It is NOT only me who has a different opinion. The internet is full of articles which express different opinions. Just because a few individuals group together and agree on a particular opinion or interpretation does not mean that the whole universe is then bound by that decision.

That’s a ridiculous argument. I am limiting myself to words in the English language which are now used in the world of software development. If the English dictionary states that “component” means “constituent part” then it is totally WRONG for you to say that in software development “component” does NOT mean “constituent part”.

People with academic qualifications who work in an academic environment can rarely compete with practical people with experience in a commercial environment. Theories are useless unless they have practical applications in the real world.

Robert C. Martin while describing SRP said

Classes should have a small number of instance variables. Each of the methods of a class
should manipulate one or more of those variables. In general the more variables a method
manipulates the more cohesive that method is to its class. A class in which each variable is
used by each method is maximally cohesive.
To restate the former points for emphasis: We want our systems to be composed of
many small classes, not a few large ones. Each small class encapsulates a single responsibility,
has a single reason to change, and collaborates with a few others to achieve the
desired system behaviors.

and you have said your 120 method 50 variable class conforms to SRP. You have redefined SRP to try to claim your existing code conforms to it.

Robert C. Martin says:

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

You said:

and

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

When I asked whether he was wrong or you were, you said:

He is.

You redefined coupling (and you still don’t understand it which is why you don’t get DI, SRP or other related concepts).

You have said:

Nowhere else does it say this and the fact that wikipedia has different articles describing different concepts is a nail in the coffin: You have redefined SRP and SoC.

So stop claiming you haven’t redefined the concepts, it’s practically all you do.

Yes but it’s irrelevant to the topic at hand. I’ve worked on a system with thousands of tables and billions of records, but it just doesn’t matter because this discussion has turned into one about the theory and how you don’t understand it.

and we’re back to this nonsense. You don’t understand what authority is and what a primary source is. Please go and read about peer review. anyone can put things online, from well known professionals like Uncle Bob to enthusiastic amateurs such as yourself. This is preceicly why arbitrary websites are not authoratitive. Go get some sources from academic journals that back up your claims and we’ll talk. The problem is you cannot because they don’t exist (or you take one line and stretch it so far beyond its context it loses all meaning, or illogically infer that when someone says “You can use X for Y” that it means “You cannot use X for anything else”).

This is just a bizarre non-sequitur. You’re the one who said “Software component = ONE CLASS”. Software component has a specific meaning in computing which has no relation to classes.

So you’ve got zero formal qualifications, you’re entirely self-taught, mostly work alone so don’t even have other developers to discuss potential solutions with and you’ve consistently demonstrated you don’t understand several fundamental concepts which inevitably leads to a misinterpretation of more advanced concepts.

Now, the latter is understandable given the former points, without any proper training, misunderstaning is almost inevitable given the complexity of the subject at hand. What I don’t understand is why you think you know better? You just aren’t qualified to tell genuine experts they’re wrong. I point you to your post where I asked “Is uncle bob wrong or are you?” and you said “He is” and everywhere where’ you’ve argued against academic journals and other primary sources (high end developers at google/microsoft/apple/ibm).

Tony: Why should anyone listen to anything you say? You have exactly zero authority and you’ve proved that you have a lack of real understanding. I ask again, why are you here and what are you trying to prove?

There’s “being different” and there’s redefining industry standard, academically recognised terms to fit your needs and then trying to pass off your awful code as “Well written”. This is the problem, having a discussion is fine but actively pushing erroneous information is not helpful to that discussion it’s detrimental.

Millions? Ok. I challenge you to find just one framework that has MVC architecture and does it with only three main classes and no serious sub-classing.

Scott

1 Like

Yes, and you are repeatedly misinterpreting what “inversion of control,” the first characteristic in that list, means. It does not mean “the application developer shouldn’t have to write code to call into the framework.”

And instead of attempting to explain why your interpretation is correct (which it isn’t), you simply respond with “But Radicore can do it without writing code”, as if what Radicore can do has anything to do with the definition of either “inversion of control” or “framework.”

2 Likes

I don’t event like MVC… I prefer DMVC, as DM being Domain Model. The term “model” might be to vague and can be interpreted as the objects that come from a database or a service, and what it should be read it is that is the the model that is suppose to be used in a the view(s). The MVC is a pattern for Presentation purpose, not for defining the application. The MVC pattern requires the minimum of 2 classes, and a thing to be the view (class or a “template” in twig for example). But applying that to a real scenario exploded the number of objects in context. The Domain Model can be composition of classes (user, address, context, …), the controller should be thin enough and only dispatch to other services, providers, validators, thus a bunch more of additional classes, each with each own responsibility, the view can be a composition of templates inside templates (header, side bars, content, signatures, footers).

So yes, there are millions of developers that explain how to do a single “hello world” webpage MVC application with 3 classes. I doubt that there is a single developer that really does that. But lets “assume” that there is. If so. The view needed to have all the ifs for all screens, the controller needed to have receive all possible actions from all views, and and the model needed to represent different combinations of data available to the screens. Is this a real scenario?

Obviously this breaks all SRP, SoC, SOLID, …, If not, what exactly what do you mean?

I have NOT redefined SRP. For “single responsibility” I have created a separate class for each database table where each class is responsible for the business rules for a single database table.

Inheritance is not a problem, it is a recognised technique in OOP for sharing code. He should have used the word “combined” instead of “coupled” as that has a totally different meaning. It is used when one object calls a method on another object and describes the degree of interaction between those two objects. Depending on how well this interface is coded, the degree of coupling can either be described as “loose” or “tight”, where “loose” is supposed to be the better of the two.

The coupling that exists between a superclass and its subclass is totally different, and can be totally ignored as a measure of software quality.

You are totally wrong. In his article http://blog.8thlight.com/uncle-bob/2014/05/08/SingleReponsibilityPrinciple.html Robert C. Martin states the following:

To him the “separation of responsibilities” means exactly the same thing as “separation of concerns”.

The Wikipedia article https://en.wikipedia.org/wiki/Separation_of_concerns contains a reference to http://aspiringcraftsman.com/2008/01/03/art-of-separation-of-concerns/ which contains the following:

In that article he uses the term “responsibility” over 20 times, so in his mind it means exactly the same as “concern”

But I DO understand these theories and concepts, it is just that my interpretation and implementation of these theories and concepts is different from yours AS THEY ARE ALLOWED TO BE!!!

I did not say that. There are several levels of component and sub-component, and in my architecture a class is at the lowest level.

Irrelevant. When I first joined the computing profession there were no such things as computer-based degrees. I got my first job by passing a test which proved I had a logical mind and could think like a computer. I have seen too many CS graduates who know the theory but are simply unable to put it into practice.

Incorrect. I received on-the-job training as well as being sent on outside training courses.

Incorrect. While being a full-time employee for several decades I always worked in a team of developers, first as a junior and then as team leader. While working as a contractor for several customers in the last decade I have always worked with other developers as they had to check and approve my work before it was allowed to go into production. I currently make a living by selling licences for my software package, a large enterprise application, and I regularly discuss the design and implementation of enhancements and customisations with my business partner who is also an experienced developer.

My experience of having successfully designed and built a very large number of applications over the years clearly proves that you are wrong. My interpretation and implementation of certain concepts may be different from yours, but I am allowed to be different, just like every other programmer on the planet. There is no “one-size-fits-all” answer for everything.

The problem that exists with all the concepts and theories about OOP is that they are so badly worded that they are open to enormous amounts of interpretation and therefore mis-interpretation. Just because my interpretation and implementation of certain concepts is different from yours does not automatically mean that they are wrong! Different, yes. Wrong, no!

For exactly the same reason why people should listen to what you say - to find out if it makes sense or not.

There is no such thing as a single “industry standard” that is universally accepted by all programmers. As for “academically recognised terms” I do not work in the academic world where theory is everything, I work in the commercial world where it is only the practical application of those theories which counts.

My code can be classed as “well written” simply because it is readable - by others as well as myself - and therefore easy to understand and maintain. Those are the only metrics that count, not the number of design patterns I use or the way I implement them.

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.

Scott

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.