3 ms·
But then the 'Student' object does not represent a student but represent the result of a search which may or may not be a student, and this result decides its o
by goto11 8y ago
But then the 'Student' object does not represent a student but represent the result of a search which may or may not be a student, and this result decides its own view. Effectively the model is coupled to a specific view, which seems wrong to me. I would much prefer to have the search return an Option<Student> and then have the controller select the view based on this option. This also makes it explicit that the search may nor return a result, which is not really explicit if it always returns a Student instance.
- joshka 8y agoNote the explicit change to StudentSearchResult over student there to make your last comment kind of a yes, I agree and that was the intent... There are many ways that this can be implemented that avoid an if result != null / == no value, often a map suffices.