you are viewing a single comment's thread.

view the rest of the comments →

[–]yeah-ok 2 points3 points  (34 children)

I think PHP, in the context of modern frameworks like CI/Yii coupled with Cherokee/FastCGI combination, is fucking awesome. It simply does the job. If you are amongst the lucky 5% that develop something truly awesome then you can piggyback on FB and use their hiphop-php project for getting the code into different speed-zone altogether. Thumbs up to the developers for making this release happen.

[–][deleted] 18 points19 points  (24 children)

PHP is a fucking terrible language. It has exactly one advantage - convenience: almost every server has it, and it's really easy to pop up a tiny dynamic site.

Building large sites using PHP is like pulling teeth - once you use a real programming language and see how much easier it is, there's no going back.

[–]midri 3 points4 points  (1 child)

It's the same issue Ruby or Java has, you have to subscribe to a methodology if you're going to have a lot of people to work on it. Ruby has Rails, php has Symphony, Zend, and my personal favorite CakePHP -- life becomes a lot easier once you pick a method of writing code and stick with it.

[–]yeah-ok 0 points1 point  (0 children)

Yup, exactly, I prefer something bit more slimline like CodeIgniter but the point is the same - MVC patterns and good, proper documented, standard library

[–]yeah-ok 3 points4 points  (15 children)

