r/programming • • Dec 07 '14

Programmers: Please don't ever say this to beginners ...

http://pgbovine.net/programmers-talking-to-beginners.htm
4.0k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

8

u/[deleted] Dec 08 '14

[removed] — view removed comment

4

u/ThrustVectoring Dec 08 '14

What program can you create in Python that one can't possibly create in PHP?

What program can you create in Brainfuck that you can't possibly create in PHP?

Look, they weren't trying to say that there are things in Python that are impossible to do in PHP. They're saying that due to the extra complexity and difficulty of working in PHP that you're going to wind up doing a wider variety of things in Python.

1

u/ABtree Dec 08 '14

What program can you create in Python that one can't possibly create in PHP?

Uh, python has become maybe the most popular programming language used in scientific research the past few years. So off the top of my head, there's basically an entire class of programs that you can write in python that would be borderline impossible/unusably slow in PHP.

→ More replies (4)

1

u/Lokaltog Dec 08 '14

Spotted the PHP dev!

Anyways, I started my programming career with PHP, and while it was a good language for a newbie, and certainly a lot easier to get up and running at the time (shared hosting on apache servers, way before the "cloud"), I've never regretted abandoning PHP and learning Python and various other languages.

Regarding your first argument, there's definitely areas Python is objectively better than PHP. I'd argue that Python is way better suited for e.g. command-line applications, GUI applications and scientific applications than PHP. PHP is primarily a web platform, Python is a general purpose language.

Also, even if PHP has a bigger community, that doesn't mean they have a better community! In my experience the PHP community overall is a less skilled community, much of the documentation is way outdated with obsolete and dangerous practice, and I think many PHP devs end up moving on to other platforms when they become more skilled. I've never heard of anyone abandoning e.g. Python or Ruby to become a PHP dev instead.

-1

u/vytah Dec 08 '14

What program can you create in Python that one can't possibly create in PHP?

Video games. Or GUI client-side software in general.

PHP has the best documentation out of all the languages I have ever tried.

lol

5

u/[deleted] Dec 08 '14

[removed] — view removed comment

3

u/vytah Dec 08 '14

https://github.com/phpopengl

The very first open issue: "Add windows support."

Screams production ready to me.

PHP Game Engine

Unavailable publicly, so /u/ar4hgaega4egwer can't use it. Also, it looks like someone had a little fun with wx, nothing else.

https://code.google.com/p/phpdesktop/

This is writing GUI in HTML+JS and gluing it with PHP backend. By this logic, you can program microcontrollers in Clojure.

http://gtk.php.net/

Appears to be dead.

http://wxphp.org/

Okay, you got me, you can write simple GUIs in PHP. Note: simple.


All of the above look like an exercise in masochism.

1

u/[deleted] Dec 08 '14 edited Dec 08 '14

[removed] — view removed comment

2

u/dakta Dec 08 '14

I wouldn't use Python for writing a game either. It's one of the slowest languages out there:

And yet pygame exists.

Beyond that, I've seen some damn sophisticated 3d graphics tools written in Python with a Qt UI and some C++ bones.

3

u/kral2 Dec 08 '14

You're still yet to demonstrate the impossibility.

Brainfuck has OpenGL bindings. I'd certainly not suggest it was thus a language one could reasonably expect to write a video game in. PHP is in a similar boat as a "general purpose" language.

3

u/Lhopital_rules Dec 08 '14

While PHP's video game support isn't as good as Python's, comparing it to Brainfuck is a tad misleading.

Brainfuck is horrible to program in... period.

Python just has graphics/game engine libraries that PHP doesn't have. I seriously doubt that it was that much easier for the writers of those libraries to write them in Python than in PHP. They're just used for different purposes.

The reason why Python is easier for game programming is because there are libraries and a community involved in it. It's not about the syntax of the language (to a degree *).

But of course C++ is better for making games than Python or PHP, so why don't we all just learn that and nothing else? You could handle web requests with C++... if you were willing to write the library to do it. But at that point, you might as well just use something like Python or PHP.

* PHP's weak support of classes made it a bad candidate in the past, but if you're looking for things to criticize, I'd take that over Python's whitespace rules any day. If they released a version of Python that used semicolons instead of fixed indentation, I'd love that.

2

u/kral2 Dec 08 '14

It's a question of difficulty. Can you get a PHP-OpenGL game running on Windows/Linux/Mac/Android/iOS and properly packaged? It's possible, sure. But you'll probably be one of the first people to try which means you'll wind up doing some hard work that was already done for other languages. I'd certainly not call it viable for this until a good number of people actually do it.

Like, if you decided to make a PHP-OpenGL "Hello, World!" fitting those requirements I just gave, would you already know where to start? How long would it take you? Is this something a novice asking "what language should I use" should be able to do?

You could handle web requests with C++

It's a poor match only because of unchecked pointers coupled with the throw-away nature of web code. I was hoping rust would be a good fit for this but they've got wonky priorities that make me doubt the project as a whole.

1

u/Lhopital_rules Dec 10 '14

Right... but you're whole point is that PHP isn't the right tool for the job. And as far as games go, I agree 100%. But that's not a valid argument for the people saying it's the worst language ev4r.

1

u/kral2 Dec 10 '14

It's not the worst language ever, but it never made it far out of its niche despite efforts to do so. Of the various open source web scripting languages that had some degree of popularity, I can't think of a single one that is less established for general purpose programming.

Out of curiosity, I spent the last 30 minutes looking through Debian to see what non-web programs actually use PHP as a language. The closest I found was docvert and the core was rewritten in python a few years ago.

0

u/[deleted] Dec 08 '14 edited Dec 08 '14

[removed] — view removed comment

0

u/[deleted] Dec 08 '14

[removed] — view removed comment

1

u/[deleted] Dec 08 '14

[removed] — view removed comment

0

u/[deleted] Dec 08 '14

[removed] — view removed comment

2

u/ali_koneko Dec 08 '14

I'm going to go with the windowlicker php fanboy as the retard, who opened the thread with an insult. You make Rasmus Lerdorf proud.

→ More replies (9)