Live data from Hacker News

PHP Addiction

marco.org

141–150 of 320 posts

Re: PHP Addiction

#141
post #69

The only thing actually wrong with PHP, is that it's popular but not cool. And that's a terrible place to sit for any product. It runs half the Internet quite well, but if you went by the posting on HN, you'd think it was Windows Vista. I've probably read every article critical of PHP that has hit the front page of HN in the last few years, and the one thing they all have in common is the vague refrain that PHP is a…

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

I don't know enough about MySQL vs Postgres or RedHat vs Ubuntu to make a point with them, but sometimes it's not about being cool.

Apache is a webserver from 1995. It uses a process (sometimes a thread) per request, a architectural decision which made it nearly fundamentally incapable of solving the C10K problem. Only back in January was the Event MPM added (and it's still experimental), allowing you to have many Keep-Alive connections open at once without degrading performance. Nginx was started in 2004, and is event-based allowing for much higher concurrency. (Yes, I'm hand waving.)

PHP is among the worst languages most sane programmers have ever used. The referenced article, "A Fractal of Bad Design" is a pretty good starting point if you want more details on why it sucks. PHP stands for letting amateurs code effectively. Python is designed with an emphasis on readability, and manages to have a rational type system and a fairly regular standard library.

Apache vs Nginx is about learning from the mistakes of your ancestors. Apache was designed with the 90s in mind, and our technology has moved on to the point where the decisions made in its architecture simply don't work anymore.

PHP vs Python is about being a rational, non-masochistic, human being.

To say what is cool "has nothing to do with any objective qualities of the [technologies involved]" is to know nothing about programming as a business.

Re: PHP Addiction

#142
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…

> If you've never seen anything other than PHP, you won't understand two thirds of the list or why they're problems. Two thirds of that list are actually incorrect. But I programmed in Java, C++, C, VB, and so on before I started coding in PHP many years ago. So many years ago, in fact, that PHP was easily the best choice. The problem with lists like that is they obscure the truth -- and that is -- that solving a pro…

> Two thirds of that list are actually incorrect.

Got a link to a good rebuttal?

Re: PHP Addiction

#143

Earlier quoted context omitted.

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?

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

Re: PHP Addiction

#144

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.

Re: PHP Addiction

#145
post #7

I'll sound like a broken record, but I'm convinced Flask is the perfect transition. It's built for smaller web apps, and rapid prototyping. The system of mapping endpoints to functions is incredibly intuitive -- if you've used Python before, learning Flask is incredibly easy.

[deleted]

Re: PHP Addiction

#146
post #121

Is it my imagination or is Marco the king of writing blog posts that are quick reactions to whatever is trending on HN? The message you should get from this post is that familiarity with one's tools easily trumps any aesthetic flaws (consistency in parameter ordering, naming conventions, etc are really nothing more than aesthetic flaws and not "deep" [1] as the author suggests. After all, human language is inconsiste…

> Linux (over OSX) does actually have a package system

I found running a VM on my mac to be the best of both worlds. Plus you can backup and distribute your VM so the entire team develops on the same setup.

Re: PHP Addiction

#147
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.

Actually, I find Python and Ruby much more interesting than Java (actually, Java seems as a boring language :) ) . But since Java is general purpose language and it's known as market skill, I want go for it.

Re: PHP Addiction

#148

>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. The real answer is "it doesn't matter". Of course python people will try to convince you to use python, and ruby people will try to convince you to use ruby. But both groups will agree that either language is far better than PHP. And as someone who likes neit…

The choice does matter. A lot. When I started with ruby, I had to decide between 1.8, or 1.9, or jruby, or several other choices. Then I had to pick sinatra or rails or merb or whatever. mongrel or passenger or thin or unicorn. It didn't really seem like the choice would matter, but then you run into some tiny annoyance, do a bit of research and find out that some other framework doesn't have that problem. So you swi…

You have to choose between all the same kind of stuff with PHP too. The position was "I'm using PHP, and I can't switch to another language because I am afraid I'll pick the wrong one". That position is silly, because anything you pick is guaranteed to be better than PHP. There's no "wrong" between python and ruby, they are for all intents and purposes the same.

As for your specific case, writing your own framework in lua doesn't make ruby a wrong choice. You could have written your own framework in ruby too. Or perl, or python, or even one of those dreaded compiled languages.

Re: PHP Addiction

#149
Whatever language you are fluent in, its going to be difficult to switch to another language. Sure, I get the syntactical sexiness of Python, but learning its proclivities really would take years.

The fact is that my comfort with PHP stems from knowing what I know, knowing there are things I don't know, knowing there are unknowns I don't know, and knowing there are unknowns that are unknown. (Thanks, Rumsfeld)

Its this grasp on the language that gives me comfort. Mix that in with the universality of PHP and I'm more than willing to take my lumps for being told I solve problems using a shitty language.

There are shitty guns and shitty marksman. A good marksman can kill you with a shitty gun, but a shitty marksman will always be a shitty marksman.

Re: PHP Addiction

#150
post #79
post #41

"...next language choice was clear: Python, which seems to fit my style better than Ruby" Just out of curiosity, why would someone believe this? The syntax of python and ruby are nearly identical, but ruby has more tools and support for web-based projects. For someone looking to develop for the web, ruby is pretty clearly a better choice. And this is not knocking python at all, I really enjoy them both and there are…

Just by looking at a syntax table, the higher-level differences are not going to be enumerated. Just off the top of my head: - Ruby was always designed as an OO language, whereas Python OO was bolted on later. Ruby's object system is almost a straight transplant from Smalltalk and is very powerful. - Python lambdas can only be one liners. Ruby lambdas can be arbitrarily long. Guido doesn't really like FP - there's no…

While I find Ruby to be nice overall, you're wrong on several points:

- Whether or not Python was historically OO or not, everything in Python is now an object. Its love for protocols drives design like `str(foo)` (which calls `foo.__str__()`), not any particular deficiency in its object system

- Python's lambdas are indeed limited, but one can easily use `def` and just name the function. Functions are first class, after all

- Metaprogramming facilities are very similar in power. Neither language has macros.

- Python tends insist on not duplicating things (i.e. both indentation and braces/end) and on not being ambiguous. There is another reason Python can't omit braces for function calls: without braces, they are references to the function. As a consequence, Python doesn't need things like .call()

Overall, I haven't seen one language or the other to be more powerful.

Post reply on HN