Re:On DRY and the cost of wrongful abstractions
by flukus on Monday September 19, 2016 @12:27AM
(#12528905)
If they are not different then you're half way to going full Active Record (which I'd consider an anti-pattern). There is likely much more to enrolling a student than adding them to a class, and most of that logic should not go in class.
Re:On DRY and the cost of wrongful abstractions
by hackinthebochs on Monday September 19, 2016 @01:42AM
(#12529217)
You are masterfully missing the point.
Why do they have to be different? That's really his point. In this situation, enrolling just requires adding their student id to the list of students in the class. But while doing 'class.students.append(student_id)' accomplishes that, it is not clear reading that line that it actually enrolls the student in the class, rather then just being one step of a larger process, or something else all-together.