Live data from Hacker News

The Efficiency-Destroying Magic of Tidying Up

florentcrivello.com

81–90 of 196 posts

Re: The Efficiency-Destroying Magic of Tidying Up

#81
post #54

Earlier quoted context omitted.

Often true, but often 'beautiful code' does not impact the bottom line - even in the long term.

I agree, beautiful code is often the other extreme. Plus it's often only beautiful to the person that wrote it.

> Plus it's often only beautiful to the person that wrote it.

From what I've seen, this may be true in some particular cases, but this is not a general pattern.

I've found that beauty, in software (as in art and design in general) very often has common elements. People certainly have different preferences in how the elements are put together, but I think many people can appreciate the underlying principles.

Here are some examples of the principles behind beauty in software:

* A component obeying the principle of least surprise

* A function having a clear purpose

* A function using a small (perhaps minimum) number of arguments for its purpose

* A codebase cleanly separating concerns

* A codebase reusing standard components

* A codebase having appropriate documentation suited to the team working with it

* A codebase having good testability

* An algorithm (e.g., one based on a published paper) solving a problem by doing less work

* A function having fewer lines of code

None of these are absolute. (For example, the last two may sometimes exist in tension with one other.) I see the concept of beauty as relative to a set of goals and values. Beauty almost always often involves a sense of balance and proportion: trading-off principles that are not perfectly orthogonal.

Of course, there are different perspectives on how to achieve a particular balance for a particular situation.

I'd like to add an unsupported claim (that I happen to believe, given a set of mostly rational people working together in a healthy work environment): If you get these people together and say "is codebase X beautiful for purpose Y?" I think you'll find a lot of consensus. In areas where they disagree, I think the resulting discussion will likely be constructive. I would bet that the discussion will lead to a better design in the end -- as perceived by the participants. This assumes that the people learn from each other; e.g. proponents who tend to favor one principle are willing to listen to proponents of other principles.

Re: The Efficiency-Destroying Magic of Tidying Up

#82

> London's tube map only uses 45° angles to aid its human readers. Now can you see the humanness in mainboard design? What was that russian electronic board design software where nothing is vertically/horizontally aligned, no trace is straight?

Interestingly, I contend that the prevelance of 45 degree angles is in large part due to the capabilities of ECAD software. If you look at old manually-routed PCBs, 45 degree bends are rare. If you try to make a design with non-45 degree bends in most ECAD software, prepare for pain as much of the features of the layout engine fail to work properly (I had experience of this after being inspired by some images of TopoR-designed boards).

Re: The Efficiency-Destroying Magic of Tidying Up

#83

Hmm, I thought that Amazon was famous for how they standardized their cross-company software? (With AWS as a side effect.) Or is this not the case anymore?

That's what I was thinking when I read the article.

When I worked at Amazon, everyone worked out of the same repo(s), used the same build system (Brazil), deployment system (Apollo), deployed to the same place (EC2), most APIs were written using the same framework (Coral), etc. This is not that unlike the other large tech companies, and now that I'm back at a large non-tech company where everyone builds their own slightly-incompatible tools and deployment pipelines, I do miss that standardization.

Sure, some people chose to use different tools here and there, but most people wouldn't choose to reconstruct the universe just to stand up a microservice. It's not like all the "two-pizza teams" were all doing completely different things with incompatible tooling.

It's been a while since I worked there, so things might've changed completely since then. But as a shareholder, I hope not.

Re: The Efficiency-Destroying Magic of Tidying Up

#84

Sorry but there's no excuse for crap code. If it's hard to understand then time is lost every time you have to work with it. You shouldn't defend it by trying to assign positive attributes to it (its effecient. ...yeah). Maybe there's nothing good about bad code and we should use being called out on it as an opportunity for improvement. No, lets double down on our delusions of superiority by telling ourselves that cr…

There is no globally applicable standard for what's crap code, so there's plenty of reason to excuse code some people might label "crap".

"Don't write crap code" is a terribly empty statement. Trying to "tidy up" "crap code" is also a great way to screw things up further if you turn out to be wrong about it.

Re: The Efficiency-Destroying Magic of Tidying Up

#85
post #64

Earlier quoted context omitted.

