Hacker News new | ask | show | jobs
by dharmon 860 days ago
I generally have a negative opinion of Martin, but did we read the same discussion? Martin was very gracious in letting many points slide (points where he was correct!), and was generously willing to end the conversation at a sort-of draw when it was clear that Muratori was not really prepared to discuss things at a detailed level (It was obvious to me from the start that Muratori thought "dynamic polymorphism" just meant deep hierarchies of inheritance, a la early C++, Martin realized this later and I think that was the first inkling that he was wasting his time).

Muratori was even wasting his time arguing against programmer time _in general_ is less valuable than machine time? And doesn't understand that LLVM is an extremely specialized piece of software, from which general software engineering practices should not be extracted?

1 comments

> It was obvious to me from the start that Muratori thought "dynamic polymorphism" just meant deep hierarchies of inheritance

Inheritance hierarchies aren't exclusively what he meant though. Interfaces and the whole 'prefer composition over inheritance' style of programming has the same fundamental problem Muratori is getting at: both inherently constrain a program's structure for, what he argues (and I agree with), has no benefit to the program's performance or the programmer's time. In fact, he argues that the constraints imposed by the use of inheritance/interfaces only slow programmers down.

His raw device driver example, in pt2 of their conversation, illustrates the advantage of procedural code over inheritance/interfaces. His API requires users to provide a function pointer that will be called whenever an event is raised. This API user is expected to switch over the enum values that they care to implement. This design is better than an interface that requires its members to implement read(), and write() functions because it is both more performant (no vtable overhead + compilers can make more aggressive optimizations) and more flexible (a new event can be added to the enum without requiring all the old code to be updated if they don't need to handle the new event type).