News for hackers. Stuff that matters.
Re:Why Class? by Jormundir on Sunday November 24, 2013 @06:04PM (#6791587)
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.

Re:Why Class? by weavejester on Sunday November 24, 2013 @06:43PM (#6791719)
> 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.

Re:Why Class? by dbaupp on Sunday November 24, 2013 @10:14PM (#6792306)
Isn't that more a problem with the mainstream implementations of OOP, since one could concievably have an OOP language with fine-grained mutability?
Re:Why Class? by weavejester on Monday November 25, 2013 @10:19AM (#6794456)
Yes, I suppose it would be possible. It might work better with Smalltalk-like languages that revolve around message-passing.
Re:Why Class? by gngeal on Saturday December 07, 2013 @12:37PM (#6866961)
Jormundir is very much wrong on that. OOP was never supposed to "involve lots of mutation". Go ask Alan Kay. ;-)
Re:Why Class? by habosa on Sunday November 24, 2013 @06:13PM (#6791618)
That's why I like Scala so much. Design the system with OOP principles and implement it with functional programming.
Re:Why Class? by abhijitr on Sunday November 24, 2013 @06:36PM (#6791708)
In 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.

Re:Why Class? by koomi on Sunday November 24, 2013 @06:55PM (#6791761)
"The Architecture of Open Source Applications" is a book written with exactly that thought in mind.

http://aosabook.org/en/index.html

Re:Why Class? by commented on Tuesday December 03, 2013 @01:47PM (#6842210)
I'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/ by language.
Re:Why Class? by platz on Sunday November 24, 2013 @06:44PM (#6791725)
The 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

Re:Why Class? by xerophtye on Monday November 25, 2013 @01:51AM (#6792858)
I 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.