更新时间: 试题数量: 购买人数: 提供作者:

有效期: 个月

章节介绍: 共有个章节

收藏
搜索
题库预览
Applying Cohesion (____) on the type of software you are writing, you may need to compromise a bit. Although we should always strive to have our code at the highest level of cohesion, sometimes that may make the code (____) unnatural. There is a difference between being unaware of design principles and consciously not following a design principle in a (____) context. I don't write my code with the goal that it should satisfy every single design principle out there but I always try to have a good reason every time I decide not to (____) certain principles. Having said that, cohesion is one of the most important building blocks of software design and (____) it well is essential for writing well- crafted code. If you are (____) a framework, a very generic part of your code, or data transformation, chances are that the majority of your modules and processing elements will be at sequential and functional levels. However, when (____) business rules in a commercial application, i. e. an application where there are business logic, user journeys, database access, etc. ,there is a good chance that some of your modules and processing elements will be at communicational level and some even at a lower level of cohesion. And that's OK as (____) as it was a conscious decision and the right thing to do in that context. Some people (____) cohesion to the Single Responsibility Principle (SRP). Although SRP is a great software principle and entirely based on cohesion, it has a quite narrow and subjective scope. Identifying responsibilities is not always an easy thing.We need to develop a keen eye to detect minor variations in behavior. Unit tests for a module can potentially (____) us to identify the different behaviors, if the code was really test-driven, of course . The more cohesive your code is, the more reusable, robust and easy to maintain it will be.