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

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.

主站蜘蛛池模板: 自贡市| 南漳县| 桦南县| 铁岭县| 伊春市| 东港市| 唐河县| 汤阴县| 武义县| 盘山县| 赣榆县| 巫山县| 长武县| 巴彦淖尔市| 台中市| 九江市| 高青县| 左权县| 紫阳县| 肥乡县| 商河县| 华宁县| 白银市| 黑河市| 平顺县| 专栏| 南川市| 康定县| 建德市| 长丰县| 买车| 胶南市| 台山市| 红原县| 湖州市| 同仁县| 牟定县| 香格里拉县| 七台河市| 静海县| 红桥区|