Live data from Hacker News

Ask HN: Bet the farm. Python or PHP?

news.ycombinator.com

1–10 of 106 posts

Ask HN: Bet the farm. Python or PHP?

#1
1. Extensive support of libraries and frameworks. 2. Excellent community. 3. Rapidly develop and deploy. 4. Capable of scaling quite well.

Python and PHP score well on all four of these points.

I am about to embark on building a web app; calendar/scheduling/notifications with some social networking and people matching/search functionality. The site will be highly configurable/maintainable by it's community from establishing/interacting within groups to tweeking page layouts.

So far, I have chosen this stack:

Ubuntu, Apache (dynamic content), thttpd (static content), MySql, memcached.

I'm quite experienced in Perl but just a beginner in both Python and PHP yet I am determined to use either Python or PHP in my latest project.

I'm looking for the pros/cons and any other tips from the HN community. I'm at a fork in the road and I guess that once I make this choice, it'll be quite difficult switching after the initial framework is built out.

I'm not sure if I have/haven't given enough information to go on but I would appreciate everyone's input, not only on PHP or Python but on any of the other technologies I have chosen as well as critiquing my (currently vaporware) web app.

So which is it; PHP or Python?

Re: Ask HN: Bet the farm. Python or PHP?

#4
Why throw away Perl? You already know Perl, and Perl has lots of things that PHP and Python don't. Before you ditch Perl, look at DBIx::Class, Moose, and Catalyst. And the other 10,000 libraries on CPAN.

Then look at the 500 or so libraries available for PHP.

Perl has a really insane library culture, and it's very hard to give that up. I like the syntax of other languages better (Lisp is my favorite), but it's hard to give up the millions of hours of free work called the CPAN. Perl also has great tools for testing (see how many Test:: modules there are), and it has a culture of testing. So the libraries you download from the CPAN aren't some untested i-hacked-it-together-while-drunk snippets of code; they're all very carefully tested. What it boils down to is that when you move your app from development to production, you'll be reasonably sure that your libraries (and app) still work.

One line summary: Perl has more features and libraries than the alternatives, and you already know it! I think the choice is a no-brainer.

Re: Ask HN: Bet the farm. Python or PHP?

#5
>calendar/scheduling/notifications with some social networking

Why?

More and more web apps are coming out with social networking tied in, and very few of them succeed BECAUSE they have social networking tied in. Socializing a site is a bit more than giving people profile pages and enabling them the ability to "friend" people, at least that's how I look at it.

So my question to you is this: how are you planning to make the social aspect of your site actually work? How are you going to make the ad hoc benefits of social networking replicate to an online presence? Will people actually benefit from socializing, or are they just going to have friends who they will have the extraneous ability to leave comments about?

Re: Ask HN: Bet the farm. Python or PHP?

#6
post #4

Why throw away Perl? You already know Perl, and Perl has lots of things that PHP and Python don't. Before you ditch Perl, look at DBIx::Class, Moose, and Catalyst. And the other 10,000 libraries on CPAN. Then look at the 500 or so libraries available for PHP. Perl has a really insane library culture, and it's very hard to give that up. I like the syntax of other languages better (Lisp is my favorite), but it's hard t…

I really would like to use PHP or Python in a big project to at least get some experience.

I tell ya, I do love Perl.

With limited exposure to PHP and Python, could you elaborate on some of the things PHP and Python are lacking compared to Perl?

Re: Ask HN: Bet the farm. Python or PHP?

#7
What are your feelings as a beginner in each language? Have you found any little design decisions that leave you scratching your head, or make you start cursing loudly at the computer? Have you built anything with them? If so, did you run into any issues that you feel were a result of the language?

I'm a bit of a hedonist, but if I were in your situation, I'd probably try to pick the one that was the most fun to work with. As you say, once you've started building, it won't be (or maybe for you it will be?) as easy to switch, and you probably don't want to figure out that you hate coding in whatever you've chosen while trying to finish your web app.

When in a variant of your situation (PHP/a PHP framework versus Python/Django), I chose Python. I'm not you, so we may have totally different tastes and may have come to a different conclusion given the facts. I've been pretty happy with my choice, though.

Re: Ask HN: Bet the farm. Python or PHP?

#8
Python... both languages are along far enough that they will meet all four of your points, but people that program in python are on average better programmers than PHP programmers. So it makes hiring good hackers easier by eliminating many of the bad hackers.

Other than that, if you like the syntax of PHP, it is as good as python as long as you program using the MVC paradigm. Personally I like the syntax of python a whole lot more than PHP.

Re: Ask HN: Bet the farm. Python or PHP?

#9

What are your feelings as a beginner in each language? Have you found any little design decisions that leave you scratching your head, or make you start cursing loudly at the computer? Have you built anything with them? If so, did you run into any issues that you feel were a result of the language? I'm a bit of a hedonist, but if I were in your situation, I'd probably try to pick the one that was the most fun to work…

Thus far, I've built very simple pieces of PHP such as logins, maintaining sessions, writing/reading to/from MySql. My one concern with PHP is the overwhelming "alphabet soup" of functions.

I haven't done anything web-facing with Python just yet, just using it to; parse files, some socket programming - basically getting a feel for the language.

So far, I couldn't say I've run into any issues resulting directly from the languages themselves.

Thanks for the input.

Re: Ask HN: Bet the farm. Python or PHP?

#10
Go with Python. PHP is probably the worst language I've had to use (Single namespace, poor unicode...)

Python on the other hand is pretty cool. It can be OO, functional, or procedural depending on how you want to look at it. It also has a lot baked into the standard interpreter and has some really awesome frameworks (Django, Pylons)

Post reply on HN