Live data from Hacker News

Ask HN: Why not PHP?

news.ycombinator.com

1–10 of 33 posts

Ask HN: Why not PHP?

#1
Forgive me for the naive question, but: why is PHP considered so inferior to Ruby/Python?

And, as a beginner, do you recommend going with PHP to start with, or straight into Ruby/Python?

Re: Ask HN: Why not PHP?

#2
Python may be the best language to learn if you've never done any coding before. Clean syntax, straight to the point, etc.

However, I'd say Ruby fills the RAD a bit better than Python, and Python is is not a language that scales, so aside from little scripts it's not exactly a language that's conquered a niche.

Go with Ruby or Java if you plan on making something useful right away.

Re: Ask HN: Why not PHP?

#3
You will receive as many different answers to this question as there are people. Focus on patterns of software development, techniques, and less on the specific language. It will get you further.

Re: Ask HN: Why not PHP?

#4
post #2

Python may be the best language to learn if you've never done any coding before. Clean syntax, straight to the point, etc. However, I'd say Ruby fills the RAD a bit better than Python, and Python is is not a language that scales, so aside from little scripts it's not exactly a language that's conquered a niche. Go with Ruby or Java if you plan on making something useful right away.

I think I might have misread what you've said - Are you saying Ruby somehow scales better than Python?

Re: Ask HN: Why not PHP?

#5
why is PHP considered so inferior to Ruby/Python?

When I studied English in college, I discovered that the English language is a very poor choice for writing poetry because it is a very rhyme-poor language. For that, look to French or Italian. English is such a mess of a language, with irregular forms and inconsistent pronunciation. But if you're not writing poetry, English is your best bet, because more people speak it than any other language. You're going to find more books written in English and people who read them, and more people who speak your language.

PHP is the English of the programming world. Python and Ruby have cleaner syntax and consistent programming conventions, but more people speak PHP. There are lots of resources for PHP and lots more developers who know PHP.

If you find yourself in a remote fishing village in China, you're more likely to find one person there who speaks English and knows PHP than one who speaks Italian and knows Ruby.

Re: Ask HN: Why not PHP?

#7
The standard gripes about PHP:

- PHP's syntax is very random. There are over 5000 builtins and no consistency among them.

- PHP lacks (or lacked until relatively recently) many programming niceties such as objects, types, closures, lambdas, and namespaces. To do anything interesting, PHP developers rely on globals or dubious innovations such as using a string as a function name.

- PHP relies on a web-serving model where the program invocation is done in milliseconds. Even if you can (with difficulty) use PHP libraries in command line programs, it's very inefficient for anything like a long-running daemon process.

- Although it is almost always built into a web server, PHP doesn't make it easy for you to do anything useful with web requests -- such as custom authentication in a separate phase from content generation.

- Since it's a web templating language at heart, PHP practically begs you to do the wrong thing and mix presentation and data. To solve this, many shops use a templating language on top of PHP, which does feel kind of silly.

- Due to its ubiquity, PHP is the choice of script kiddies who can't program. The comments on the PHP.net documentation site are mind-numbingly naive sometimes. So even experienced programmers feel dirty using PHP.

That said:

- Among comparable languages, and for typical web serving tasks, PHP is fast. Really fast.

- It's probably already installed on your platform of choice.

- Within the web-serving paradigm, it has almost everything you would ever want.

- Its model of programming is really brain-dead, but it also can keep you out of trouble since you're forced to do everything in a REST-compatible manner.

- It's also the choice of websites like Yahoo, Flickr, Facebook, and Wikipedia, so you know it is battle-tested.

Re: Ask HN: Why not PHP?

#8
post #2

Python may be the best language to learn if you've never done any coding before. Clean syntax, straight to the point, etc. However, I'd say Ruby fills the RAD a bit better than Python, and Python is is not a language that scales, so aside from little scripts it's not exactly a language that's conquered a niche. Go with Ruby or Java if you plan on making something useful right away.

Python is used by Google, Youtube, NASA, and Reddit. It scales, it's faster,uses less RAM, and is much saner than PHP.

Re: Ask HN: Why not PHP?

#9
post #4
post #2

Python may be the best language to learn if you've never done any coding before. Clean syntax, straight to the point, etc. However, I'd say Ruby fills the RAD a bit better than Python, and Python is is not a language that scales, so aside from little scripts it's not exactly a language that's conquered a niche. Go with Ruby or Java if you plan on making something useful right away.

I think I might have misread what you've said - Are you saying Ruby somehow scales better than Python?

No, I'm saying python suffers from the 'jack of all trades master of none' problem. It's not as well suited as Ruby for RAD, nor does it scale near as well as Java. It's a bizarre niche to fill.

Re: Ask HN: Why not PHP?

#10
post #7

The standard gripes about PHP: - PHP's syntax is very random. There are over 5000 builtins and no consistency among them. - PHP lacks (or lacked until relatively recently) many programming niceties such as objects, types, closures, lambdas, and namespaces. To do anything interesting, PHP developers rely on globals or dubious innovations such as using a string as a function name. - PHP relies on a web-serving model wh…

>PHP is fast. Really fast

Compared to WHAT? Ruby and Perl? Cause I hope you're not saying it's C fast, or even java or C# fast...

Post reply on HN