Skip to content

Comment on Why Is Object-Oriented Programming Useful? With a Role-Playing Game Exampleparent

Comments

The only real form of code reuse that OOP addresses is direct object inheritance.

Not really, or at least, not with a well designed system. Give me a system with small, composable objects. I can reuse code by creating a new object for one of the components of the system, or by writing an object that knows how to talk to a previously existing objects. Sandi Metz' POODR [1] should be required reading for anyone who is writing object oriented code.

Functional programming is also worth learning as well, and Martin Odersky's Coursera [2] shows how Scala can be used for code that is both object oriented and functional.

[1]: http://www.poodr.com

[2]: https://www.coursera.org/course/progfun

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.