this post was submitted on 01 Sep 2023
337 points (96.2% liked)
Programming
17308 readers
191 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Go with what works
Error messages should contain the information that caused the error. Your average Microsoft error "error 37253" is worthless to me
Keep functions or methods short. Anything longer than 20 - 50 lines is likely too long
Comment why is happening, not what
PHP is actually a really nice language to work with both for web and command line utils
Don't over engineer, KISS. Keep It Simple Stupid
SOLID is quite okay but sometimes there are solid reasons to break those rules
MVC is a PITA in practice, avoid it when possible
I don't have issue with methods being 200 lines, as long as they have a singel concept and is easy to follow.
If the method does a long thing, the keep it long. I do a lot of data analysis and simulation, and so often people who came before had this urge to shorten methods, so we get:
Sometimes there's a place for that, like if
calculation
could be swapped for a different function, or ifcalculation
is used all over the program. It's a pretty good clue that something is up though when the signatures are almost identical. Of course, that has just led to people writing: