Live data from Hacker News

How terrible code gets written by sane people

chrismm.com

111–120 of 151 posts

Re: How terrible code gets written by sane people

#111

I like the article but I found the implied solution a little humorous. Just hire devs who are great coders, great communicators, stubborn enough to push back against upper management, good hearted enough to sacrificed their own KPIs to focus on the success of their project, and massochistic enough to stick it out at an obviously poorly run project. Good luck Side note, for 15 years of experience the project doesn't s…

> Just hire devs who are great coders, great communicators, stubborn enough to push back against upper management, good hearted enough to sacrificed their own KPIs to focus on the success of their project, and masochistic enough to stick it out at an obviously poorly run project. This is a pretty close description of the positions I find myself in as a dev and I don't think this combination of qualities makes me more…

100% the same and I agree. getting fired and being worried that my next decision will get me fired has caused me all kinds of anxiety issues.

I recently decided that given my personality I'm not well suited to working as an employee for an employer and have gone solo. I don't want to feel like a victim to bad management or that my future and personal worth are tied to a single company as good/bad as they may be. I want my efforts properly remunerated, I want my reputation to speak for itself.

So while these traits may make you less hirable as an office worker, they may make you more hirable as an expensive contractor.

Re: How terrible code gets written by sane people

#112
post #51

It feels like people are focusing on bad conditions and unreasonable deadlines, and not the idea that in the real world smart people under execellent conditions do this very, very frequently. I've worked for long periods of time in 3 codebases that were over 2 million loc in my career, all had great conditions, all had very smart people. Those are not huge codebases by any standard, and yet all 3 had people talking a…

Agreed, but I would phrase it slightly differently.

