this post was submitted on 01 Mar 2024
18 points (95.0% liked)

Programming

17488 readers
110 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
[–] [email protected] 3 points 8 months ago

Obviously taken to an extreme it's bad, but I think it's fine to have a function that can do one thing two or more different ways and ignore a certain parameter if one of the ways doesn't need it. I've done some programming against the Win32 API and this is what jumped to mind for me, and I think it's the typical case here. If I were designing from scratch I might split it into n functions that do it one way, but it's such a small difference I wouldn't fret over it. And of course making a change to the Windows API is an undertaking, probably not worth it in most cases.