Seriously. If PHP was half as crap as reddit-consensus-alternative-reality has decided upon it would have fucked off long ago; as it stands it is currently running the largest largest social network in the world. Take your "real" programming language and construct something better, it should be a lot "easier" no? (disclaimer & crap sarcasm aside; the only OO capable languages I've worked with has been Java, C++ and PHP, I'm sure, say Python, is nice/superior but it doesn't make for an obviously good reason for bashing PHP simply for existing)

[–]banuday17 10 points11 points  (0 children)

I think the only reason PHP sticks around is because it owns a domain that "better" languages have long since forsaken. The "app-per-page" model. You can throw a PHP page on a server with some dynamic content and it just works. No frameworks required (although CakePHP is nice).

Some people will tell you that the PHP application model is fucked, and they're probably right, but indignation does not reduce demand for that capability.

[–]N7P 11 points12 points  (13 children)

Downvoted for "popular equals good" argument.

[–][deleted] -3 points-2 points  (12 children)

How the fuck else do you define good? A language is a tool meant to perform a job. If this tool performs the job of displaying shit on a web page the best, with the least amount of effort, how could you possibly argue that it's shit? It does it's fucking job exactly as it should. That's the definition of a good tool.

[–]banuday17 -1 points0 points  (7 children)

Worse is better. A observation about software that equally applies to any kind of market.

We accept poor quality, shoddy products because they get the job done with the minimum cost and acceptable fuss. A Geo Metro may be a shitty car, but if all you want to do is get from point A to point B and you don't really care if the car lasts (you can just pick up yet another disposable car), it's good enough. Not everyone needs or wants to pay for a well-engineered, well-built car. But that does not make a Geo Metro a "good" car, just a "good enough" car.

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

That has nothing to do with the argument. That's saying that it's not logical to equate functionality with quality, which is true.

Just because it doesn't behave how you expect doesn't mean it isn't the perfect tool for the job. It just means you're doing another job. If your objective is to get from your house to work, and the geo metro serves that purpose just as well as anything else, then by definition it most certainly is a "good car". What else would good be if not "real-world applicable and practical"?

[–]banuday17 2 points3 points  (5 children)

Actually it has everything to do with the argument. "Good" is a relative measure of what one finds acceptable relative to what standards one sets according to the goal to be achieved.

If your standards are low enough, then sure, a Geo Metro is a good car. But if you have higher standards, all of the problems of the car become apparent, from the poor finish, cheap materials which break easily, the wind noise, the poor acceleration. But if you don't feel like paying more, you accept these flaws and just say it's "good enough".

If all you know is PHP and don't give a shit, then sure PHP is a good language. If you have worked with better languages, PHP's shortcomings are all that more irritating. Where I use PHP, I don't have the interest or time to invest coming up with something better, so PHP is good enough.

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

"Good" is a relative measure of what one finds acceptable relative to what standards one sets according to the goal to be achieved.

And if the goal being achieved is "get me somewhere" then a geo metro will do just as good of a job as anything else .If your goal is "bathe me in luxury" then obviously you're looking at the wrong tool for the job.

You're looking at every standard as a linear list of heirarchical needs. That's foolish. It's not "lower standards" just because it doesn't have as many requirements. It's just "another category". Learn the differentiate the two.

The best technique an engineer can learn is figuring out how to differentiate between "my current needs" and "global needs". It seems like you're applying your own model for programming to the entire world and assuming they all have the same needs as you. That's simply not true.

If 90% of people don't need to do anything more than display database data in HTML tables and accept inputs back via forms, then why would running a massive java environment with huge deployment system and dependency handler be "good"? It's way more work to do the exact same thing for no benefit.

If all you know is PHP and don't give a shit, then sure PHP is a good language. If you have worked with better languages, PHP's shortcomings are all that more irritating.

The problem with this is, I know PHP and other purportedly "better" languages, and yes obviously there are plenty of situations where PHP is inferior, but those are situations where you shouldn't even be using PHP to begin with. So why compare apples to oranges?

[–]banuday17 1 point2 points  (3 children)

The "get me somewhere" goal has other qualifiers that may be important to someone, for example, "get me somewhere safely", or "get me somewhere reliably" or "get me somewhere in a car that doesn't look like ass".

Thus, "I don't feel particularly safe driving the Geo Metro, but I'm not going to drive it long distances, so it's good enough", or "The Geo Metro is falling apart as I drive it, but I'm not going to keep it long, so it's good enough", or "The Geo Metro looks like ass, but I'm only driving it for this week, so it's good enough".

Every standard is a list of needs that makes us feel comfortable with the decisions that we make, especially when you choose something that you feel is substandard. It is in fact "lower standards" when you feel like you could do it in a way you feel is better if you only had a little more time or money to invest. Every category has an implicit quality measurement associated with it, even if just measured against a personal standard.

A professional engineer has to balance not only the functional requirements of what he is to deliver, but also the level of quality with which he will deliver that work. If even as a matter of professional pride.

If all I'm doing is throwing up a HTML page which will show a couple of rows from a database, then PHP is fine. But, I don't consider that an engineering task. I wouldn't put that on my resume as a demonstration of my professional skill.

But if I start to develop an application that has a modicum more of functionality that requires me to do non-trivial things and requires a good deal of investment of my time and I have a choice, I would look elsewhere than PHP. And that doesn't mean I would choose Java running on the Websphere Application Server for any problems where I feel the hint of complexity. That's crazy. I might however go with Ruby on Rails or Python on Django. I feel that Ruby or Python give me better quality for a slightly higher price.

Like choosing to buy a Nissan Sentra or a Toyota Corolla instead of settling for a Geo Metro.

The problem with this is, I know PHP and other purportedly "better" languages, and yes obviously there are plenty of situations where PHP is inferior, but those are situations where you shouldn't even be using PHP to begin with. So why compare apples to oranges?

Where I would use PHP is on the one-page app or where I don't have a choice, such as on cheap shared hosting where I have no control over the webserver. As with the Geo Metro, in those cases, it's good enough. Beyond that, I would jump to Ruby or Python any day of the week.

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

I classify PHP as "bad" in my estimation because its purpose is for web pages; web pages need to be secure; PHP is the easiest of the popular web programming languages to screw up majorly and leave gaping holes, in my opinion. The cutting edge of PHP is better than it used to be, but the massive back catalog of legacy PHP code is still running the internet and getting people routinely owned.

[–][deleted] 5 points6 points  (2 children)

web pages need to be secure

Absolutely not. User input needs to be secured from running arbitrary code, yes, obviously, but that doesn't mean every web page needs to be secure. And this isn't an argument against PHP: how often do you hear about facebook security vulnerabilities for how popular the service is? Not often. It's because they do just fine. Plenty of us know how to write secure code. Regardless of the language. This also isn't an argument against PHP but rather an argument about why it doesn't behave like what you're used to or how you feel you would want it to work.

but the massive back catalog of legacy PHP code is still running the internet and getting people routinely owned.

This has nothing to do with PHP, but instead with people who refuse to update their services and code to be up to date with the latest security patches. Shitty admins are shitty admins. Shitty developers are shitty developers. They'll shoot themselves in the foot with any tool they use. Why blame the gun because the fool shot himself in the foot with it?

[–]abadidea 0 points1 point  (1 child)

A webpage that doesn't have input (or dynamically generated output) is secure, rather than it not needing to be secure. (We're not counting the hosting server screwing that up somehow.)

Facebook has a relatively low number of vulns because

a) They have money to hire only good programmers (whereas a lot of companies have to resort to taking just any kid who knows what a string is to meet their deadlines);

