Let them learn COBOL / PHP isn't evil

I received this in my inbox earlier:

What programming languages should a modern-day programmer have in his/her arsenal? (Quora)

OK, fine, now I'm forced to evangelize for PHP, this puts me in a really painful position, but since I'm apparently the only person

reading this who can think for myself instead of freebasing whatever the Valley tells me to use, here we go…

The general theme seems to be to either learn a pretty hardcore language like C or C++ which won't benefit most people right away these days, since there's almost no excuse to make classic applications anymore. I think if anything it will discourage some people from learning to program since they have to spend a lot of time learning to clean up garbage, compiling, debugging, etc. Way to ruin their fun by making them spend all that time on a language better suited for drivers than web or phone apps.

Promoting Java is also a thing for some reason, I thought we were trying to kill this language? It's still used by a lot of places, but so is COBOL. In fact there's still a ton of places that use COBOL, so why not promote it? Probably because it doesn't come with a hipster mustache and a really tall bicycle.

If it's about job security, automatically Python and Ruby were a terrible suggestion, same with Erlang. You might as well be one of those skinny guys promoting Lisp.

A huge one though is promoting Python (and sometimes Ruby), blindly suggesting it's the best way to go without consideration for how huge of a pain in the ass it is to start a project. The syntax of the language(s) is very easy and the language itself quite powerful, but also slower than other options, harder to get going, and not widely supported. Starting a project in Python is about as difficult as starting a car by putting the engine in the car first. Turnkey? Hell no. You can get used to it, take some shortcuts, etc, but really for a new person, it's a nightmare.

It's really a hipster language, and Monty Python isn't funny, I'm just saying, it really isn't, seriously.

That's unrelated to this topic, but since Python is named after it, I felt it was important for me to communicate that it's just … knights who say Ni? yeah, falling over laughing. Monty Python films had a few snicker moments here and there, but it was mostly diarrhea (or diarrheoa). I liked Flying Circus much better, why don't many people talk about that?

Yes, I've seen all of the popular films, and no I didn't laugh. I didn't go into expecting it to be about as funny as a hernia operation either. I had thought they would be funny since that's what people were saying, and after wasting about six hours of my life I realized: holy crow, I didn't laugh once. No, I mean that literally, I didn't laugh one time. A few smiles, sure, but not much else.

Anyway, where was I? Oh yeah, terrible ideas…

Some other promotions for assembly, as if it's 1977 or something.

In general though there was a lot of PHP hate spread through the entire thread, mostly that it was bad, but nobody ever saying why, it just is. That's a lot of bullshit. It's because PHP is widely used, widely available, and despite their claims PHP has made a massive amount of headway over the last few years, and is only getting better.

Much of the complaints about PHP people have are true.. if you've fallen out of a time machine from 2004. Hating PHP is like hating MySQL, it's just easier to ignore the last decade and pretend nothing ever changes, then go on to promote your slower, less widely available, much cooler alternatives of Python and PostgreSQL.

It's just the toxic runoff coming from the Valley of essentially acting like Pookie for anything cool coming out of the Valley, Bay Area, etc. And hey, I've lived in the Bay Area, so that makes me an authority on everything there.

I don't mind the C# suggestion, I don't like the platform limitations. Yeah there's mono, but yeah, who cares. C# has a lot of things like static typing that I wish PHP had, but Hack from Facebook does add a lot of those features right back into PHP and many of those will be moved into core PHP over the next couple of years.

The blinding hatred of PHP out there causes people to promote things in a manner which can slow newcomers down. PHP sure isn't perfect and there are of things I'd change about PHP, but it's faster, extremely powerful, and most importantly easy as hell to get going.

I'm of the mind though if we're going to want to stop people from learning to program, then yes, let's promote Python, Ruby, Erlang (what the heck are you promoting this for, do people making small sites really need message queues? Don't be a jackass.), and while we're at it Java. Languages which can be easy at face value, easy in syntax, but a pain in the ass to get going and deal with, not to mention slower. Except Java and Erlang, those can be pretty fast.

