4 ms·
I think the procedural option is better. It is just so much less code.
by stelund 12y ago
I think the procedural option is better. It is just so much less code.
- deleted 12y ago[deleted]
- vinceguidry 12y agoIt 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 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-little-things http://www.confreaks.com/videos/3358-railsconf-all-the-littl...
- olavk 12y agoIt 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.