Moltke the Elder (https://en.wikipedia.org/wiki/Helmuth_von_Moltke_the_Elder) wrote that to understand military strategy you have to understand two basic things:

- No plan survives contact with the enemy

- Strategy is a system of expedients

In other words, you can make all the plans you want, but as soon as you put them into action they have to take into account the behavior of the enemy, which may or may not go as you predicted. And once events start departing from your predictions, gaps in your plan will appear that you will have to plug with whatever you have at hand, because once shots have been fired you can't un-declare war and start over with a new plan that incorporates what you've learned. You're hip-deep in the muck now, and have to struggle through to the other side as best you can.

Something similar could be said about designing software. If no military plan survives contact with the enemy, no software architecture survives contact with actual users.

The architecture of a particular piece of software is, at root, a hypothesis: given problem X, here is how one could go about applying a defined set of computing resources to solve it. And at the beginning those architectures are always clean, because they're being applied at a purely theoretical level where things we don't really understand about the problem aren't evident yet. And since it's all theoretical, there's no warts; re-drawing the architecture on the whiteboard doesn't inconvenience anyone, so we can do it boldly and often.

But at some point you have to translate that beautiful architecture into working software and put it in front of real people, and that's where the problems start. Because those real people will use the software in ways that surface facets of the problem you didn't appreciate, forcing you to modify it to keep up. And because now making changes means inconveniencing real people and losing actual money instead of just scrubbing off a corner of a whiteboard, those changes will have to be conservative and expedient rather than bold and sweeping. And this is where the warts start creeping in, as you try to drag your original vision into some form that actually fits the real world as quickly and cheaply and non-disruptively as you can.

If the architecture is the hypothesis, the software is the experiment.

And you may think, after running the experiment once, that if you could just start over with a clean sheet of paper armed with what you know now, this time you'd "get it right". But of course the real world isn't static, so by the time you develop a new hypothesis and are ready to run the experiment again, you often find the ground has moved out from under you. Your hypotheses are chasing a moving target, and so the need to patch them up with duct tape and bailing wire never ends.

Re: How terrible code gets written by sane people

#113
post #103

I like the article but I found the implied solution a little humorous. Just hire devs who are great coders, great communicators, stubborn enough to push back against upper management, good hearted enough to sacrificed their own KPIs to focus on the success of their project, and massochistic enough to stick it out at an obviously poorly run project. Good luck Side note, for 15 years of experience the project doesn't s…

I wrote two mails yesterday which basically "push back against upper management", for a very good reason. At least that's what I think. Now I'm totally terrified about what will happen tomorrow. I have 4 kids and almost no money in the bank.

[deleted]

Re: How terrible code gets written by sane people

#114
post #84

I like the article but I found the implied solution a little humorous. Just hire devs who are great coders, great communicators, stubborn enough to push back against upper management, good hearted enough to sacrificed their own KPIs to focus on the success of their project, and massochistic enough to stick it out at an obviously poorly run project. Good luck Side note, for 15 years of experience the project doesn't s…

The irony is that some of those qualities are probably more likely to get you fired rather than valued.

[deleted]

Re: How terrible code gets written by sane people

#115

One thing I've been thinking about more and more is code that's easy to delete. For example, we recently built a data pipeline that did a bunch of processing and wrote data to a SQL database at the end. For various reasons, there was an unscalable, quick way to implement the write, and a scalable, slow way to do it. We wanted to get the product to testing ASAP, so we chose the quick way initially. In order to make su…

What you are describing seems very familiar to the idea in this [0] talk that I saw mentioned in the other thread on HN. Basically, the speaker argues that any codebase has a tendency to become a big bloated mess. The proposed solution to that is writing highly modular code that you can easily rewrite from scratch in a week.

[0] https://vimeo.com/108441214

Re: How terrible code gets written by sane people

#116

One thing I've been thinking about more and more is code that's easy to delete. For example, we recently built a data pipeline that did a bunch of processing and wrote data to a SQL database at the end. For various reasons, there was an unscalable, quick way to implement the write, and a scalable, slow way to do it. We wanted to get the product to testing ASAP, so we chose the quick way initially. In order to make su…

I mean that's the single responsibility principle right? Classes should do one thing and one thing only and then your methods within the class should do one thing and one thing only. If I'm writing a list adapter for android it should only be a list adapter. It takes its data, interprets it and converts it to present. It doesn't also do data manipulation, that's handed off to another layer.

It means increased modularity.

Re: How terrible code gets written by sane people

#117
post #12
post #7

Focusing on poor metrics such as “issues closed” or “commits per day” I once worked at a company that used an offshore company to work on certain modules of a large project. They would commit code that my team would have to then code review. We'd see things like large IF-ELSE blocks with minor differences among the conditions (sometimes just one char). I know everyone hates this. Turns out their internal metric was l…

There's an old quote I read and I keep it with me. It was for CEOs and it says, "You get what you incentivize." The hardest part of managing a group of people is incentivizing exactly what you want, yet so many people don't spend an ounce of thought tuning that properly. There's other people who believe process will fix everything, yet don't bother tuning their process. Many companies have fallen because the CEOs inc…

At our company we focus on intrinsic rewards rather than extrinsic rewards. We want people to feel good about the work they do, giving them the space and time to write quality code. We don't track any metrics such as commits or loc, heck we don't even track hours worked. We are much more interested in everyone, especially coders, focusing on what value their work brings to the end users. And how that syncs with the company's vision. During code reviews one of my favourite things to see is deleted code!

Re: How terrible code gets written by sane people

#118
post #108
post #106

Earlier quoted context omitted.

Where does bash require a space in place of a tab? I've got 1000s of lines of scripts that start with #!/bin/bash and 100% use tab to indent.

Indented here-strings.

Nope, those require tabs. See first result on Google for "bash indented here string" as well as bash guide.

Re: How terrible code gets written by sane people

#119
The other way terrible code gets written by good developers is focusing more on deliver working code that meets the business needs, more than elegant code that meets the needs of future maintainers.

Ideal code meets both. I'm sure we all agree on that. But when working on deadlines, under pressure, with poor management, you sometimes write bad code. And if the code is 15 years old, that great engineer you are talking about today was, at the time, an inexperienced new coder. So you didn't inherit his greatest work. You inherited his embarrassment where he made mistakes.

I suspect the original authors of the terrible code in question could give much deeper insights into exactly how and why it was done that way.

Re: How terrible code gets written by sane people

#120
post #52

Earlier quoted context omitted.

Thanks, that was an insightful reply. It's like when the banks pushed off mortgage risk to the public market before the great recession. Companies accrue massive technical debt (risk), but push it on the buying company who either isn't competent enough to DD the software, or simply doesn't care. In the end, someone has to pay for that negligence, but it's like playing hot potato or musical chairs.

In hindsight, I think that the M&A process of companies is actually correctly aligned with their true costs. For most big enterprise "tech" companies, their biggest operating expenses aren't technologists at all - it's sales commissions (stock options are as a rule terrible for engineers at every old hat tech company). So instead of paying $4.2MM to acquire a customer or two, you acquire a tech start-up that already…

Get short positions individually
Post reply on HN