Shawn McGrath Critiques Object-Oriented Programming Using David Eberly's C++ Geometric Tools

Pinkie Pinkie Mew Mew

Summary:

Shawn McGrath critiques Object-Oriented Programming (OOP) in a C++ context, demonstrating its complexities with David Eberly's Geometric Tools library.

  • He emphasizes that despite Eberly's high intellect and experience, the OOP design makes his code almost impossible to understand and debug.
  • McGrath illustrates this by attempting to step through a simple triangulation algorithm in the Visual Studio debugger, repeatedly getting lost due to excessive indirection, template use, and inheritance hierarchies.
  • He contrasts this with his own linear, function-oriented implementation of the same algorithm, which he claims is significantly easier to follow and debug.
  • McGrath argues that OOP principles like encapsulation and abstraction, when poorly applied, lead to unnecessary complexity and obscure program flow, making code harder to read and maintain.
  • He highlights how basic tasks become convoluted due to numerous object instantiations and method calls, rather than straightforward conditional logic.

Shawn McGrath's Criticism of Object-Oriented Programming (OOP) [00:00:00]

Shawn McGrath expresses a strong negative opinion about Object-Oriented Programming (OOP), stating that it makes code:

Introduction to David Eberly's Code and Expertise [00:00:34]

McGrath uses David Eberly's source code as a prime example to demonstrate the flaws of OOP, highlighting Eberly's exceptional qualifications:

The Problem: Triangulating Curves in a Game [00:02:30]

McGrath outlines the task he wanted to perform:

Debugging Eberly's OOP Triangulation Code [00:04:17]

McGrath attempts to step through Eberly's C++ code using the Visual Studio debugger, encountering immediate difficulties:

Shawn McGrath's Alternative: Linear, Procedural Code [00:13:02]

McGrath contrasts Eberly's OOP implementation with his own linear version of the same triangulation algorithm:

Conclusion on OOP's Failures [00:26:37]

McGrath reiterates his main thesis: