💾 Archived View for bbs.geminispace.org › u › mediocregopher › 5678 captured on 2023-09-28 at 16:56:02. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2023-11-04)

-=-=-=-=-=-=-

Re: "I was recently reading other people's code, and I'm..."

Comment in: u/clseibold

How a function gets written depends on its purpose. Some functions need to be big.

A thousand times this. I think a common exercise for new programmers is to take some complex, badly written, monolithic code, and to refactor it into smaller functions. And that's a good thing to practice. But I don't think the converse skill is ever taught, that of identifying when a big chunk of logic should stick together.

Sometimes code is big and complex because the requirements are big and complex. Obviously mental overhead can be reduced with some strategic abstraction, but beyond that I much prefer a giant function which mirrors the requirements than the same thing cut up arbitrarily and scattered around.

— John Carmack has his own take on this subject in favor large functions, though he's coming from a more performance based perspective.

👻 mediocregopher

14 hours ago

Original Post

🚀 clseibold

I was recently reading other people's code, and I'm reminded why I don't usually ever do this - I hate reading other people's code. I program very differently than a lot of other people. I don't make tons of 5-line files, but it has become common to make tons of 5-line files, and it just makes your code extremely confusing to navigate. I don't do classes. OOP makes you abstract more than you need to, is extremely confusing to navigate (it almost requires that you make tons of 5-line files, lol)...

💬 5 comments · 1 like · 2023-09-26 · 2 days ago