Live data from Hacker News

PHP Addiction

marco.org

131–140 of 320 posts

Re: PHP Addiction

#131
post #101

Earlier quoted context omitted.

Ubuntu is more popular than RedHat Linux

Not for servers. Which is what we're talking about.

I was a bit doubtful, so I looked it up... turns out you're only somewhat right: CentOS + RHEL are about 40% together (28.7% + 11.6% = 40.3), but Debian + Ubuntu are over 50% at (30.8% + 19.8% = 50.6). Arguably Debian is not Ubuntu (which is why I say you're somewhat right), but it is just what Ubuntu sysadmins grow up to, and has even more of a cool underground factor, despite being the most popular server distro. Of course RHEL and CentOS are the same thing as well.

Source: http://w3techs.com/technologies/details/os-linux/all/all (accuracy not entirely trusted, but it appears roughly accurate)

Re: PHP Addiction

#132
On PHP:

This discussion seems to be missing a key factor: context.

I seriously dislike PHP and its inconsistent, unpredictable features and libraries. I avoid PHP whenever reasonable/possible. I also avoid talking to mean, verbose or dumb people whenever reasonable/possible. But sometimes I just gotta do it...

So I use PHP, Python, [Java|Coffee]script, Ruby, Django, Pyramid, Express, Wordpress, Joomla, or whatever else is the right tool for the context/job.

In the context of building a 100M request/month API server, I used Python + Django. I would never have used PHP and I consider it a serious mistake to build large scale systems in PHP. Of course, others would choose Ruby, Clojure, Java, Scala, etc and those are all reasonable answers. I happened to be able to get the thing up and running fastest and most effectively in Python + Django.

In the context of currently re-building a client site that needs social features, a small CMS, etc, we're using PHP and Wordpress. I would never have used Python + Django because the client would not know how to host it and whomever is called on to fix a template is going to have to set up a Python stack, learn git and SSH, log into a VPS, etc in order to tweak anything.

Blends are good, too. We recently worked with a client where the website and application were built in PHP/Wordpress, but their API was Python. The "application" was basically a handful of Wordpress templates that pulled API data. They got the nice little CMS interface of Wordpress which made the website admins happy, but the developers got to do the heavy lifting in Python. Their anti-PHP developers were quite happy with the arrangement.

On Marco's post:

    If you can get PHP programmers to agree that they need to stop using it, 
    the first question that comes up is what to use instead, and they’re met 
    with a barrage of difficult choices and 
    wildly different opinions and recommendations.
Yep and that's true of everyone who's ever behind a curve when the curve is shifting. The ice cutters knew about refrigeration, but couldn't adapt. And the curve doesn't always just shift up or down; sometimes it branches crazily and the only way to adapt is to jump into the fray. Even then bad things can happen: Kodak predicted digital cameras, jumped into the fray and basically invented everything and they still got crushed by the digital camera transition.

I think the tension for PHP developers is in understanding on a personal-level how and when to make the transition to newer languages. Unfortunately, many seem to ignore the possibility that a transition is underway.

Re: PHP Addiction

#133
post #105

I have the same problem nowadays and think about migrating to Java for web development. I heard about Play! framework very much. Do you think Java is a good idea for web over Python and Ruby?

Many people (myself included) find Java too limiting. Many others like it.

But even Java is so much better than PHP. If you like it, go for it.

Re: PHP Addiction

#134

>"Whichever language I choose to replace PHP will have its own problems that will take me years to master" What? Really?