Exactly. I remember being called into consult on an accounting system for microfinance; the target audience was small to medium-sized. The code had an absurd amount of layering; one path I traced copied the data 8 times from fetch to render, each time into a different set of objects that had basically the same fields, but that were conceptually different. When I asked about this, I was told it was "best practice" and…

I used to write code like that - architecting whole application up front, creating layers upon layers of abstractions. Experience taught me to do the reverse now - start with the simplest version that works, keep going until writing code gets tough, and then switch to whiteboard and use what I learned along the way to design a proper solution (and if any part of the design process starts getting tough, I switch back…

Maybe the most astonishing thing I've learned in my career is that it's far better to design your system after the code is written and working!

Because that's the time when you've learned to understand the problem, and you already have working code to move around.

Re: The Efficiency-Destroying Magic of Tidying Up

#86
post #54

Earlier quoted context omitted.

Often true, but often 'beautiful code' does not impact the bottom line - even in the long term.

I agree, beautiful code is often the other extreme. Plus it's often only beautiful to the person that wrote it.

Maybe by aiming for "simple", you can as a side effect eventually achieve "beautiful".

I suspect aiming for beauty gives you neither.

Re: The Efficiency-Destroying Magic of Tidying Up

#87

Hmm, I thought that Amazon was famous for how they standardized their cross-company software? (With AWS as a side effect.) Or is this not the case anymore?

They didn't standardize the software, they standardized that all software should be accessible by API and that all software should be designed in such way to be openable to third party users if need arises.

Right, the right way to do standardization! It a shame that the author didn't add this very specific requirement though - some readers might think that the interfaces should be messy too...

Re: The Efficiency-Destroying Magic of Tidying Up

#88

Sorry but there's no excuse for crap code. If it's hard to understand then time is lost every time you have to work with it. You shouldn't defend it by trying to assign positive attributes to it (its effecient. ...yeah). Maybe there's nothing good about bad code and we should use being called out on it as an opportunity for improvement. No, lets double down on our delusions of superiority by telling ourselves that cr…

I actually think having business people who have control over what programmers do is the mistake very often. It leads to very bad decisions for the codebase as a whole and the programmers often don’t know the best way to fit in the random business needs because they are never told why the feature should exist. I think we need a better method to be able to make the right decisions for the code while still achieving th…

Huh, the part about software developers having to understand client's needs and work with them is what I've been taught. I'm guessing that in big enough companies, management starts to mess with processes that they should not touch?

Re: The Efficiency-Destroying Magic of Tidying Up

#89

Sorry but there's no excuse for crap code. If it's hard to understand then time is lost every time you have to work with it. You shouldn't defend it by trying to assign positive attributes to it (its effecient. ...yeah). Maybe there's nothing good about bad code and we should use being called out on it as an opportunity for improvement. No, lets double down on our delusions of superiority by telling ourselves that cr…

What about a mvp scenario? Many successful businesses have crap legacy code, but maybe they would not have been able to become successful ever had they not rushed with the code? Are you saying taking tech debt is never good?

To me it seems like a failure to take a look at the bigger picture. In the end it is all about the value provided. You are creating a start up that has 10 percent chance of succeeding and only if it gets to market fast.

Also it is never binary. It is always time invested vs quality of the code. It is a spectrum. From what point can you call code crap?

The closer you get to perfect code the more time it takes to get it better as you are closing near perfect.

Re: The Efficiency-Destroying Magic of Tidying Up

#90

Sorry but there's no excuse for crap code. If it's hard to understand then time is lost every time you have to work with it. You shouldn't defend it by trying to assign positive attributes to it (its effecient. ...yeah). Maybe there's nothing good about bad code and we should use being called out on it as an opportunity for improvement. No, lets double down on our delusions of superiority by telling ourselves that cr…

I disagree with such a blanket statement. Interfaces must remain simple, while implementations are free to be as complex as needed. Take a look at this article -- clearly the SIMD code is dense to get through, but it's very-much-so worth it for the performance gains. https://lemire.me/blog/2017/01/20/how-quickly-can-you-remove...

"Interfaces must remain simple, while implementations are free to be as complex as needed."

IOW, local complexity in exchange for global simplicity is often a good tradeoff.

Post reply on HN