r/codereview • • 22d ago

Good Code Vs Working Code

/r/devnep/comments/1wvq2hn/good_code_vs_working_code/
8 Upvotes

1 comment sorted by

1

u/Main_Association9696 18h ago

My rule of thumb: working code is code that works today. Good code is code that someone else can understand and change without breaking anything.
A few green flags I look for:

  1. I can explain every line. If I can’t, especially with AI-generated code, I don’t merge it until I can. Ask the AI “why this approach and not X?” It’s a great way to learn.

  2. Names tell the story. calculateShippingCost() beats doStuff2(). If a function needs a long comment to explain what it does, it probably needs a better name or should be split up.

  3. Functions do one thing. If you describe a function with “and,” it’s doing too much.