문제

I have a sample multiple choice question of an Design-Pattern exam, namely:
A menu is in the MVC concept part of
a)Model
b)View
c) Controller d) Model&View

Some collegues and I would say c), because it's part of a control unit, but some collegues say it's b).

Could you help us with that question and the reason for the correct answer?

도움이 되었습니까?

해결책

Option b).

Because view is responsible for all the UI logic within MVC pattern.

Controller does not care whether the user's action originated from drop-down menu or some button. For controller it only matters, that based on said action, it will alter the state of model layer.

And model layer, while possibly being the source of available options, does not know how the options where presented. Look at it this way:

Which part of triad you would have to alter to transform the drop-down into a radio-group?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top