Swizec Teller - a geek with a hatswizec.com

    What I learned of PHP by ignoring it for three months

    When I took a break from php three months ago I'd been up to my shoulders in the technology for about five years - I remember my first interactions with the language were figuring out whether I need to use .php3 or .php4 or just .php file extensions. But that's not very interesting.

    A more interesting tale to tell is perhaps how for the last few months I was growing increasingly frustrated with my job, my work environment, my skills toolkit and simply the whole LAMP web development stack. It was time to take a break ... it was a lot later that I discovered a cool TEDtalk on the topic, watch:

    But anyway, onwards to what I'd learned.

    Lessons that can only be learned by staying the fuck away

    This week my PHP hiatus saw the beginning of its end, I had to get a freelancing job to pay bills and other such nuissance - since PHP and Javascript seem to be what I'm most popular for in the community that's the easiest thing to get a job for. And to be honest, I'm not really fluent enough with anything else to do it for real money.

    So earlier this week I had a meeting with the team lead of the project to give me a short tour of their, dare I say it, very well designed framework, and I realised how much extra work needs to be done by the framework just because PHP is such an incredibly lame language.

    1. PHP doesn't have support for that thing where you can use objects right out of a function. So we need a getScalar, getString, getRows, getRow function instead of a lovely getValue, ""+getValue(), getRows() and getRows()[0] system. Why php, WHY don't you support this?
    2. PHP also can't do inline arrays, objects and tuples. This is great for passing data around in a descriptive way and PHP fails completely. Why can't I do a return {x: 0, y: 100}? Or something like that? It's silly that I'd have to create a whole new Vector class that doesn't do anything other than hold two values.
    3. Another thing PHP desperately needs are keyword arguments, or whatever they're called. It should be possible to call a function that has default values and define specific arguments without having to define all the other arguments because the one I need to set happens to be last. Seriously, what if the defaults suddenly change? Do I go through all the code to pass the correct defaults for that one argument I actually need? This could be solved by passing an object around but what's this? Objects are a pain to create? Right ...

    So I guess that makes for almost one thing I've learned per a month of abstinence. Not the best ratio by all means, but it's silly to find that such a modern language used by so many people would be such an utter failure on many points others, not unlike Lisp, have solved half a century ago. What the flying fuck!?

    Did I miss anything? What else does PHP do well and what does it do poorly?

    Reblog this post [with Zemanta]

    Did you enjoy this article?

    Published on October 23rd, 2009 in food for thought, PHP, Programming, Uncategorized

    Learned something new?
    Want to become an expert?

    Here's how it works 👇

    Leave your email and I'll send you thoughtfully written emails every week about React, JavaScript, and your career. Lessons learned over 20 years in the industry working with companies ranging from tiny startups to Fortune5 behemoths.

    Join Swizec's Newsletter

    And get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career. Real lessons from building production software. No bullshit.

    "Man, love your simple writing! Yours is the only newsletter I open and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"

    ~ Ashish Kumar

    Join over 14,000 engineers just like you already improving their careers with my letters, workshops, courses, and talks. ✌️

    Have a burning question that you think I can answer? I don't have all of the answers, but I have some! Hit me up on twitter or book a 30min ama for in-depth help.

    Ready to Stop copy pasting D3 examples and create data visualizations of your own?  Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization

    Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.

    Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev

    Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

    By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️

    Created bySwizecwith ❤️