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

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.

主站蜘蛛池模板: 南靖县| 昔阳县| 普陀区| 贡山| 景泰县| 获嘉县| 尉犁县| 太和县| 夏邑县| 东丽区| 农安县| 固镇县| 桐梓县| 呼伦贝尔市| 彭阳县| 肃南| 白银市| 黄陵县| 宝兴县| 满洲里市| 宁海县| 新河县| 车险| 永春县| 麦盖提县| 昆明市| 兴国县| 鄂托克旗| 伽师县| 上思县| 新巴尔虎右旗| 玉门市| 旬邑县| 上思县| 宁阳县| 遂溪县| 青浦区| 赣榆县| 馆陶县| 玉林市| 扬州市|