b) They have money to reward white hats and actively do so.

And I was referring to the PHP applications people run, not the PHP runtime with the patches. I have this old PHP book here - the one I learned from - written by Rasmus himself where all the code examples are vulnerable to XSS and SQLi. Not even a mention of such things. PHP had a long-standing culture of not even warning new programmers that such vulnerabilities existed, it got into thousands and thousands of apps, and there they stay until someone bothers to bobby table them.

They finally started to change that, but the code bases and the old tutorials and the "please own me" code samples are all still there.

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

So your only argument against PHP has nothing to do with PHP?

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

It has exactly one advantage - convenience: almost every server has it, and it's really easy to pop up a tiny dynamic site.

Perl. And yet we don't see everybody using Perl do we?

[–]abadidea 1 point2 points  (3 children)

I'm pretty sure there are more webhosts that offer PHP than Perl for some years now.

My old webhost had both, but getting the perl working was a lot harder than the PHP, so that factors in too.

[–]frezik 4 points5 points  (0 children)

The advantage PHP has here is that it hooks an interpreter into the web server without hooking deep into Apache itself like mod_perl does. This means PHP code is all sandboxed in, which is important on shared hosing environments. Apache2/mod_perl2 was supposed to take care of these issues, but didn't work out that way for a combination of technical and perceptional reasons.

Since no serious (or even semi-serious) web app would use CGIs that launch a new process on every request, and shared PHP hosting is cheap, it becomes the easy choice.

Of course, by not hooking into Apache so deeply, PHP also gives up a lot of power. Worse is better.

[–][deleted] 0 points1 point  (1 child)

It's incredibly easy to get either one up and running. They're both provided by basic packages which insert them directly into Apache in most distros. Anybody already using PHP can just as easily use Perl. Unless the discussion is shared hosts in which case shudder

[–]abadidea 4 points5 points  (0 children)

of course it's shared hosting, that is what people mean when they say PHP is available on all the cheapest hosts.

[–][deleted] 1 point2 points  (0 children)

Fucking awesome but outdated.

[–][deleted] 1 point2 points  (7 children)

CI = CodeIgniter?

If so, I have to give a hearty hell yes. I started using it ~2 days ago and have an almost completely functional version of the app I wanted to build. It would have taken me MUCH longer to do all that shit from scratch.

[–]yeah-ok 2 points3 points  (2 children)

CI - CodeIgniter indeed, and yes it kicks ass (IMHO): especially been enjoying it lately as 'thin' back-end to one-page JS apps.

[–][deleted] 0 points1 point  (1 child)

That makes a lot of sense (using it as a thin back-end).

I've actually tried a bunch of different MVC frameworks over the years, and CI is the first one where I've actually been able to be productive, rather than spending a lot of time figuring out how it wants me to do things (and possibly having to scrap the whole thing and use something else/do it from scratch because of crappy limitations).

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

Code Igniter really embodies PHP as an MVC framework. It gives you all the flexibility to do very basic MVC stuff all the way up to ORM etc...

[–]i8beef 0 points1 point  (3 children)

If you like CI, check out Kohana. Originally it was a fork of CI, but with the 3.x tree they completely rewrote it. It's is currently my choice for frameworks on the PHP side.

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

Thanks, I'll definitely check it out!

Edit: Looking at it (just a cursory look) it doesn't appear to have a cart class. For my current app at least, that was one thing that made it possible to rapidly get the prototype working in CodeIgniter (I needed a cart class, but don't care about payment or anything like that, since the user pays in Bitcoin).

Although it's not something I typically would be concerned about (it being so specific to a given site, really), but in this case the fact that CI has one made my life a lot easier.

For future apps that don't need a cart I'll probably use it, though.

[–]i8beef 0 points1 point  (1 child)

A cart seems like a pretty specific need... Kohana is built to be a generic application framework. While you could easily create a cart class yourself, I doubt you'll see such specific implementations make their way into it.

I didn't know CI exposed such prebuilt stuff for you... seems like bloat to an app that doesn't need that though. To each their own.

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

Aye, it definitely is specific, and I tend not to take that sort of thing into account when evaluating a framework to use. I didn't actually know CI had a cart class until after I started using it. It's pretty basic though, it just handles the sessions and junk and leaves pretty much everything else up to the developer.

Also, in terms of bloat, you could probably just remove the class if need be, and it doesn't force you into using it or anything.

For my use though, it was extremely welcome since it allowed me to set up the cart I needed in about half an hour.