So reasons not to learn PHP?

  1. It's not really cool
  2. It's not the steam punk of languages like Python, so you don't get a stupid ass top hat with non-functioning goggles and proclaim you're awesome
  3. It's making headway faster than most languages, some of which aren't even changing or improving at all any more.
  4. It's widely available, i.e. essentially everywhere, so you're not held hostage by host availability
  5. It will help you learn C-style syntax which you can more easily pass on to other languages like JavaScript (also used on the web), plus countless other languages like C, C++, Java, C#, etc

Python and Ruby aren't bad to have in your arsenal, but blindly suggesting them first, when C-style languages is king is just ridiculous. Meanwhile the most popular web language being PHP, which is a C-style language, oh no, don't use that, it's bad just because it's bad, I mean, no reasons listed here, it just is.

Anyway, now a choice, spend 10 seconds starting a PHP project or spend half an hour setting up a Python environment and prepping things just to get coding, and I mean really coding, throwing things directly to the interpreter isn't how you make real projects, it's how you demonstrate the language without making it obvious how much of a pain it is.

I'll use the language best suited for the situation, I'm not going to blindly dislike something because a broader community of self-deluded permanent man-children hate it.

My choices of languages:

  • PHP
  • JavaScript / node.js
  • Ruby
  • C#

My choice of languages in 2004:

  • Perl
  • C++
  • PHP

My choice of languages in 1997:

  • Perl
  • C++
  • Visual Basic

Nope, things never change, I'll just use Python forever and tell everyone that's all I've ever loved.

I hope you can appreciate the irony of blind hatred and ignorance of modern PHP meanwhile essentially doing the same thing with Python. That's my point, when it's turned around, it's obvious how idiotic you look.

