• 3 Posts
  • 40 Comments
Joined 1 year ago
cake
Cake day: June 15th, 2023

help-circle













  • This isn’t a sharpshooter fallacy–that would mean the good things OP is noting are made “good” after they happen.

    If you think this is an unfounded optimism because there are a lot more bad things (or that things have gotten worse over the last two centuries), there’s an argument to be had there, but this isn’t it.


  • While there are lots of programming courses out there, not many of them will explicitly teach you about good programming principles. Here are a couple things off the top of my head:

    • High cohesion, low coupling. That is, when you divide up code into functions and classes, try to minimize the number of things going between those functions (if your functions regularly have 6+ arguments, that’s a red flag and should be reviewed). And when something needs to be broken up into pieces, try to find the spots where there are minimal points of contact.

    • Try to divide code between functions and files in a way that doesn’t feel too busy. If there are a bunch of related functions that are cluttering up one file, or that are referenced from multiple places, consider making a module for those. If you’re not sure what “too busy” means…

    • Read a style guide. There are lots of things that will help you clean up and organize your code. The guide won’t necessarily tell you why to do each thing, but it’s a great tool when you don’t have another point of reference.

    If you have a chance to take a “Software Engineering 101” class, this is where you’d learn most of the basic principles for writing better code.