News for hackers. Stuff that matters.
Re:Anthropomorphism Gone Wrong: OOP by stelund on Saturday January 03, 2015 @11:41AM (#8831146)
I think the procedural option is better. It is just so much less code.
Re:Anthropomorphism Gone Wrong: OOP by vinceguidry on Saturday January 03, 2015 @01:21PM (#8831496)
It does until it doesn't. Let's say you only want to move the bad students to the principal. Then you want to model pop quizzes. Students who score 1/5 on three or more per month go to the principal. Or call their parents, whatever.

After a while you realize that you're doing all this stuff to 'bad' students. This is where you really start to want some way to organize all the stuff you're doing to these bad students, as all the code you have dealing with them is sprinkled liberally through the codebase in conditionals in your procedures.

You'll start pulling out logic and things will start breaking. What you thought was less code is just crazy to manage.

The Gilded Rose kata illustrates the dangers of procedural code excellently.

http://craftsmanship.sv.cmu.edu/exercises/gilded-rose-kata

Sandi Metz has an excellent discussion on using OOP to improve the design of a codebase.

http://www.confreaks.com/videos/3358-railsconf-all-the-littl...

Re:Anthropomorphism Gone Wrong: OOP by olavk on Saturday January 03, 2015 @01:48PM (#8831588)
It is less code because it doesn't use encapsulation. So is encapsulation a benefit or just needless overhead? Depends on the size of the program.