PHP The Wrong Way

We all know PHPTheRightWay.com, right? It’s a site (and book) full of best practices for getting started and generally developing with PHP. We’ve known for a while now that some people just don’t do modern even when exposed to better practices. Some are just too baked into their own past habits to change, but others make a best effort and then simply - misunderstand.

This is how we assume the page PHPTheWrongWay.com came to be. It’s a kind of critique of PHP The Right Way, listing its suggestions and arguing against or “alongside” them, trying to get people to stay from absolutes but, in the end, advising to go almost the opposite route.

This prompted a response from Jon LeMaitre who sums up the site’s shortcomings thusly:

In general, PHP - The Wrong Way delivers three positive fundamental messages: keep things as simple as possible, don’t use/apply tools dogmatically, and write secure software by default. This is generally good advice, except PHP — The Wrong Way expresses much of its advice through a series of gross mischaracterizations of the PHP community, the nature of frameworks, standards, and PHP itself.

Having thoroughly read both “Right” and “Wrong”, I can say that I agree with Jon’s assessment, but I can also say that while there are some aspects of “Wrong” that make a reasonable degree of sense, they would have carried more weight if only the author had considered getting an editor (or several) before publishing - far too many people don’t have people review their content before putting it out, and then it’s full of typos, mistakes, or even worse - factual errors. That’s why peer review is incredibly important.

The part about not going with OOP in particular. Case in point:

Today, one of the main strengths of PHP is its support for both imperative, functional, object-oriented, procedural, and reflective paradigms.

There’s no such thing as a reflective paradigm. What? There’s reflection, but there’s no actual paradigm around it. PHP’s strength being functional programming? Its most powerful debugger, XDebug, has a built in crash mechanism for recursion deeper than 100 levels and requires hacks to get around. That is not a staple of a good functional programming environment. Besides, many of the terms seem to be unclear to the author, and could have been clarified by others if only he had asked around prior to publishing - it all would have made for a much more balanced and well written argument that may actually have benefitted the community.

PHP is a huge toolbox with lots of different tools that makes it possible to solve many problems in many different ways - not just one way!

OOP is not a way to solve a problem. It’s a way to structure the solution to a problem - a way that completely blows most alternatives completely out of the water by allowing for easy unit testing, code resharing, encapsulation, and much more!

Anyway, enough dwelling on this - please read Jon’s post for other counter-arguments to these counter-arguments, and then tell me what you think about the whole ordeal, eh?

2 Likes

Joe’s post? Or did you mean Jon’s? :smile: Ahhh editing editing… :wink:

I could almost think it is actually Tony Marston behind the anonymous Github user “bitflop”. Though, the author isn’t antagonistic enough to be Tony, I don’t think.

Also, the fact bitflop is an anonymous person is enough for me not to believe his or her beliefs. The anonymity shows that person is aware he or she isn’t being completely genuine. At least that is my opinion. Someone who is being honest and offering their honest opinions shouldn’t need to hide behind a pseudonym. That is another reason why I don’t think it is Tony. Though, they both think very alike.

Jon’s article is a good counter to the counter.

Scott

1 Like

Curses :smiley: @ralphm can you do something about that? It was read only by the time I noticed. Thanks for the heads up @s_molinari!

1 Like

@s_molinari @swader

Does that help?

3 Likes

Thanks :slight_smile:

2 Likes

(One of) my gripes with that article is that it isn’t even consistent. The author’s one-line conclusions often don’t match the paragraphs of text leading up to it. The author concludes, for example, that you don’t always need a framework – which is reasonable. But in the actual text, the author says frameworks are restrictive and unnecessary, that they don’t improve development, and that we only use them because we’ve been verbally abused into doing so. Despite the conclusion, the text makes it clear the author doesn’t like using frameworks ever.

2 Likes

This is wrong. “Reflective programming is a programming paradigm, used as an extension to the object-oriented programming paradigm.”

http://www.statemaster.com/encyclopedia/Reflection-(computer-science)

Although the article you cite states reflective programming is a thing, as in, it is a programming paradigm, the only question I’d like answered is, how can you program purely in a reflective fashion?

And since the answer is IMHO, “You can’t!”, then in all fairness, it can’t be a paradigm for programming. I’d accept the bit about it being a real thing, as in, it is an extension of OOP, which is the real paradigm, though.

Scott

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.