How Becoming a Pancake Artist Turned Me Into a Full-Stack Developer – Pt. 2
If you haven’t read Part 1, you may want to backtrack a bit and give it a glance, for the sake of context… Or not. Totally up to you. 🙂
Alright, we’ve got the site up. Everything seems to work like a real web page. What else is there to do? It works now, it’ll work later, right?
Look, it’s hard to break a lot of this stuff down without getting verbose and boring, so I’m going to do my best to help boost the mood, whilst explaining, via webcomics and memes. Just about every piece of software you’re using, websites included, look something like this underneath.
Did I also mention I really don’t know what I’m doing? Cause yeah, I definitely don’t.
I’ll get this out of the way and let the world know that this site is run on WordPress, not the service (WordPress.com) but the software (WordPress.org). That may or may not get me some flack as for many it’s seen as a platform for “non-developers”, which to a certain extent it is, meaning someone with little to no coding skill could get a reasonably OK site going while writing next to no actual code. However, the flip side, and the true reality of it is that it’s just another PHP based CMS (Content Management System), just like Drupal or Joomla. It also happens to be the most popular, and therefore, well documented CMS out there. So while not writing any code and getting stuff done is absolutely possible, the only real way to get the most out of WordPress, or any CMS, is to write lots and lots and lots and lots of code.
I’ve never counted (and who would?), but there AT LEAST 10,000+ lines of custom code holding this site together, and it’s growing every day, which is something I’ll dig into here in a bit. But suffice to say, WordPress is a developer’s platform just as much, if not moreso, than a designer’s platform. Toss in the fact that admin panel is familiar and fairly user friendly for the other folks at Dancakes, who are just writing posts and creating products for the store… It was pretty much a no-brainer for me.
Anyways, let’s backtrack a bit, when the site launched I was using a modified version of the “Twenty Seventeen” theme (via a child theme), the default WordPress theme in, you guessed it, the year 2017. Can you figure out what the latest default theme is called? Yup, you guessed it (I assume). At the time I was already pretty well versed in HTML and CSS, but my Javascript and PHP was, let’s just say, mediocre at best, and most often, really really bad. I knew just enough to get me in trouble. Anyone reading this that happens to be a developer, as a career or hobby, knows where this is heading. For everyone else, let’s just say I became very, very well acquainted with ctrl+c and ctrl+v (aka copy and paste) and crossing my fingers.
Now, there isn’t anything inherently wrong with copying and pasting code, all of us have our little cheat sheets of snippets we like to use, a billion and a half bookmarks from every time we find a good solution on stack overflow or some random blog. And, let’s be honest with ourselves, when you’re working with a bare minimum of 4-5 languages per project it’s HIGHLY unlikely that you’re ever going to remember every little function, call, syntax, whether or not something returns a boolean (true or false), integer, string or array, and may the good lord forgive you if you forget a semicolon or forget you’re in Javascript and try to concatenate with a “.” instead of a “+”. It’s A LOT to remember, I’m not every programmer out there, but in my own experience, unless I’ve very recently used something, or it’s dummy simple, I’m probably gonna have to look something up every half dozen lines or so to make sure I’m actually doing it right. Code editors help, since they can highlight obvious syntax mistakes and can autocomplete (say you start typing “getElementById()”, the code editor will start giving you options, just like Google’s autocomplete). The important thing to remember when doing this is that even though you’re copying and pasting, you know exactly what the code is doing (or supposed to do :-|) and why it’s doing it. It would be the equivalent of speaking a language, and even knowing how to write in the language (like english), but if you misplace, a, comma, your paper will go into an infinite loop and begin to consume anyone and everything around it until the world is plunged into a dark abyss, never to escape until someone manages to find the ID of your paper and type “kill -9” into an ATM before we all perish in a grizzly and untimely nexus of nothing.
That’s to say, programming languages aren’t forgiving, and while computers are “smart” they’re also incredibly stupid, unlike humans they can’t infer or assume meaning, you have to tell them exactly what to do and exactly how to do it. This is the reason self-driving cars seemed just around the corner for so long and only recently we realized it’s WAY harder than it looks. Because computers are terrible at improvising, and if they do it’s only within specified parameters. Humans on the other hand are surprisingly good at improvising in situations they’ve never encountered.
Do you even remember what we were talking about? Oh yeah! Copying and pasting code. So, while the fact that I was copying and pasting a lot of the code on this site, I really had no clue exactly how or why most of it worked, or didn’t, and that can definitely lead to some “interesting” problems to say the least. I would look specific things up that I was trying to do, find some code snippet that claimed to do what I want, or said it would do something cool like make the site faster or whatever. Sounds great! Ctrl+c & ctrl+v away!
You do this a few dozen, (let’s be honest) probably hundreds of times and you end up with, what one might call… A bit of a clusterfudge. Did I mention I had no idea what I was doing?
Somehow it all worked reasonably well (no clue as to HOW), far better than the old site, but at a certain point after reading thousands of pages of documentation and blogs and stack overflow question some of this stuff started making sense. And once you start to (barely) understand what you can do, and the logic and flow of exactly how you can do it, well, that’s when the gears in your brain start turning. Ideas, ideas and more ideas! And a whole whole lot of, “Holy crap, what the hell was I thinking when I put that in there?” as I methodically rip out nearly all of the old code holding this site together (nearly the entire original codebase is gone at this point). I fully expect (and hope) that in 6 months time I’ll be thinking the same thing about the code I’m writing right now.
Lest we forget that code isn’t the only thing we’re managing here, our VPS is completely self managed, one more notch to add to my belt… I guess?? When I first built this site I used Google Clouds nifty “Click to Deploy” that creates a VM with WordPress, Apache & PHP already installed. It’s a great tool if you’re just starting out and wanna dip your toes in the VPS waters. But just like every other pre-built solution, it never does everything you need, exactly the way you want. And eventually you’re going to throw your hands in the air and wave them like you just want to hit the “Remove VM” button and start all over again.
Anyways, I feel like the story is getting lost here a bit and I’m just describing web servers and stacks. Short story long, just like everything else in this process it looks nothing like did at the start, and it will continue to be a wondrous tedium into the next phase.
OK, so wrapping up here. What’s the moral of the story here? Is there a moral? I have no clue, I’m just kind of rambling on about the process and/or journey, and it’s been a very strange one. I’ve been asked more than a few times what I enjoy about doing development work, and I’ve had some time to muse on it, and the best answer I can come up with is that I enjoy the creative logic of finding a solution to a problem and at the same time bending a piece of software or a machine to my will.
It doesn’t always work, and it definitely never works exactly like I expect, and by the end of it I sometimes feel like I’m just flailing around hoping against hope that it’ll work.
So I guess it’s a lot like jazz, but more listenable.
Fin.