官术网_书友最值得收藏!

Services

I don't like the Controller making the decision on how to greet my users, first of all, because Controllers need to stay lean. I want my users to be greeted a bit more dynamically, depending on the time of day, and that will increase the complexity. Second of all, maybe I will want this greeting to be done elsewhere also (as, it turns out, I will do), and there is no way I am copying and pasting this logic somewhere else, nor am I going to misuse the Controller just to be able to call that method. The solution? We delegate the logic of constructing the greeting to a service and use that service in our Controller to simply output the greeting.

主站蜘蛛池模板: 武平县| 长宁区| 怀来县| 台前县| 崇仁县| 庆云县| 香河县| 怀安县| 连平县| 独山县| 平和县| 韩城市| 静乐县| 大英县| 康平县| 华安县| 清新县| 炉霍县| 廊坊市| 大宁县| 甘南县| 循化| 博兴县| 天门市| 永川市| 永年县| 图片| 英超| 克什克腾旗| 余江县| 武城县| 扎囊县| 自贡市| 庆云县| 黄骅市| 定边县| 集贤县| 昌都县| 沂水县| 房山区| 西乡县|