4 ms·
I think of learning OOP much like learning Chess. In Chess it's very easy to learn how the pieces move and start playing, but becoming a master is incredibly di
by Jormundir 13y ago
I think of learning OOP much like learning Chess. In Chess it's very easy to learn how the pieces move and start playing, but becoming a master is incredibly difficult, requiring years and years of deliberate practice. When I see people complaining about OOP, it makes me think of two beginners playing Chess, thinking victory is a random outcome.
The dialogue of the article is entirely about coupling, and in OOP figuring out how to make a loosely coupled system is what separates the grand masters from the beginners. Designing a loosely coupled system is incredibly hard and requires years of deliberate practice to master. So when someone who's a beginner or not very good at OO design claims OO isn't a valuable paradigm, I don't listen. Bad OO can be less valuable than no OO, just like anything else, and just like anything else, that doesn't make the whole paradigm bad.
I've explored functional programming in a couple of college courses now, and find it very intriguing. When it's time to go a make a system, however, I find it difficult to boil down functional principles into the system I want. This is a complaint in the same vein as the OO complaints. Functional programming is incredibly impressive when designing a behavior, but what separates the masters from the beginners seems to be when it's time to model an entire system. This is the current separation in my mind: OO is designed and really good for modeling a complex system that involves lots of mutation, and functional programming is really good for modeling and separating behavior within a system.
I don't think we have grounds to say one is better than the other yet. Both OO and Functional have their niches where they're amazingly effective, and both have a giant gray area where it's difficult to mold the pure paradigm onto a solution.
I think the best solution so far is a mixture of the two, such as we see in Scala. Though, a mixture too has its own set of drawbacks. Mainly what seems to be an explosion of language complexity and a giant need for design conventions and limitations when there are so many possible routes to a solution.
The best of the current climate is a mixture of the two, with a framework that clearly defines and separates where and when to use one paradigm over the other, so you aren't bogged down with the additional complexity.
- habosa 13y agoThat's why I like Scala so much. Design the system with OOP principles and implement it with functional programming.
- abhijitr 13y agoIn chess there are hundreds of annotated databases out there where I can study how the masters play, read analyses of different playing styles, and try to follow along and improve my own intuition. Is there an equivalent for programming? Github and Stackoverflow are good resources, but it would be interesting to see something more structured. Perhaps a DB of a fixed set of problems such as projecteuler.net with voting and analysis of the submitted solutions.
- koomi 13y ago"The Architecture of Open Source Applications" is a book written with exactly that thought in mind. http://aosabook.org/en/index.html http://aosabook.org/en/index.html
- commented 13y agoI've just gotten started, but I'm going to gather solutions to the problems of projecteuler on github. Everyone should feel free to pitch in ones the format to submit on is established. Basically, you will be able to browse the solutions at http://projecteuler.github.io/ http://projecteuler.github.io/ by language.
- weavejester 13y ago> OO is designed and really good for modeling a complex system that involves lots of mutation I'd argue that this is where OOP struggles the most. Because mutation in OOP is implicit and unconstrained, it's more difficult to manage than in FP languages, which typically have more sophisticated controls and constraints for handling state.
- dbaupp 13y agoIsn't that more a problem with the mainstream implementations of OOP, since one could concievably have an OOP language with fine-grained mutability?
- weavejester 13y agoYes, I suppose it would be possible. It might work better with Smalltalk-like languages that revolve around message-passing.
- gngeal 13y agoJormundir is very much wrong on that. OOP was never supposed to "involve lots of mutation". Go ask Alan Kay. ;-)
- platz 13y agoThe slide below describing "Type it to the max" seems to describe what you're referring to. It's powerful, but I don't think they are beginner languages. http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/31/slides/martin.pdf http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/31/slides/martin.pdf
- xerophtye 13y agoI Love this comment! The parable to chess is most appropriate. It's easy to learn how each piece works, but to use them properly to create a magnificent system is the work of grand masters. PS: C makes me feel like this too! I just know how the pieces work.