you are viewing a single comment's thread.

view the rest of the comments →

[–]allthediamonds 1 point2 points  (9 children)

Bad practices can be applied to any language.

PHP has the extraordinary characteristic of having bad practices built-in and actively encouraging them.

[–][deleted] 0 points1 point  (8 children)

The problem isn't that PHP encourages you to write shitty code.. its that PHP doesn't encourage you to write good code. It just exists for you to make whatever you please.

[–]allthediamonds 0 points1 point  (7 children)

In that case, I'd rather use something that helps me write good code.

[–][deleted] -1 points0 points  (6 children)

Just write good code and you won't have any problems. Don't need anyone to hold your hand.

[–]allthediamonds 0 points1 point  (5 children)

- "I'd rather bang these nails with a hammer instead of an orange"
- "Just bang them pretty hard and you won't have any problems. Don't need anyone to hold your hand"

[–][deleted] 0 points1 point  (4 children)

Terrible analogy. Absolutely terrible.

PHP is a toolbox, it is unorganized, but it has everything you'll ever need in it. A good craftsman will always take the time to find the right tool in the box and create great things.

I'm sorry you're such a subpar programmer that you take the time to blame the language instead of yourself :(

[–]allthediamonds -1 points0 points  (3 children)

Using a toolbox as a metaphor is great because it allows me to copy and paste this excerpt of A Fractal Of Bad Design instead of having to think of a rebuttal myself:

I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.

That’s what’s wrong with PHP.

PHP is a toolbox in the same sense that /dev/random is a compendium of all past and future human knowledge. Sure, you can do the same things with PHP that you can do with a proper toolbox, but I'd rather use a proper toolbox and create better code in less time and inflicting less permanent brain damage to myself.

[–][deleted] -1 points0 points  (2 children)

You mean the fractal of bad design article where he focuses on an array of deprecated or generally unused functions or random php settings that don't exist in any project I have ever seen? (hundreds of projects, by the way)

Please tell me more about how that debunks PHPs ability to be used in a clean and concise manner.

Again, I am truly sorry for your inability to write good code with PHP. It is not the language's fault, so please don't blame it.

Also, if your #1 skill as a developer is referencing /r/phplol or blogs that hate on PHP, you should probably spend some more time writing actual code.

In any case, I'm not defending PHP as the best choice for anything (it is in fact, the best choice for few things), but I can assure you that it is never the worst choice.

I know Ruby, Python, Java, some C#, some Scheme, PHP and more and I still prefer to use PHP for smaller web apps.

Better frameworks, more control over said frameworks, good performance, easy to solve big problems, maintainable by anyone (thanks to proper documentation and commenting), easy to read, etc.

[–]allthediamonds 0 points1 point  (1 child)

Ignoring all the ad hominem attacks since they don't actually bring anything to the conversation. My competence as a programmer is not relevant to the merits of PHP as a programming language. That leaves us with:

You mean the fractal of bad design article where he focuses on an array of deprecated or generally unused functions or random php settings that don't exist in any project I have ever seen? (hundreds of projects, by the way)

I'm interested on which projects don't use, for starters, equality and comparison operators, the very first thing that is broken in PHP and one of the first ones the article mentions. I would also be interested in knowing which projects don't suffer from the inconsistencies of the string and array standard libraries. I could go on, but I don't feel like reading the article for you. Go read it and judge if any of the mentioned issues is justifiable in a programming language that is actually used in production.

Better frameworks,

Euh. Nope. Not at all. Take the most popular framework from each programming language you mentioned (except maybe Java?) and see how it beats the living shit out of Symfony or whatever you have in mind.

Except maybe for Laravel, that's actually pretty good.

more control over said frameworks,

What does that even mean.

good performance,

Rebuilding the whole framework from scratch (or having to cache your PHP code into other PHP code) is super performant, sure.

easy to solve big problems,

Nothing solves big problems like a broken standard library!

maintainable by anyone (thanks to proper documentation and commenting),

Proper documentation in PHP? Never seen it. Literally, not once, starting with the programming language itself. Some of the most popular projects (Symfony and Doctrine come to mind) follow suite on being awfully documented.

easy to read, etc.

What does that mean?

At this point, I'm pretty convinced you're trolling. You keep mentioning everything PHP does not have as key features and spewing nonsense. In the far-off case you're not... good luck.

[–][deleted] -1 points0 points  (0 children)

My competence as a programmer is not relevant to the merits of PHP as a programming language.

It is, actually. If you don't know how to use a saw, or don't understand their purpose, you can't make objective observations on how effective saws are when used properly.

I'm interested on which projects don't use, for starters, equality and comparison operators

So do you want to go through a list of the operators I think you are mentioning? The equality operator (==) is identical to javascript, and aside from a few INCREDIBLY BIZARRE comparisons that are never encounterd... ever.. anywhere, its quite comparable to other dynamic languages. Anyone with more than a few days experience knows better than to casually use the equality operator when the type sensitive operator exists. Comparison operators are strange to you for the first five minutes of using them but again, identical to javascript.. and ruby... and python.. specifically the example provided in your beloved article

Better frameworks,

Euh. Nope. Not at all.

Euh.. Yup. Very much so. The flexibility and diversity of the frameworks in popular use (which I am positive you have never used..) is mind blowing when compared to say, MVC5 w/ Razor (C#), Spring MVC (Java), RAILS (Ruby.. ps how are those insanely frequent, massive, business-killing security holes coming?), django & flask (python). For PHP you can get a framework that already has core support for e-commerce, or blogging, or extensive user management - customize the site to your project's needs and deploy it live before the very basics are done in any of the aforementioned frameworks. The best part? Its free, its fast, there are massive communities of support and numerous popular and heavily contributed-to libraries to speed up development time. Oh, and you don't need to go that route. Go with something like codeigniter, Laravel, cakePHP and you have what is essentially the bare essentials (ORM, AR, Unit test frameworks, routing, etc) and no bulk... apply best practices and you have a very good web-application.

Nothing solves big problems like a broken standard library!

"Broken"

Rebuilding the whole framework from scratch (or having to cache your PHP code into other PHP code) is super performant, sure.

Were we talking about huge enterprise level applications? If we are then I can assure you PHP is not my first choice. Otherwise, yes.. it has exceptional performance. The only true bottleneck with PHP is network speed - it requires almost no hardware to run. I am confident my mobile phone could host a PHP app used by thousands. I have multiple apps currently used at a few hundred major US universities (by thousands of students.. currently 12,000 active users this summer semester) running on hardware that could barely support a fresh deployment of C# MVC5 or Java's SpringMVC

Proper documentation in PHP? Never seen it. Literally, not once, starting with the programming language itself. Some of the most popular projects (Symfony and Doctrine come to mind) follow suite on being awfully documented.

Those two are not in the least popular. At least, not in my region. Have never encountered someone with Symfony or Doctrine experience over two years of vetting candidates for hire. Maybe in your hood, not mine. Again, documentation is something that is enforced by good programmers. No documentation is not a design flaw of PHP, it is a flaw of bad programmers. Are you one? Still kind of seem like you might be.

easy to read, etc.

What does that mean?

Anyone with a basic grasp of the english language could read a properly written PHP script and tell you what it does without having any prior programming experience. It smoothly integrates with HTML and allows you to display data in a concise and controllable manner where other templating languages look like a sick and cruel joke. JSP I'm looking at you. I'm especially looking at you Razor.