Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very often in code like that you see "struct" types filled with function pointers.. Those are literal OO "vtables", just implemented manually instead of being generated by the compiler.

The Linux kernel is huge, yes, and is written in a "pre-OO" language. It's also full of OO paradigms.

For example, the core kernel developers don't want to have to write huge "switch" statements to handle the thousands of different drivers written by tens of thousands of third-party developers.

What do you expect to see at this API boundary? Perhaps.. and OO API with vtables and everything?

Yup: https://www.kernel.org/doc/html/v4.11/driver-api/infrastruct...

Function pointers in structs as far as the eye can see...



> Very often in code like that you see "struct" types filled with function pointers.

Fair point. Though with the explicitness that's required to do this in C (you have to pass the actual struct pointer that would normally be the receiver, along with a general lack of inheritance) results in code that's much easier to understand than the patterns that the traditional OO languages have created for themselves. I suppose that's less of a criticism of OO itself and more of a criticism of the people who build languages that emphasize OO, and the general ecosystems that crop up around them.

> written in a "pre-OO" language

I would be remiss if I didn't point out that the "OO languages" go all the way back to Simula67, which predates C. Though at that point OO was still in its "academic" phase the way functional programming is today.


For the record, the Linux kernel is not huge, just large. Just saying that because many people here show Linux as a model of a "huge" software project and yet it absolutely isn't. E.g., project-wide refactors/API changes are still performed multiple times per release and done usually by a single-person team, something which would just be unthinkable in huge software projects.

Agreed with the point, though.


What is your distinction between "huge" and "large"? The Linux kernel is over 30 million SLOC now (though a lot of that is drivers). That's "just" large?


I am mostly talking about concurrent contributors, but yes, even 30 MSLOC is just "large", not "huge". Stories of commercial software projects having to build "overnight" on server farms are common.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: