I've always believed the opposite: get conditionals deep in your code so that the higher level control flow is regular.
I've always believed the opposite: get conditionals deep in your code so that the higher level control flow is regular. But I suppose my greater philosophy for making code that avoids bugs is that you have a couple things that are done when dealing with data: - distribution - deciding And you want to avoid distribution and deciding being mixed together in the same spot. "Distribution" can be for loops but also breaking up some data based on some key into N bistinct buckets "Deciding" is where you're looking at the data more closely to make some decision (like "is this a big customer or a small customer") Distribution often involves decision making, but if you mix them all in one spot you can obfuscate your decision points. Splitting it up just makes things "obviously" right or "obviously" wrong. Perf stuff is another discussion of course, but in practice most things are not at a scale where it matters. by_category = defaultdict(list) for d in data: by_category[category(d)].append(d) for category, per_category_data in by_category.items(): do_thing(category, per_category_data) I really value code patterns that make mistakes obvious, or at least makes it harder to stuff a mistake in somewhere. Some patterns are harder to describe in this model though. (I do like the advice of having a consistent vocabulary for working on collections as a principle though, I just find that top-level conditional use tends to quickly get you into "... why is this method not called" territory, which is a more annoying problem than "why is this slow")
Posted by rtpg on Oct 7, 2026, 11:24 PM
Tags
Related issues
- I mean that's the problem though.
- The biggest problem with AI isn't being able to do things.
- I am a 3D printing maker type nerd (I make my own tools for other creative tasks, rather than as their own outcomes) and I saw an incredi...
- Of course not, those are clearly scams.
- Claude makes more detailed plans that seem better if you just skim them, but when analyzed, has a lot of errors, usually.
- Effectively everyone is building the same tools with zero quantitative benchmarks or evidence behind the why / ideas … this entire s...
Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments
hackernews (EdTech)
I mean that's the problem though.
I've always believed the opposite: get conditionals deep in your code so that the higher level control flow is regular.
The biggest problem with AI isn't being able to do things.
I am a 3D printing maker type nerd (I make my own tools for other creative tasks, rather than as their own outcomes) and I saw an incredi...
Of course not, those are clearly scams.
Claude makes more detailed plans that seem better if you just skim them, but when analyzed, has a lot of errors, usually.
Effectively everyone is building the same tools with zero quantitative benchmarks or evidence behind the why / ideas … this entire s...
> creating and operating a small company in Germany is a nightmare To be fair, I think the problem operating in Germany is its federated...
I've always believed the opposite: get conditionals deep in your code so that the higher level control flow is regular.
I've always believed the opposite: get conditionals deep in your code so that the higher level control flow is regular. But I suppose my greater philosophy for making code that avoids bugs is that you have a couple things that are done when dealing with data: - distribution - deciding And you want to avoid distribution and deciding being mixed together in the same spot. "Distribution" can be for loops but also breaking up some data based on some key into N bistinct buckets "Deciding" is where you're looking at the data more closely to make some decision (like "is this a big customer or a small customer") Distribution often involves decision making, but if you mix them all in one spot you can obfuscate your decision points. Splitting it up just makes things "obviously" right or "obviously" wrong. Perf stuff is another discussion of course, but in practice most things are not at a scale where it matters. by_category = defaultdict(list) for d in data: by_category[category(d)].append(d) for category, per_category_data in by_category.items(): do_thing(category, per_category_data) I really value code patterns that make mistakes obvious, or at least makes it harder to stuff a mistake in somewhere. Some patterns are harder to describe in this model though. (I do like the advice of having a consistent vocabulary for working on collections as a principle though, I just find that top-level conditional use tends to quickly get you into "... why is this method not called" territory, which is a more annoying problem than "why is this slow")
Comments (0)
No comments yet. Start the discussion.