I’ve written more tests than just about anybody. Spent years comparing dynamic and static type systems. My life's work is to maximize correctness and minimize maintenance.

All it's taught me: the single most important thing programmers can do to improve their code is to minimize branching (e.g. `if` statements). Code that executes the same set of instructions every time behaves the same way every time.

🔗 justin.searls.co/takes/2024-04

10
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
Richard Schneeman

@searls if you say so

0
8mo
Matthew Martin ☑ ✅📛

@searls No if ands or buts about it

0
8mo
synlogic

@searls yeah I'm the author of a latency instrum lib. one of the reasons I made it was cuz didnt like relying on the metrics provided by an external/hands-off profiler. because just knowing "how long a function takes" is too coarse/noisy. latency depends on precise code path followed, & various context factors. there are variants in each flow, depending on if conditions like u said, switches, errors, exceptions, panics, lock contention, remote service delays etc. all effect metrucs & outcome

0
8mo
Jamie Lawrence

@searls reducing if statements is largely how I describe my job as CTO because it’s the clearest way to communicate the complexity, risk, and maintenance burden of seemingly-trivial feature requests

0
8mo
Todd A. Jacobs

@searls Isn’t what you’re saying just an oversimplification of “cyclomatic complexity?” Over-complicated branching causes pain, but code that never branches anywhere is inflexible.

0
8mo
Lennart Fridén

@searls Fighters of cyclomatic complexity, unite!

0
8mo
Stephen Crosby

@searls Louder for the people in the back!

0
8mo
Richard Brockie

@searls I have some ~10 year old data validation in beginner’s python that is replete with ifs. It works but I dread touching it. It is essentially unmaintainable and needs to be replaced.

0
8mo
Kevin Trainor

@searls Most people injured in falls fell while they were walking.

0
8mo
Replies