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.
- 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?
- 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. - 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?
Continue reading about What I learned of PHP by ignoring it for three months
Semantically similar articles hand-picked by GPT-4
- Symfony and the scary world of PHP
- Why I still haven't learned Haskell
- The web moves fast, how do you keep up?
- My language is better than yours
- Freelance teaching is great, or why C/Java/etc. are horrible teaching tools
Learned something new?
Read more Software Engineering Lessons from Production
I write articles with real insight into the career and skills of a modern software engineer. "Raw and honest from the heart!" as one reader described them. Fueled by lessons learned over 20 years of building production code for side-projects, small businesses, and hyper growth startups. Both successful and not.
Subscribe below 👇
Software Engineering Lessons from Production
Join Swizec's Newsletter and get insightful emails 💌 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. 👌"
Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.
Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.
Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.
Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev
Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization
Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections
Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog
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 ❤️