There is some truth to this. However, if you define a "better language" as one which is more consistent and predictable and less buggy, that implies less time to master. One thing I love about Ruby is how many methods suggest one another. For example, Enumerable collections, like arrays, have an `any?` method. It takes a test function and returns true if any of the items pass that test. [1, 2, 3, 4, 5].any? {|i| i >…

If all someone knew was PHP, maybe they would struggle to learn something else, but in my case, if I immerse myself in something and learn it and use it, it's not going to take me years to get productive with it. Especially given the limited things that PHP can do, learning to do those in python/ruby/C#/Go took... trivial amounts of time. With the benefit of more functionality and a sane API. (and in two cases, static typing)

Alternatively, if all I knew was PHP, I would understand why someone would be scared of learning something new. I mean, look up and down this thread. Everyone thinks a one-liner hello world is the pinnacle of the ultimate web dev language. Because real web frameworks require an http handler, they assume it's more work or harder. To me, it seems that many in the "PHP is easier!" crowd are too scared or lazy to take the time to learn something else and realize that better separation of concerns and tooling actually allows for faster and safer development.

Re: PHP Addiction

#135
post #4

Earlier quoted context omitted.

x3 - it's far simpler to learn due to consistency, more powerful to do both low & high level programming and a pleasure to work with. Just as simple to setup for web as php. Not real reason to be in knee deep php mess.

As easy as PHP in what sense? That Python is basically part of all OS' now or as easy as putting in in a .php file and uploading it to your server? I severely doubt it's as easy as the latter. I'd like to see an article that explains in less than 140 chars how to deploy a simple app as Hello World to the web in Python without the use of a framework like Django or Flask. Edit: In the amount of chars Twitter accepts, h…

sudo apt-get install ruby-full build-essential rubygems apache2 && sudo gem install rails && rails hello && cd hello && rails generate controller hello && rails script/server && wget http://127.0.0.1:3000 -o -

Wait, that didn't work. I got all kinds of errors and warnings. I must have the wrong version of something. You win, point taken.

There should be an easier way. I should be able to just run "apt-get install rails-easy" and have a system that is completely configured for development.

Re: PHP Addiction

#136
post #58
post #29

How do PHP people handle templating simply? Edit: Perhaps I worded my question wrong. How do PHP programmers try and keep to DRY (ala layouts and view templates)?

Since PHP is a template language at heart, they go ahead and use PHP. For PHP folk, I guess the question is: how do people handle templating simply in other languages, since they can't use the host language itself for that? EDIT: Disclaimer: I'm a PHP guy trying to make a break for it, and the question was both rethorical and tongue-in-cheek.

In Python, I've always used string substitution. I've never understood the need for a special templating system when it's already built into the language:

    template = """%(greeting)s"""
    parts = {'greeting': "Hello, World!"}
    page = template % parts
I create my site-wide template in a module and never have to look at it again, so my application code is mostly logic. When I have to work on PHP or Coldfusion, I don't understand how people can bear to have the logic hidden in a markup language that's mixed up with another markup language. Many can't, and that's why there are templating engines for what are essentially template-based languages.

Re: PHP Addiction

#137
post #83

Earlier quoted context omitted.

Are you seriously basing a whole argument on what the hello world program looks like? That has nothing to do with actual real world programs. Mixing logic & presentation might make it easier to get something running quickly, but it's one of the downsides of PHP that these things get mixed up when they probably shouldn't for a project of reasonable size. The whole idea that it's an advantage of PHP that you can get so…

> Actually, it's much better if it requires some amount of thought and planning to code something up because that increases the likelihood that you'll do it right the first time and build on a solid foundation. This is solid advice for an engineer. And absolutely moronic for a businessman. Choosing what platform to use is a business decision. If you take too long to get it right, you will never get the chance to make…

Plus, if you're trying to get new people to use your language, having a complex toolchain is going to scare them off.

"Hey kid, first one's free"

Re: PHP Addiction

#138

Earlier quoted context omitted.

As easy as PHP in what sense? That Python is basically part of all OS' now or as easy as putting in in a .php file and uploading it to your server? I severely doubt it's as easy as the latter. I'd like to see an article that explains in less than 140 chars how to deploy a simple app as Hello World to the web in Python without the use of a framework like Django or Flask. Edit: In the amount of chars Twitter accepts, h…

Who cares? Honestly? I'm shocked and appalled that the measure of ease of a web development language is the trivialness of a Hello World. This willy-nilly nature of PHP leads to the disaster that it is today. The language and API are, at every turn, willy nilly. The projects that use them are constantly rewriting and refactoring to follow a new or better pattern or organization. I haven't touched python in too many m…

| Who cares? Honestly?

Exactly, who cares?

Re: PHP Addiction

#139
post #67
post #33

Here is another point that highlights the problem: If I want to write a hello world application in PHP, it's neither as long as nor as short as Rather it's simply: hello world. Just type in those 11 characters in a text file and save it as hello.php. Now load it on your browser [or run it from command line] and it will print hello world. I don't think it can get any more simpler than that in other languages. PHP was…

I'm not convinced this is true. You see, way back in the day in 1997 when I was doing web dev, everything worked the way PHP does. ColdFusion, ASP ( not ASP.net, ASP), PHP, and almost everything else that was seriously trying to do web pages worked that way. It took the community collectively a long time to stop seeing URLs as identifying anything but specific files. This is back when having those files be programs w…

I think z92 is on to something.

Ease of install is part of the same pattern. PHP has always been easy (with connections to a free database), and got easier with good package management systems. What's coldfusion like for ease of install, ease of install with database access?

ASP for Windows was huge. It was even easier to get started on than PHP because you just needed to install IIS from a EXE and you could reference access files. The only reason it's not still massive is that MS moved on.

Re: PHP Addiction

#140
post #49
post #13

That's one of the problems with the now-famous Fractal blog, I think: It was a joy to read in the sense that being a Python programmer, it only heightened my appreciation of the achievement that languages like Python and Ruby represent. It's what conscious, determined design gets you and what mistakes they managed to avoid. But it's preaching to the choir. If you've never seen anything other than PHP, you won't under…

> How do we communicate effectively what makes other languages better to someone with no reference frame other than PHP itself? You're trying to convince yourself that you made the right choice, the right investment. That's sad. Have confidence in yourself. You made the right choice for yourself and let others choose for themselves . There is no universal proper language or platform to use. PHP works and it works ext…

> You're trying to convince yourself that you made the right choice, the right investment.

> That's sad.

Err, huh? What's with the preachy tone and the presumptuos attitude there? No, I don't need to convince myself, nor am I looking for confirmation - I know that I'm happier coding in Python than I was coding in PHP, that I get more done in less time, that I've vastly increased the average reusability of code that I write, and that it blows up less in production.

> Have confidence in yourself. You made the right choice for yourself and let others choose for themselves.

That's not what this is about. It's about how I didn't make a conscious choice to use PHP back then - nor would I have if I had been in a position to make a choice. I believe the same is true for many others, so how do we get to a point where they have the facts to make a choice?

> Python on the other hand ... aside from Google, who's using it at a massive scale? Even Google has been shifting to Java for a long time.

Shrug. It's you who's playing up the PHP vs. Python angle here, really -- for me there's plenty of stuff out there that's better than PHP, not just Python.

> If you're convinced that there is no proper application for PHP, then you're not even trying to be objective ... you're just trying to make yourself feel better about the choices you made.

Actually I think there are circumstances where PHP is the right choice, though it's mostly a matter of market considerations, certainly not technical strength.

Post reply on HN