Hans Reacts to The Cherno Code Review (Ugly Build System)
The other day, a code review done by The Cherno caught my attention. The code's author was a self-taught programmer who asked him to review and roast his code. And roast it he did. Actually, he roasted the build system because attempting to build the code took so much time that he never got round to reviewing the actual code.
Build Instructions? PowerShell AND CMake?
Things started badly with the project's main ReadMe having zero information about how to build the code. Instead, build instructions were sent via email, and they were... pretty horrendous. Multiple powershell scripts had to be executed in the right order.
The build system was a mix of CMake scripts with Windows PowerShell scripts bolted on top, which needed to be executed in the right order. Ugh!
The first big question for me was, why? Why? bolt platform-specific shell scripts on top of CMake? Why have so many manual steps? Why on earth would you do it that way?
The developer's explanation was: he wanted the build system to download dependencies so people didn't have to go find them manually. Wanting dependencies to be automatically installed is certainly a good idea. But, as pointed out in the code review, CMake can fetch and build dependencies itself no problem. Heck! I have a video explaining how to do that.
How Did it All Go Wrong? The Perils of Free...
What I think happened is this: the code's author says that he's self-taught. So, he probably scoured the internet for free tutorials and examples, and did his best to cobble things together. Learning this way is a slow and perilous path because, every great free tutorial out there is surrounded by a sea of crap ones. And it can be hard to tell which ones are good, and which ones are bad So, there's a good chance that you never learn how to use the tools properly, and end up building crazy frankensteinian code that's fragile, butt ugly, and hard to maintain.
This is exactly why I wrote (and am writing) The CMake Tutorial. Because I've also had to figure things out on my own. And I hate working with nightmarishly complicated build systems that are both fragile and require lots of manual setup.
So I've taken the time to research what works best, and put together a resource to teach you how to get it right. That way we can all write good build systems that work out-of-the-box, so we can then focus on writing great code.
It's the book I wish I'd had when figuring out how to use CMake.
But Hans, The CMake Tutorial isn't Free
NOTHING in life is truly free. When learning a new skill you can either pay with money to learn from someone who knows their stuff, or you pay with your time and sanity scouring the internet on your own. I've done both, and learnt that time is a lot more valuable than money. I can earn more money; I can never get back a single second of my life.
But Hans, Who Are You to Teach Me?
Oh, just someone with a PhD and decades of experience in software development. That doesn't make me the world's top CMake expert, but I've learnt a lot over that time. I know more than enough to help those who are where I was years ago. Plus, unlike "the experts," the memories of learning CMake are still fresh in my mind.
But, you don't have to learn from me either, because there are plenty of others who could teach you. So, if you don't like me or my style doesn't suit you, then you can go pick someone else.
What if I Buy a Course and it's Garbage?
Yeah, been there, done that.
I've spent 10s of thousands of dollars on university education, and even more on courses since then. Some of them were great, others were rather poor, and some just didn't suit me. The benefit I got from the great ones far outweigh the cost of the duds, though, and it certainly beat scouring the internet on my own for free content.
Besides, you can always take advantage of their money-back guarantee if it does turn out to be crap. We offer one, as do most other businesses.
Every purchase or action comes with some level of risk. Even doing nothing comes with risk. Risk is part of life, and Who dares wins.
Learn CMake Right
So, if you want to avoid build system mistakes like this one, go get The CMake Tutorial.
Or, if you want to see some more quality free content, then check out the rest of this blog, or our YouTube channel.
1 Comments
Hans de Ruiter 14/08/2024 1:33pm (37 days ago)