29 comments

[ 5.2 ms ] story [ 218 ms ] thread
It seems to me that most of the people here work in Ruby/Rails or Python... what about PHP? is this dead or something for the startup world?
No, PHP isn't dead. But most people here won't be a great company either because they chose RoR/Python because of the hype.
I am extremely adept and comfortable with PHP. I've been using it for years. I'm learning python, but I'm still deciding if I'll need to learn rails or not. Is the time it'd take me to learn rails, really saving me time in the long run? I can do pretty much anything in PHP that could be done in rails. I'll still look into it though. I'm not one to jump on a band wagon, but masses of people don't move themselves by just themselves... not all the time.
If you're good at Python, you probably don't need to learn Ruby. I hear Python has some frameworks that are comparable to Rails. Hopefully, someone that knows both will be able to answer this question more in depth for you or point you to one of the endless essays on the subject available on the web.
http://www.djangoproject.com

It's what I'm learning/using at the moment and I'm really enjoying it. I like Python primarily because it's a very well thought out language and the Django frameworks leverages this nicely.

The other notable Python web frameworks are:

Zope, found at: http://zope.org Plone (which is really wrapper around Zope), found at: http://plone.org TurboGears, found at: http://www.turbogears.org/

It isn't the tool that is important but what you do with it. PHP is a pretty good tool. Rails is the (relatively) new shiny tool. You can build fantastic or crappy things with either one.
Yes, but Rails at least points you in a good direction, with some good practices to use.

With PHP, you can write good code, but you have to be really careful, because it's easier to write bad code, and there are more PHP coders out there who do not know what they are doing.

Check out Cake: http://www.cakephp.org/
Sure, it looks nice, if you're into PHP, but now that I'm on my own, there is no way in hell I'm touching that language. Life's too short:-) Just my opinion though, there are plenty of people doing cool, productive, lucrative things with PHP.
Currently, I'm doing everything in PHP, I know it, I love it. Sure I'm experimenting with Rails localy but Rails still hasn't appropriate support at hosting providers and Python after so many years also isn't widely supported and won't. Hope, Python's fate will be not Ruby (rails) fate.
It doesn't matter. Youtube is PHP (if I'm not mistaken). Lots of startup sites are. The only consideration that really matters at this point are the coders you work with. What do they like?
Sorry, YouTube is written in Python
Code Igniter for PHP (codeigniter.com), anyone tried it?
PHP scales well:

Yahoo and Facebook are the leading PHP sites.

PHP is efficient:

It's a compile-then-execute language and a lot of the standard functions just hook into C code.

PHP is maintainable:

Well written PHP code is easy to maintain, have a look at the Wordpress sources.

PHP has good support of OOP:

PHP5 introduced many of the standard OOP features lacking in PHP4.

PHP is straight-forward and easy to learn:

That's why it's so popular. But it's also why it has such a bad reputation - PHP makes it easy for novices to build websites with terrible code.

PHP is a domian specific language:

Of the popular scripting lanaguages, it's the only one designed specifically for running on web servers. Perl, Ruby and Python are general purpose languages which can also be used for web scripting.

In summary, if you want to build efficient, scalable websites then PHP is a very good choice.

Some people look down their noses at PHP, but if anyone thinks that PHP is a blub lanaguage then try solving the following puzzle in your favourite language:

http://www.facebook.com/jobs_puzzles/?puzzle_id=5

I've written a solution in PHP which runs in less than one second.

The point being, there's no such thing a blub programming languages, only blub programmers :-)

there's no such thing a blub programming languages, only blub programmers

There is such thing as blub languages, and the tragedy is that these languages attract blub programmers, or even worse, allow "blub" people to become programmers :)

PHP is efficient

As long as it resolves symbols (variable and function names) at run-time instead of compile-time, it can't be efficient. Unfortunately the language itself implies this behavior so it can't be changed.

PHP is maintainable

It took me years to figure how to write really nice and maintainable PHP code. There are some forgotten languages out there, like Turbo Pascal, which forced you to write maintainable code from the beginning. They taught you to think of interface/implementation relationships all the time.

