3.5 KiB
My History With JavaScript
I think the first time I wrote JavaScript and got paid for it, I was young, dumb, and willing to work at a design agency for nearly minimum wage making WordPress templates and CakePHP applications. The team I worked with had adopted jQuery for all things front-end - which was the style at the time. I think this time was about 2014.
From there, I moved on to other agency jobs and finally ended up at my current place of employment as a lowly PHP Developer. This role was designed to solely work on a single Magento 1 codebase. Again, jQuery was the tool of choice. Of course the JavaScript landscape was changing rapidly with the introductions of Node.js, and frameworks like Angular and React. I paid no mind to these since the bulk of my work was still in the world of Magento 1 and working on a plan to migrate to Magento 2.
It wouldn't be until 2018 (or maybe 2019?) that I would write a line of
JavaScript for Node.js. We had decided to go all-in on AWS Lambda. I worked on
a service that would push order data out of our Magento instance into our
Production Facility's database. Let's call this The Bridge. This Lambda was
invoked by API Gateway. This was a very small web service, essentially. This
was, also, my first experience with Callback Hell. There was no await
and
no real Promise
API (except, I think Bluebird, but I never knew about it
at the time) yet. The service actually needed to do a lot of queries, and use
those results for other queries, so on, and so forth. If you're familiar with
working on Callback Hell you will recognize this:
var mysql = require("mysql");
var config = { ... };
mysql.connect(config, function (err, conn) {
// handle the error
if (err) {
console.error(err);
return;
}
var query = "INSERT ...";
conn.query(query, function (err, results) {
if (err) {
return;
}
// do something with results
// do another query
conn.query(query, function (err, results) {
// handle error
// do more queries
conn.query(query, function (err, results) {
// etc.
});
});
});
});
This sucks.
We ended up rewriting this service in C# as that was the most popular language within the organization at the time. Honestly, thank god. I didn't need to write or maintain the service once it fell into the hands of the .NET team.
How I Approached Big Applications
Eventually all the .NET guys left the company. My boss left the company. I was put in charge and the first thing I did was deploy an Express.js application to completely rewrite the service discussed above. I did this because this was actually faster to do than figure out how the build system (Jenkins, Ansible, and TeamCity I think) and deploy it to our common pattern architecture. It was also a way for me to prove to my new boss that I can get things done and that moving to slowly remove our reliance on .NET and IIS for our services was a worthy endeavor.
A lot of my experience up until that point was mostly working in Magento 2, which is a massive, Enterprisey, PHP application. Modern PHP tends look more and more like C# or Java as the years go on. So that's where my mind is - poisoned by web MVC and Enterprise OOP (tm).