Mind your language
Two terrible languages, one decision: why I reach for TypeScript on APIs and Python on pipelines when I'm yolo'ing into production.
Everyone and their dog are writing a lot of stuff these days. And that’s fine. The whole beauty of what AI is giving us is the ability to yolo our ways faster into production than ever before.
I’m a huge believer of a “STRIP” methodology: go fast, prove the business value, come back and strip and standardise. I believe this also stops two things:
- Nonsense being built (no business value)
- Nonsense being shipped (secure, fast, standardise - hopefully)
So now we’re shipping faster, and we know that we don’t want to ship buggy, insecure, bloated code, that’s gonna bite us on the bum in the future.
Of course there’s lots of great frameworks, platforms, skills for all of this, but before we even get to that abstraction, I want people to consider the language they’re building in.
Now, one thing to note, I’m only going to talk about two languages. These are two languages that I use daily and I imagine most of the world’s tech and vibe’d code does/is written in too. Of course, there are more languages, and to add insult to injury these aren’t compiled languages, so of course there are faster, more efficient languages - my low-ELO mind can only hold so much information these days, so bear with me please.
Java(Type)Script or Python, let’s pick our posion.
Yep, two terrible languages. It’s ok, they’re both equally terrible and brilliant at the same time. Easy to install, easy-ish to write, run pretty much anywhere, lots of supported libraries, and they all have their own quirks.
I’m not here to tell you which is better, I’m here to tell you why - when I’m yolo’ing like my life depends on it - I pick one over the other.
For APIs I use JS/TS
On a Node based platform, JS is much more efficient than Python. It’s simple maths. You can do a search to find out why better than I can try to explain it. But to me there’s obvious things:
- While JS isn’t “compiled”, it can (and should) be “compiled” (tree-shaked, minified, packaged -> eg with Vite or webpack - my fav). This makes the overall executable code smaller and tigher, so less code to load and run through.
- JS is non-blocking I/O. Yes, Python does have
async/awaitnow, but it’s not really native and you need to summon a small demon army to get it to work correctly. This means that we can run lots of tasks in parallel shortening execution time. (There’s obviously a lot more here including streaming, pipes, etc… but you can go find this info yourself) - While having a younger eco system, JS has a much more mature approach to libraries and their management. Of course there are many package managers for JS (and Python), but you get a lot of magic out of the box with
npmincluding dealing with security issues with its built in audit functionality. - One language, both stacks: you can stay writing the same code for frontend and backend. This is a great context win because you consolidate all the output your vibing pal has to do.
But it’s not all unicorns and rainbows. JS support is fast but fractured, so one has to use tools like Babel with the compilers to make sure the code actually works. And when we’re compiling the code, it’s a pain to just get raw JS to work without having to run it through the sausage machine (I’m looking at you TS).
Anyway, general rule of thumb: APIs (and frontend) (so apps) I use TypeScript with webpack.
For quick code, ETL, and pipelines I use Py
While Python is slow, clunky, doesn’t tree shake, can be very bloated; it makes up for this by being very easy to write and run, and being very easy to use to model data.
It’s actually the language I use to teach my kids, because it’s simply a “write and run” pattern. No messing with build systems, shims, all the crap that comes with webpack (worth it, but still pain). And because of this, it’s great for just bashing stuff out the door and getting it to work.
Sure, there are problems, like try importing a module from a path that is one directory up and two directories down. And when working with big codebases it can become very bloated (and sometimes you can’t even deploy to Lambda without hitting the file size limit), but the ease of use makes this ok.
The data modelling libraries available are superior to anything in JS, and it’s ease of use when generating reports in human formats such as PDF, XLSX, or DOCX make it great for all of my pipeline tasks. For example there are so many libraries for working with PDF on JS but there’s not really a well refined suite (plus you need all the binary stuff to visualise a DOM, etc…) unlike pypdf.
In terms of package management, this is where it gets very grey, but I always lean towards uv that does pretty much what npm does including having a “cooldown” (--exclude-newer) to avoid getting hit by all these attacks on OSS libraries.
So why is any of this important?
If you’re like me, you don’t want to spend money unnecessarily. So it’s simple maths, the more efficient the coding language, the less compute power you’re paying for. I’m cheap so I want to stay cheap and cheap for me is JS, because I can run it cheaper over time than Python.
It’s also relative to token generation, because when you’re specific, like super specific, with the language, the building, dependency processes, your viber friend is much more focused about the tokens it’s generating, so you optimise your code and keep your token bills down.
Overall making the decision at the start, embedding in your skill, whatever, will then set the wheel working for what the “good” can look like, ie no nonsense, but clean, managable code that’s predictible to write (and wire together) and run in its final state.