OOP vs Data Oriented Programming: Which One to Choose?
summary
Compares an order-processor example where extensibility comes from an interface (PaymentMethod using dependency inversion) to a third-party trade example where polymorphic hierarchies are awkward and Java’s newer features—sealed interfaces, records, and pattern matching on records—replace factories and parallel auditor hierarchies. Demonstrates identical behavior but far less boilerplate, immediate compilation errors when a new trade subtype appears, and recommends OOP when owning the hierarchy and data-oriented patterns when processing external data, favoring polymorphism or data patterns by context.
AI-written summary · about
chapters (7)
- 0:00Introduction to OOP vs DOP
- 10:40Essence of OOP with polymorphism
- 20:38Challenges with third-party classes
- 33:14Parallel hierarchy problems
- 43:55Data-oriented approach with pattern matching
- 54:28Pros and cons of DOP
- 59:37Choosing simplicity over dogma








