DEV Community

Bad Code Killer
Bad Code Killer

Posted on

Senior Dev and Multi-threading

Oh wow, sounds like you're living the dream in that startup! Working alongside a "senior" dev who somehow managed to fall upwards into a C++ role after a brief affair with Python. Let's call him Mandd, the accidental C++ guru.

So, Mandd, in all his infinite wisdom, has discovered the marvel of RAII (Resource Acquisition Is Initialization), but only about 20% of it. Now, when he writes multi-threaded code, instead of gracefully managing resources like an actual C++ dev, he just throws random scopes around like confetti at a Pythonic parade.
{
if (something) {
std::unique_lock(mtx);
// do stuff
}
}

Now, I'm sure you're thinking, "Wait, what happens to that lock? When does it release?" Oh, my sweet summer child. According to Mandd, who needs lock management when you can just keep nesting scopes until the lock accidentally releases itself?

You know, it's like taking a road trip and throwing your car keys out the window, hoping gravity will take care of it at some point. It’s the C++ version of a trust fall.

This is what happens when Python devs infiltrate the C++ world through a combination of sheer luck and high-powered networking. And voilà, the code reads like a love letter to scopes, locks, and confusion.

Mandd should probably stay away from pointers, but then again, he might invent a new C++ design pattern: Scopeful Destruction.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay