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

Programming

17122 readers
165 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 !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] bleistift2@feddit.de 18 points 7 months ago (9 children)

I am a sky-high developer and know little of such low-level APIs. Please humor my ignorance: Isn’t it bad practice to write a god-method that sometimes uses these parameters, sometimes others? Isn’t this better refactored into multiple dedicated functions?

[–] LufyCZ@lemmy.world 6 points 7 months ago* (last edited 7 months ago) (4 children)

I'm just guessing, but what about backwards compatibility? Or cross-system compatibility?

For example, something like a syscall that's existed for 20 years. Changing it would break old apps.

Of course you could just keep the now "old" syscall and add new methods that replicate it's behavior, but haven't you then introduced bloat? More ways to do the same thing, meaning (eventually) more bugs, more fragmentation, memory usage, etc.

[–] MagicShel@programming.dev 4 points 7 months ago (3 children)

Let's say you currently have an overloaded "god method" that is used for twenty different things. The proper thing to do would be to create twenty different interfaces that each do one specific thing and then call the syscall behind the scenes. That allows you to update and modernize your apps, allows for better testing of specific use cases, etc.

The original exposed syscall is deprecated and then eventually you force all the reliant code to adopt the proper new interface. The original overloaded code is still there, but locked up in a black box where no one has to worry about it.

[–] LufyCZ@lemmy.world 4 points 7 months ago

Yeah, but people don't like change, and I'd expect low level engineers to like it even less.

And looking at Linux, that shit still supports ancient hardware, being able to actually get rid of old code (that now has to be maintained alongside the new code) is gonna be a PITA.

load more comments (2 replies)
load more comments (2 replies)
load more comments (6 replies)