Stop squashing your commits. You're squashing your AI too
2 points by jannesblobel 7h ago 7 comments
Ask HN: Best codebases to study to learn software design?
100 points by pixelworm 2d ago 89 comments
Object-oriented design patterns in C and kernel development
12 joexbayer 1 8/26/2025, 8:34:15 AM oshub.org ↗
This technique predates object oriented programming. It is called an abstract data type or data abstraction. A key difference between data abstraction and object oriented programming is that you can leave functions unimplemented in your abstract data type while OOP requires that the functions always be implemented.
The sanest way to have optional functions in object oriented programming that occurs to me would be to have an additional class for each optional function and inherit each one you implement alongside your base class via multiple inheritance. Then you would need to check at runtime whether the object is an instance of the additional class before using the optional functions. With an abstract data type, you would just be do a simple NULL check to see if the function pointer is present before using it.