Hacker News new | past | comments | ask | show | jobs | submit login

> After calling class.enrol(student), I would expect the student to be enrolled, not just added to a list of students.

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.




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.


You are masterfully missing the point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: