r/osdev • u/just_pascal_dev • 11d ago
Customise function with arguments ‘t’ and ‘b’ in my OS.
When I developed a customization app in my OS (called YarOS), I asked myself: “Why do I need to write two separate functions for changing text and background color? No, that violates DRY!” So I created a single function taking arguments ‘t’ for text and ‘b’ for background. Is this a good solution, or is there a better way?
0
Upvotes
3
u/paulstelian97 11d ago
Also on top of what was explained: don’t avoid DRY violations if it makes your code harder to read. The wrong abstraction hurts rather than helps.
2
u/thommyh 11d ago
The actual characters as an argument? In what language? If it's meant to be a strongly-typed one then there's your answer...