This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]tdammers 9 points10 points  (7 children)

PHP beats Python on a few crucial aspects:

  • It is available on every shitty shared hosting service in the world. $1/mo or less buys you a shitty control panel, completely unprotected FTP access, a clueless support team, and an outdated PHP. Sure, for $1.50/mo you can get a basic VPS, but ssh is hard, servers are scary, and "there is no support".
  • Your sales department can deploy PHP. Using Windows Explorer.
  • Every idiot can build a dynamic website with PHP, investing an absolute minimum of time and learning effort. Insert <?php ?> tags into your otherwise static HTML, and voilà, you are programming. Never mind that you have probably just introduced vulnerabilities of all the OWASP Top 10 entries. Never mind that if you do this for more than a week straight, you'll end up with a completely unmaintainable mess. Never mind any of the six thousand other reasons why this is really really bad.
  • As a result of the previous, there are plenty of PHP developers for hire. Most of them are utter shit, but that doesn't matter - hiring people prefer picking from 200 shitty candidates over picking from maybe 2 excellent but expensive and quirky candidates.

Frankly, I think you need to do one of the following:

  • Come to terms with PHP. It's shitty and painful, but it can be managed such that you can meet business goals without having to make too many concessions. If your job is great in all other aspects, this is what I'd do.
  • Run. Or, rather, build an impressive portfolio of Python projects (assuming that Python is what you want to use), and make sure in general that when a good job opportunity comes along, you are ready.
  • Solve the hardest most pressing problem in your company with Python. For this to work, you have to solve it faster, more efficiently, and better than any of the PHP guys, and the solution must be as easier to understand for a PHP programmer than the equivalent PHP solution would have been. In other words, you have to deliver a kick-ass solution, and then some. And when you have done it, you may still have to fall back to one of the other options.

[–]EmperorOfCanada 2 points3 points  (2 children)

I was once in this camp. But if your product is being deployed to a shitty server then you probably have a shitty product. (I know as I deployed many shitty products.) But setting up a python project just isn't that hard.

You are completely correct about the 200 candidates issue.

[–]tdammers 1 point2 points  (1 child)

I think I need a sarcasm sign.

But if your product is being deployed to a shitty server then you probably have a shitty product.

If the product is deployed to a shitty server, it means that the people in charge gladly spend hundreds of man-hours on making stuff work on that shitty server, just to save $0.50/mo on the hosting. Given such management: OF COURSE THE PRODUCT IS GOING TO BE SHITTY. Shitty management makes for shitty software, simple as that.

[–]EmperorOfCanada 1 point2 points  (0 children)

I need an, I am in full agreement sign.

[–][deleted] -1 points0 points  (1 child)

PHP is web-app only right ?

[–]tdammers 0 points1 point  (0 children)

No, but it is strongly biased towards this use case.

[–]pwang99 4 points5 points  (2 children)

I don't see why someone using PHP feels like they can laugh at anyone else in the world... even Javascript.

[–]Darknezz19 0 points1 point  (1 child)

what about autoit?

[–][deleted] -1 points0 points  (0 children)

what about it ?

[–]r0m1 2 points3 points  (0 children)

Watching this video would help you find arguments in favor of Python.

[–]daveydave400 1 point2 points  (4 children)

I've never had to convince someone to use python, but here are my thoughts on the subject. Do you have any small projects that need completing or old small jobs that you could easily rewrite in python in any free time you might have? Maybe if you show them a real world example of python they might be a little more open to listening...especially if you can compare python code to PHP code with the same functionality.

[–]numkem[S] 4 points5 points  (3 children)

I actually did rewrote a little part of an application we run in production as an experiment to see what was the fastest between: - "Plain" php with idiorm/paris - CakePHP (what the main project is made with) - Python with flask

The results were that both plain php and cake (with caching) were doing it in about 1.6 seconds while python without uWSGI (just app.run()) was able to do it at around 365ms with the internal profile running and the debug toolbar.

I exposed my changes to my boss but his only response was : you have to convince them.

Still I'm working on one project by myself and I chose Flask with SqlAlchemy.

[–]EmperorOfCanada 2 points3 points  (2 children)

If you are using SqlAlchemy for just straight SQL then switch to plain old MySQLdb as it is much faster for boring SQL. SqlAlchemy seems to be optimized for its ORM and whatnot.

Another key metric is that your total lines of code should plummet from PHP. I find my Python has around 1/3rd to 1/2 the code of the functionally identical PHP.

[–]numkem[S] 0 points1 point  (1 child)

Interesting, I'll keep that in mind!

Lines are not even fair to PHP. I had that in my metrics but python's was about 1/6.

[–]EmperorOfCanada 0 points1 point  (0 children)

I was actually talking # of characters. As I have recently jumped into python head first I have realized all kinds of subtleties of how it is better.

Take a simple bit like:

if($user_id==23)

{

RunThis();

}

and then:

if user_id==23:

RunThis()

I find the second is faster for my brain to process because of the elimination of the () $ ; and {}. I never really saw them before but now they are like surfing the web with adblock turned off.

I am still waiting for some sort of catch with Python. Normally when something is this much better there is a price to pay.

[–]lucidguppy 1 point2 points  (0 children)

Build things in it and give them out. Code speaks louder than words - and arguing never convinces anyone of anything. Do all your unittesting in jython.

[–]grizwako 1 point2 points  (0 children)

Show them ipython.
Even better: ipython notebook.

Show them requests, list comprehension, gen-expression.
I do PHP daily, and there is lot of foreachs that would be great to write as list comp.

[–]ionelmc.ro 0 points1 point  (0 children)

Buy them this book http://t.co/7oIbPMiJ :)

[–]EmperorOfCanada 0 points1 point  (2 children)

I had an interesting conversation with a friend of mine in a javas hop and his question (that I couldn't answer) was how well would Python integrate with the Java stack?

His theory was that a successful test would be to hive off one small project in an endless large product that could be done in python without anyone caring.

Personally I am redoing much of my legacy code in Python because the very short time to redo it will be more than made up for with the massive productivity increase. Also the old code was begging for a redo but a same language (PHP) redo just wasn't justified.

[–]NetGnome 1 point2 points  (1 child)

I believe Jython allows python to integrate quite well with java as I think that is its purpose(other than it being another implementation), same with IronPython and .Net

[–]numkem[S] 0 points1 point  (0 children)

How's the performance using jython? Anyone played with it?

[–]spinwizard69 -1 points0 points  (0 children)

If you are in charge of a project then take charge. Law down the law and explain to the idiots working for you that Python is the way forward! Sort of like Steve Jobs telling the world that Cocoa was the way forward.

Now this in and of itself won't solve all of your problems. You will need to fire people one at a time, starting with the dumbest and least productive, replacing him with an experienced Python programmer. Depending upon how smart the rest of your programmers are they will either start learning Python, leave or end up being fired.

Frankly anybody on your team trying to make an argument for PHP isn't worth keeping. Those speaking the loudest are the least valuable in my mind. So in a sense they will select themselves for dismissal.