PHP has good support of OOP

Screw OOP, pardon my language. It gives nothing but an illusion of maintainability, while in reality you end up with a bloated code that otherwise could have been X times smaller.

PHP is straight-forward and easy to learn

No programming language is straight-forward unless you know all internals. It can be quite straight-forward to learn array manipulation in the manuals, but much harder to understand the cost of each of those methods.

Only good thing about PHP is that it's a dynamic language with dynamic strings and lists/arrays, it is embedded (in HTML) and is largely supported. And that's all you need for server programming on the Web.

There is such thing as blub languages

But PHP is not one of them, it's perfectly suited for the web. I personally find it easier to identify blub programmers than blub languages ...

As long as it resolves symbols (variable and function names) at run-time instead of compile-time, it can't be efficient.

That includes all dynamic languages i.e. Lisp, Ruby, Python, Perl, Smalltalk, JavaScript, Eiffel, Erlang, Forth, Lua et al.

No programming language is straight-forward unless you know all internals.

True, but as you say, that applies to any language. PHP is a very easy language for novices to pick up.

OOP ... gives nothing but an illusion of maintainability, while in reality you end up

In my experience OO code tends to be easier to maintain, and so long as you don't over do it, efficient.

Only good thing about PHP is that it's a dynamic language with dynamic strings and lists/arrays, it is embedded (in HTML) and is largely supported. And that's all you need for server programming on the Web.

That's why I recommended it as a good choice for web programming.

That includes all dynamic languages i.e. Lisp, Ruby, Python, Perl, Smalltalk, JavaScript, Eiffel, Erlang, Forth, Lua et al.

Ok, but you said PHP is efficient. I say, PHP is efficient as much as the language itself allows it to be. If there are many late-binding languages around and PHP at least doesn't look bad compared to them, it doesn't mean it's efficient. Late-binding offers some new possibilities in programming of course, but the price is high and programmers should be aware of that. And when it comes to computationally intensive tasks (encryption, graphics, any hardware-related task), you can't trust programmers who are entirely into dynamic languages, no matter what they say about their favorite ones.

That's why I recommended it as a good choice for web programming.

What other languages do you master as much as PHP?

C and JavaScript.

I worked with Perl before PHP but never grew to like it (it's not consistent enough and not exactly easy on the eyes, either).

I do understand the tradeoff between efficiency and power, and PHP hits that sweet spot just right for web programming.

Worrying _too_ much about language efficiency when it comes to web programming is clearly a case of premature optimisation. PHP is efficient enough (probably Perl and Python as well, maybe not Ruby ?).

Worrying _too_ much about language efficiency when it comes to web programming is clearly a case of premature optimisation.

Well, sometimes it's a question of a choice between upgrading your hardware and optimizing your code (or even re-writing in some other language). Which is cheaper? I'm into it right now, haven't decided yet ;)

... and Flickr too, BTW.
I wrote this in Ruby & C (for the prime finder) and it runs equivalently fast (under 1 second)
how about Symfony framework for PHP? did anyone try it? what do you think about it compared to other PHP frameworks, like Cake?
I use the CakePHP framework, took me few hours to learn it. They have good support and lots of examples (small and large projects)
I'll say it again, language wars only take time away from actually building something (especially when the options are relatively similar in effectiveness). Pick your poison and go.
I hate PHP, but I use it in my startup for three projects (sorry, for the fourth we are switching to Ruby but without rails, just mod_ruby), and actually without PHP my startup that is now working well and is profitable could not be here at all.

Reason? My co founder is a smart guy but was not exactly an hacker, it was a problem solver that used PHP and other tools to write web apps for a living. Now he is learning Ruby so we can switch language the next time, but without PHP the number of available co founder in your area and possibly your own friends (like my co founder is) may be near to zero.

I need to add one thing: we have a library called "utils.php" that tries to add something of useful to mitigate a bit the absurd library of PHP and add things like memoization, and I must admin that using a "functional" programming style where functions take PHP arrays and return PHP arrays, and clean design, it is possible to write decent code even in PHP.