6 thoughts on “Let them learn COBOL / PHP isn't evil”

  1. Hmm, popular != good. Justin Bieber is popular, is his music good?

    PHP is shit. Even in 2014 it's still shit, an apple rotten to the core. You can sugar coat it, make a toffee apple, but the innards are still putrid.

    I totally disagree with your "PHP is advancing faster than other languages" comment. Seriously, look at the pathetic features added to 5.5 and 5.6, you call that advancement? And note too all the warnings on the 5.6 release notes, that's a perfect example of why it's such a horrible language.

    1. How do you know I'm not Just Bieber and this is my secret programming blog? I'd be heart broken. Maybe I don't have time to make good music because I'm too busy messing around with code? Ever think of that, smarty pants?

      I said faster than most other languages [on the web], and that's true, but you're implying I said all of them, and I didn't. And the features between 5.5 and 5.6 added were pretty limited, but I'm talking about PHP 7. I was really disappointed with PHP 5.6, but my point is it as a pretty promising future, especially if you consider its past.

      Consider even now its lack of static typing, busted ass OOP implementation, etc and compare it to PHP 4 or even PHP 3, that's a lot of headway, though that was a long time ago comparatively, but things have improved faster over the last 5 years than the previous 5 years before that.

      And not adding more features through 5.5 and 5.6 doesn't prove that it's a horrible language. Sure Python adds a ton of features between each minor version, but it takes a billion years to release each one of them, and even then you get sticklers who want to stay with the old minor versions until the end of time.

      You proved my point though by not actually demonstrating why it was bad, except you did state that it didn't have many features between 5.5 and 5.6 added, etc, but there's no real meat there, it's sort of the same old thing I've heard for the last decade.

      I'm not interested in drinking the valley runoff diarrhea when it comes to what language to use. Obviously Python and Ruby are pretty solid compared to many other "easy" languages, but the point of my post too was that saying stuff like "Erlang" isn't really helpful to people and that COBOL is still vastly, widely used… so if we're talking about a good language to learn for a good future, yeah that'd be one. I sure as hell don't want to learn it though.

      I just think it's irresponsible to dismiss something because it's considered "shitty" by some people, but has a much higher job availability rate and instead promote something that you probably won't be able to easily find a job doing. In this case both PHP and COBOL can probably get you a job a hell of a lot faster than Erlang and Python.

      And unlike COBOL, PHP is making improvements steadily, and I can run it damn near anywhere with little effort, unlike many other languages where I'm taking the day off to get started.

      My #1 hope though with PHP 7, other than static typing and the like, is that it will effectively destroy all the crappy PHP software out there by deprecating a lot of terrible things.

      I have a lot of hope for the platform and I think it's wrong to simply dismiss it, and yeah popular doesn't equal good, but when you talk to industry types, they'll cum all over themselves promoting Python, Ruby, etc but ignore the fact that PHP is so popular to the point where it reaches almost contrarianism rather than logic. I think one of the biggest issues is that more good engineers don't use PHP and instead just circle jerk on to other shit.

      Then again, I'm retarded for C-style languages, and I like Ruby, I use Ruby, but PHP's get up and go quality and C-style syntax wins me over, and that's what I'll limp to the barn with in most cases.

      Hopefully it has a future as a better language, and if I don't see great improvements in PHP 7, I'm almost certainly going to just switch to node.js, and in fact I'm probably going to do that anyway.

      Thanks for commenting :)

      1. PHP may have progressed but to me it feels like every new feature is something badly bolted on. And when developers ask for really useful features like named parameters the PHP internals group rejects them.

        All of the stuff added in 5.5 and 5.6 has been in Ruby for a looong time. PHP is still playing catch up, and in a very bad way.

        I'm not sure why you're so keen on C-style syntax. I think it's pretty nasty really. Compare:


        try {
        $post = Post::with('comments')->where('id', $id)->first();
        } catch (Exception $e) {
        $post = false;
        }

        if ($post) {
        $post->display();
        }

        to the Ruby equivalent:


        post = Post.with(:comments).where(id: post_id).first rescue nil

        post.display unless post.nil?

        To me the Ruby is far easer to read and write. The PHP code is ugly and potentially confusing.

        Having getters and setters built into an object by default avoids all the ugly ->getName() ->setName() style methods you see modern PHP code. Having a method name with a question mark shows its intention clearly, as in:

        user.authenticated?

        Anyway it's personal preference at the end of the day but in 24 years of coding (14 of those with PHP) I've never found any language to be so frustrating and annoying as PHP is. Ruby OTOH I find a joy to use.

        PHP should have done what Python did when it moved from 2 to 3 and break backwards compatibility in order to make the language better. Instead it's more of the same bolting bits together and keeping the godawful confusing naming and syntax . What a shame.

        1. I agree that things get badly bolted on, case in point: namespaces, but even with the initial bad bolting of OOP, that's improved a lot and in future versions is mapped out to improve even more — I honestly think they're just trying to move it toward Java, it certainly seems that way.

          Ruby was designed very well from the start, PHP wasn't, it was really terrible. Lest we forget things like register_globals and magic_quotes which initially were just a part of PHP and couldn't be turned off. Back then though I used Perl mostly, these days I don't use Perl at all anymore.

          I am very keen on C-style syntax because it's easier for me to read. In your example you used some pretty goofy written PHP code, what is that Laravel? In any case I don't code like that, and from my perspective the Ruby isn't a vast improvement as it's still something I have to parse out in my mind.

          The curly brackets and so forth in C-style languages, including the rigid (yet somewhat bizarre and ugly) syntax help me read things more clearly. This likely has to do with the fact that I suffer from dyslexia. The clear boundaries make things a lot easier, that's why I also enjoyed variable prefix in Perl and later PHP. While I can certainly live without it, I do find myself having to compensate and carefully visualize things. It's the same reason in C-style languages I hate it when people use in-line if-statements without curly brackets on multiple lines, like:

          if (x == 1)
          y = 2
          else
          y = 3;

          Combine this with my literal OCD issues it makes for some seriously rigid and specific coding styles across languages. I enjoy things being specific and clear; I work well within those boundaries.

          While it may not be pretty syntax, it certainly is clear and useful.

          Ruby does have a lot of neat features like the ones you point out though and I wish PHP had them as well. Actually, ideally I wish there was another C-style language which somehow met in the middle.

          I've been coding PHP for about 14 years also, we must've started around the same time, so I'm sure you know what I mean when I talk about the really old, shitty aspects of things like PHP 3 and basically all of PHP 4.

          I agree with PHP breaking backward compatibility, 100% wish they would, and it certainly seems like they're willing to do that with PHP 7 according to a lot I've been reading on their "RFC" site.

          That's why I think too that "Hack" (what a stupid name) is a good influence on PHP's development and I've noticed that since its launch that the PHP developers seem to have increased feature creation and also making general needed changes.

          If I lived in an ideal world, the features of "Hack" would be a part of PHP itself, including additional changes the PHP team has already made. I could live with that.

          In the mean time I still think it shows a lot of promise and its ability to allow people to get started right away makes it really appealing. The primary issue is that it also makes it really easy to make garbage… insanely easy.

  2. Oh, anyone who writes code in if blocks without indenting needs a massive kick in the rear. OTOH braces don't really help IMO since you could also throw braces around five different statements on the same line. Likewise I think the PSR standard of having different rules for the brace being on the same line or next depending on context quite arbitrary.

    I personally prefer the chain syntax you get with Ruby / Python, as in:


    User[123].name.trim.capitalize.add_greeting

    It's a natural thing for us to read left to right, so it's clear to me that i'm going to trim, capitalize and add a greeting to the name of user with id 123.

    Contrast that with how it'd typically be done in PHP:


    ucfirst(trim(User::findById(123)->$name->withGreeting()))

    OK, I know you could do all the trimming etc. in the withGreeting() method but my point is that with PHP you typically get this horrible mix of functions, methods and static methods which is a goddamn mess.

    You may not like the syntax I posted but there are tons of libraries and frameworks that work in that way and sooner or later you're forced to work with these things.

    IME, having switched primarily to Ruby, I find that I get about twice the results for the same time investment in my code in the initial writing stage, and finding and fixing bugs is something like three or four times quicker, than with PHP.

    I agree, it's all going very Java-like, no thanks to the likes of PHP "rockstar" Fabien Potencier and his fascination with Java. IMO it's not a good thing. Java was intended to be very strict, structured and organised from the beginning and trying to force a language like PHP to behave like its polar opposite is a mistake. And it's only going to get worse if the PHP7 RFCs are any indication. I honestly wonder who is coming up with some of the crazy ideas they are proposing, like putting getters + setters into a closure in the class declaration? Are you fucking kidding me!?? :-O

    1. Well, of course you could put all of your code on one line if you're a lunatic, but bad formatting is a sickness anyway.

      I am mostly of the PSR camp, though I do the opening { on the same line, rather than a new line, unless I'm coding in C# because Visual Studio forces me to. I'm sure there's a way to change it, but I don't code enough in C# to care that much.

      Chain syntax is neat, and JavaScript has this as well, though its implementation is crappy compared to Ruby's. It's possible to implement it in PHP by returning $this at the end of the method, but really only works on a class basis if you're a sane person. I wish PHP did have that, I agree. OTOH sometimes my brain has trouble processing the more complex ways of doing it, such as loops and such chained on, and it takes me a second longer than I think some other people, so in Ruby I don't typically do those, though it's not always out of the question.

      There are a lot of things I like about Ruby, but I time everything I code, literally everything, and I found Ruby took me sometimes nearly twice as long to debug and review code, primarily because of the syntax and my wacky brain I believe.

      I don't think it's a bad thing to go toward Java, I still sort of respect Java, but I mostly hate it for a billion different reasons, and for a classic application of course I'd use Ruby over Java period. At any rate I don't think it's a bad thing because I think in the end it may help PHP or perhaps destroy it, and either one I don't have a problem with so long as there's something other than this constant sitting on the edge of shit and being potentially something better. It's still powerful and more easy to get started than Java for sure too.

      Yeah some of the RFCs are nuts but some show a lot of promise and make me optimistic, luckily some of the crazier ones don't get voted as approved.

      Even with all the crappiness I don't think it's a good idea to just disregard PHP in favor of things which take longer for people to get started, especially new people. That does create a situation though where new people can create bad code, and one of the reasons I created this blog too is to talk about the "better" way to do things in PHP, and also talk about phreaking and general programming it seems. I've been reading your blog and it's pretty good, I've even commented to share the love, and the name is great, I love it. Very clever!

Leave a Reply