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

I can only repeat what is I said in post #90

Just because you find articles which offer a different definition than the one found in https://en.wikipedia.org/wiki/Software_framework does not means that those articles are correct. As far as I am concerned they are merely offering different opinions, and I do not agree with those opinions.

There is no reference to size in his 2014 article, so “too big” or “to small” are irrelevant when in comes to splitting a monolithic piece of code into smaller units. His 2014 article specifically states that ALL GUI logic should be in its own component (although I have actually split that into separate Views and Controllers), ALL business logic should be in its own component, and ALL database logic should be in its own component. There is absolutely nothing in that article which states that if any of that logic exceeds a particular method count or line count that the component should be split into smaller sub-components.

I have never seen ANY definition of MVC which states that you need more than three classes to implement it. There may be multiple variations for each of those in an application, but each user transaction should be able to operate with no more than one of each.

Unlike you can point to any authoritative article on MVC which identifies why and how each of those three components needs to be split it smaller sub-components I will continue to treat your argument as utterly bogus.

Having data in the Model and logic in the View which presents that data in a particular format for the user such as HTML PDF or CSV does NOT break encapsulation. The Model class is only responsible for obtaining the data and validating it according to the business rules. It passes that data to a separate Data Access Object when it needs to be stored in the database and to a separate View when it needs to be shown to the user.

You are trying to tell me that if I apply SRP/Soc then I am automatically breaking encapsulation!!! What a totally ridiculous argument!!!

Can you specify what constitutes ‘authoritative’ in your mind? You’ve already shown you will happily cite or dismiss the same sources and authors depending on whether they support your argument or not.

2 Likes

Please answer with a yes or no. Is a line on a wikipedia page with [citation needed] worth more than academic journals and examples from google, apple and microsoft?

Both?

To be clear. If a class can be separated into two or more other classes that change for different reasons or at different rates; then that separation conforms to the Single Responsibility Principle.

The main idea is to gather together the things that change for the same reasons and at the same rates. Keep separate those things that change for different reasons or at different rates.

3 Likes

Thanks for the clarification! This is the class in question:

http://pastebin.com/m76ZAUZc

Would you say this followed your definition of SRP or not? @tony_marston404 is citing your definition to claim it does.

Laravel does exactly that as well, yet you dismiss it as “not a framework.”

Does “basic and default behavior” !== “do anything”? I’m not sure what your objection is. Laravel comes with a set of base classes with “basic and default behavior” that you can extend with your own custom code if you want it to do more.

Errrr, no. Laravel comes with those and controls the flow of execution through them.

Tony thinks separation of concerns and SRP are one and the same. So, because his framework follows MVC, thus obeying SoC, all of it then automatically obeys SRP too.

The contradiction he accuses Bob of making comes from his clear misunderstanding of the two concepts, which differ only in scope basically. SoC’s scope is at a higher framework/ application level. Like…separation of concerns between areas of the framework and application to split them up in logical parts, so they are more modular, reusable and easier to change.

SRP’s scope is at the lower class level. It describes how classes should be formed, so they are also more modular, reusable and easier to change. The goals of both concepts are the same, however, you can’t always say you have successfully complied with SoC and it directly means you have properly done SRP too.

If you see the two concepts like that, then everything Bob has said makes perfect sense and we are back to Tony’s 9000 line class breaking SRP.

Scott

1 Like

Are you saying you only have three classes in your framework to build your MVC architecture? :flushed:

Scott

I moved 7 posts to a new topic: Suppressing notifications from a topic

And now you’re redefining the term “component”. From wikipedia ( https://en.wikipedia.org/wiki/Component-based_software_engineering )

Software components often take the form of objects (not classes) or collections of objects

Alternatively, this definition from Berkeley University ( http://www.eecs.berkeley.edu/newton/Classes/EE290sp99/lectures/ee290aSp994_1/tsld009.htm )

“A software component is a unit of composition with contractually specified interfaces and explicit context dependencies only. A software component can be deployed independently and is subject to composition by third parties”

A interfaceS, dependencieS. A component is not a single class. Again, we come back to your misunderstanding of the difference between Separation of Concerns and Single Responsibility Principle.

Try https://en.wikipedia.org/wiki/Model–view–controller

So wikipedia is authoritative?

You might want to read this: https://en.wikipedia.org/wiki/Reliability_of_Wikipedia

Because Wikipedia can not be considered a reliable source, the use of Wikipedia is not accepted in many schools and universities in writing a formal paper, and some educational institutions have banned it as a primary source while others have limited its use to only a pointer to external sources.[59][62][63] The criticism of not being a reliable source, however, may not only apply to Wikipedia but to encyclopedias in general – some university lecturers are not impressed when students cite print-based encyclopedias in assigned work.[64]

In a 2004 interview with The Guardian, self-described information specialist and Internet consultant[52] Philip Bradley said that he would not use Wikipedia and was “not aware of a single librarian who would. The main problem is the lack of authority. With printed publications, the publishers have to ensure that their data are reliable, as their livelihood depends on it. But with something like this, all that goes out the window.”[53]

Let’s put it this way, if you submitted an academic piece even at undergraduate level with wikipedia as a reference your work would be marked down compared with using a real source (Academic Journal, book, conference proceedings, etc)

See

http://isites.harvard.edu/icb/icb.do?keyword=k70847&pageid=icb.page346376

If different articles give different and sometimes contradictory definitions on the same subject, it is simply not possible to follow them all. I generally follow what is written in Wikipedia as it is supposed to be unbiased.

There’s no yes or no here. I repeat:

Please answer with a yes or no. Is a line on a wikipedia page with [citation needed] worth more than academic journals and examples from google, apple and microsoft?

Wikipeida is by no means “reliable”: https://en.wikipedia.org/wiki/Reliability_of_Wikipedia (And yes I see the irony in using wikipedia as a source to demonstrate that wikipedia is unreliable)

Please check its own disclaimer:

Which states:

Wikipedia cannot guarantee the validity of the information found here.

and

None of the contributors, sponsors, administrators or anyone else connected with Wikipedia in any way whatsoever can be responsible for the appearance of any inaccurate or libelous information or for your use of the information contained in or linked from these web pages.

and

WIKIPEDIA MAKES NO GUARANTEE OF VALIDITY

This will be an interesting read for you @tony_marston404

Some highlights:

  1. You must never fully rely on any one source for important information.
  2. You especially can’t rely on something when you don’t even know who wrote it.
  3. The contributor with an agenda often prevails.
  4. It says so on Wikipedia.
    Wikipedia says, “We do not expect you to trust us.” It adds that it is “not a primary source” and that “because some articles may contain errors,” you should “not use Wikipedia to make critical decisions.”

I’m afraid that this description is far too vague to be of any use. It leaves too much to the imagination and is open to vast amounts of interpretation and thus mis-interpretation.

In your article http://blog.8thlight.com/uncle-bob/2014/05/01/Design-Damage.html you said the following:

In your article http://blog.8thlight.com/uncle-bob/2014/05/08/SingleReponsibilityPrinciple.html you said the following:

These both mention that keeping the code for GUI, business rules, and the database in separate modules would be good design, which is far more meaningful. This happens to match the description of the 3 Tier Architecture with its Presentation layer, Business layer and Data Access layer which is precisely what I have implemented. By combining it with the MVC design pattern I have split the Presentation layer into separate Controllers and Views.

If I have done the level of separation which is described in those articles and if I have implemented both the 3 Tier Architecture and MVC design patterns, why am I still accused of NOT following SRP?

Either it is because SRP has been inadequately defined, or because different people have their own different interpretations, and it is simply impossible to implement every different interpretation.