Live data from Hacker News

PHP Addiction

marco.org

151–160 of 320 posts

Re: PHP Addiction

#151

I propose this as a blueprint for a solution: {% name = request.get('name','world') list = ['this','language','rocks'] %} Hello {{ name.upper }} {% for item in list %} {{ item }} {% endfor %} Save it as 'index.nxt' and run it in any future language you are going to design. Create a mod_next and try it on any web server like apache, nginx, etc. It should work without any extra fiddling with config files or installing…

You have just mixed HTML and server code. You fail.

That's php, just cleaner. If we don't recognize that as one of php's strength we're doomed to fail.

Of course once you master it, you separate the code from the html and call it from the view like this:

hello.nxt

    name = request.get('name','world')
    list = ['this','language','rocks']
    response.render('hello.html',name,list)
hello.html

    Hello {{ name.upper }}
    
    {% for item in list %}
        {{ item }}
    {% endfor %}
    
But what do I know about language design or human behavior?

Re: PHP Addiction

#152

Earlier quoted context omitted.

| Who cares? Honestly? Exactly, who cares?

My point is that "ease" of "Hello World" does not translate to "ease" of developing [anything 'real'].

My point is this whole thread, the article linked, my reply, your reply. Who cares?

Re: PHP Addiction

#153
post #69

Earlier quoted context omitted.

> The only thing actually wrong with PHP, is that it's popular but not cool. Hey now, we're all human. Even engineers. As soon as something becomes popular, it is no longer cool. Cool is the next popular. Cool is being different. That's just how things work. Apache is slooooow (NGINX is cool!). MySQL is retarded (Postgres is cool!). PHP sucks (Python is cool!). Red Hat is lame (Ubuntu is cool!). See a trend? The tech…

> It has nothing to do with any objective qualities of platforms. The problem is, it often does take into account objective qualities. The downsides of popular platforms are often ignored because they carry with them all the advantages of popularity: good support, a well-established community, a wealth of experienced people you can hire or draw upon. These are not "objective qualities" of the technology, but real sid…

There's a delicate balance between healthy skepticism that comes from experience, and enthusiasm for trying new things.

Going with cool new things for everything is very risky. This is terrible for established businesses, it's great for startups with no legacy and no pressure to maintain inertia. There cultural differences are endemic to the realities of both types of businesses and aren't just the product of politics.

Re: PHP Addiction

#154
The fear of making the "wrong" choice actually makes the familiar, mastered PHP more attractive.

The multi-core reality means that the long-term languages will have a strong concurrency model. Clojure and Go are two languages with strong concurrency models that are building momentum and have potential to go mainstream.

But for your first foray out of PHP, I would pick a language that has a large, well-established community with mounds of documentation, books, and resources.

My path out of PHP would be:

  1. Python
  2. Clojure
  3. Go
Learn Python first because it's easy to learn, easy to read, and it's taught at major universities so it's easy to find smart people to help. It has a large community behind it, which is still building momentum, and it has a huge library so it's generally more useful than Ruby.

Then once you're comfortable with Python, I would venture into Clojure. It's different, but in a good way. And you get access to all of Java's libraries so it's practical now, even though it's relatively new.

And then look at Go. Go is building momentum fast, but right now it doesn't have the massive libraries that Python and Clojure have. However, in a few years, this will change.

Re: PHP Addiction

#155

If you're a really good PHP developer and are considering using another language, you should ask yourself one question: Why do I need to switch? You've already gone through the pain of learning how to work around all of its warts, and you will lose a ton of productivity immediately after switching to a new language. This may seem trivial if you are just programming as a hobby (and fun, even, to learn something new) b…

There's a bit of a false dichotomy there. You don't just have to immediately switch or not. It's worthwhile to learn new languages regularly, whether you use them professionally or not. Keep working in PHP and do a small project in something else. Easy transition if you keep going deeper into this new language, or easy to change your mind and go back to PHP.

Re: PHP Addiction

#156

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 e…

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.

Everyone should be skeptical of claims that include the word "everyone". Here's some history of ice cutters who did adapt; their business established in 1848 is still operating today:

http://www.capepondice.com/company_history.htm

Re: PHP Addiction

#157
post #67

Earlier quoted context omitted.

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 referenc…

To further your point, if C# MVC4 ran flawlessly on a free and open mono/nginx type setup, I'd run to it like a forlorn lover across an open meadow.

There are alternatives, but nothing that simply 'just works' like PHP seems to.

Re: PHP Addiction

#158
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 the argument being made here is not that page-is-program model is superior; it's that it's much easier to understand for newbies coming into the field.

Re: PHP Addiction

#159
post #67

Earlier quoted context omitted.

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…

The page-is-program model still works as well as ever. It's just that, if your problem is so simple that the page-is-program pattern is most appropriate -- for example, if you are eight years old and you want to build a page that serves up a different picture of a dinosaur every time it gets reloaded -- you should just use PHP. Why choose anything else? It's true that other languages have not wasted a lot of time try…

Vestigial is the right word; a characteristic of a surviving species that isn't particularly relevant to the question of why they survive. While debate goes back and forth between the various potentially-vestigial organs we may possess, it seems clear that if the appendix contributes anything to humanity's survival, it isn't very much. Also, vestigial tends to imply it isn't actively harmful, which I don't think it is because PHP certainly works just fine with other models as well. (If it were only page-as-program, I'd have another opinion... but it would probably also not be doing anywhere near as well on very large sites and we probably wouldn't still be talking about it as anything but a historical language.)

You may disagree that my characterization is correct, but it is certainly the characterization I intended to convey. That's why I parenthetically commented that I think the real reason it has carried on is another one, to contrast the relevant characteristics to the irrelevant ones. Creating a new "PHP-killer" and focusing too much on the vestigial features of PHP is a recipe for failure.

Re: PHP Addiction

#160
post #104

The only thing flawed with PHP is your outlook on it. People with money (investors, clients, etc.) don't care about ANY of the nuances mentioned here or by Jeff Atwood. At the end of the day, we use PHP and are rewarded for doing so. If you want to use another language or make a new one...Great. Do it. But I'm not sure why some people just want to try to change an entire industry and move people off of PHP... It make…

In a few years most NEW projects will probably not be made in PHP. You are suffering from Cognitive Dissonance, PHP is not good.

And you are suffering from cognitive bias?
Post reply on HN