Live data from Hacker News

Ask HN: Bet the farm. Python or PHP?

news.ycombinator.com

41–50 of 106 posts

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

#41
post #11

Earlier quoted context omitted.

Neither PHP nor Python have anything approaching CPAN. Ruby is slightly closer with Gems, but even that's a joke compared to the might of Perl libraries. Seriously, that's the big thing that's missing. Other than that both PHP and Python are prefectly servicable, although you're going to have an easier time finding smart Python developers than smart PHP developers (Blub hiring paradox).

And perl has nothing approaching Python's readability. Perl may be easier to start with now but in 6 months, it will become a major headache. Read http://www.linuxjournal.com/article/3882 . Using Python would be an excellent choice imo.

Perl is more readable to someone who knows Perl, because it gives you indications what type each variable is:

$ for scalars (single values without dimension)

@ for arrays

% for hashes (like python's dictionaries)

With python, you have to guess.

Of course, many people who are intimidated by Perl have made the same statement about readability, and it is often repeated unthinkingly. That doesn't mean it's true.

On the other hand, Perl does make it easier to write unreadable code. Just like any powerful tool -- cars, telephones -- it can be abused.

All that being said, I think Python is a great choice too; I just disagreed on the readability point.

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

#42
post #21
post #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)

Single namespace in PHP - Ouch. You can gracefully get around this with classes perhaps? Any thoughts on PHP frameworks? On Python, I've heard that TurboGears is a pretty good framework as well. I remember reading somewhere that you don't run Django, it runs you. Any fiction in that?

Coming from a Perl background, you would probably be more comfortable with PHP. Definitely checkout the KohanaPHP framework (www.kohanaphp.com) for a solid, well-designed PHP5 MVC framework, With a good framework, you can write very readable and maintainable code.

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

#43

calendar/scheduling/notifications with some social networking and people matching/search functionality. The site will be highly configurable/maintainable by its community from establishing/interacting within groups to tweeking page layouts. How much of your app can be built by hooking together existing Drupal modules? If the answer is "lots" -- and because your brief description sounds like a long list of stock parts…

I appreciate the advice.

You know, I sometimes feel as though I'm living under a rock. It pains me to expose my naiveté, but I never really heard of (even the word) Drupal until about a month ago and all of a sudden /bam/ I must've overheard Drupal in conversations at least three or four times since then. I never really put two-and-two together on this one; selective hearing perhaps?

I tell ya, I'm always learnin' something new.

Thanks for opening my eyes.

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

#44
post #27

Python. It is more powerful with an extremely flat learning curve. In other words, you don't hit many walls with it. When you want to do something more powerful, the answer is 'right there'--it fits the brain. This is a bit dated but may help: http://www.artima.com/intv/prodperfP.html

Once again, I appreciate the links. Thanks.

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

#45
post #31

Earlier quoted context omitted.

Python being readable is FUD. I've seen tons of horrible Python. Of course, I've also seen tons of horrible Perl (and PHP, and even Lisp). Basically, in the hands of incompetent programmers, everything is unreadable. If you are disciplined, you can write easily-readable Perl. I (and my coworkers) do it every day. Oh, one other thing... the linked article is from 2000. In the last 8 years, the Perl community has figur…

one can write readable anything, but some languages encourage it more, both in the language features and syntax, and also in the community, tutorials, etc

Yes, Perl encourages readability in the language by one of its language features, the helpful prefixes in front of variable names.

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

#46

I spent a lot of time bellyaching about this when starting my company - looking at PHP, Perl (preferred by the devs), and Python (preferred by the advisers I trust). In the end, we went PHP, and it was hugely lucky - we were able to hire a couple of devs on very short notice because we were in PHP, even though we use a less popular framework called Qcodo. After they were hired, I asked them what they thought, and the…

Another PHP framework: Qcodo. Thanks.

I think, maybe wishfully, that the product will need to scale which means bringing on other hackers to join.

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

#47
post #23

Python. For a lot of reasons. It's easy. It has a lot of libraries. The Python based CMSs are better. And most importantly it's easier to find decent python programmers. The vast majority of PHP guys I have interviewed ONLY know one language: PHP. The python guys tend to be much more well rounded. Of course the PHP guys are usually cheaper. You get what you pay for in this case. I would also have to recommend against…

I can tell ya that reading and understanding some of my own Perl from even 3 or 4 years ago is a real challenge. ;)

All I can say is that I hope I'm getting better.

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

#48

I've used all three of the languages you mention for relatively large web applications. People will say PHP sucks because it is ugly and retarded and only has one namespace. People will say Python sucks because of the whitespace issue and mod_python doesn't work on a $5/m shared hosting plan. Perl sucks of course because "the syntax is crazy!" But, huge sites are built in PHP (Facebook, Hype Machine, Flickr, half of…

You can get pretty far in the internet biz with no taste (MySpace... originally done in COLD FUSION).

And don't forget those non-tasty table/tr/td non-div tags MySpace is also known for. ;)

Anyway, I think you have a point. Thanks for your insight.

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

#49
post #40

PHP. Why? Because if you ever move your app to a hosted server, you'll have tons of hosting options with PHP. Only a few with Python.

Hopefully, PHP would still be the right choice for me if I then have to move beyond the single hosted server.

That is interesting though; that there does seem to be a ton of hosting options with PHP versus Python.

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

#50
post #41

Earlier quoted context omitted.

And perl has nothing approaching Python's readability. Perl may be easier to start with now but in 6 months, it will become a major headache. Read http://www.linuxjournal.com/article/3882 . Using Python would be an excellent choice imo.

Perl is more readable to someone who knows Perl, because it gives you indications what type each variable is: $ for scalars (single values without dimension) @ for arrays % for hashes (like python's dictionaries) With python, you have to guess. Of course, many people who are intimidated by Perl have made the same statement about readability, and it is often repeated unthinkingly. That doesn't mean it's true. On the o…

because it gives you indications what type each variable is:

Not really. Guess what type $foo is in each case:

    my $foo = [];
    my $foo = {};
    my $foo = "Hello, world.";
    my $foo = \"Hello, world.";
Post reply on HN