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

Summary

In this chapter, we looked at the architectural quality attribute of modifiability and its various aspects. We discussed readability in some detail, including the readability antipatterns along with a few coding antipatterns.

We looked at various techniques for improving readability of code and understood the different aspects of commenting of code such as function, class and module docstrings. We also looked at PEP-8, the official coding convention guideline for Python.

We then looked at some rules of thumb for code comments and went on to discuss the fundamentals of modifiability, namely, coupling and cohesion of code. We looked at different cases of coupling and cohesion with a few examples. We then went on to discuss the strategies of improving modifiability of code such as providing explicit interfaces or APIs, avoiding two-way dependencies, abstracting common services to helper modules, and using inheritance techniques. We looked at an example where we refactored a class hierarchy via inheritance to abstract away common code and to improve the modifiability of the system.

Toward the end, we listed the different tools, providing static code metrics in Python such as Pylint, Flake8, Pyflakes, and others. We learned about McCabe Cyclomatic complexity with the help of a few examples. We also learned what code smells are and performed a refactoring exercise to improve the quality of the piece of code in stages.

In the next chapter, we'll discuss another important quality attribute of software architecture, namely, testability.

主站蜘蛛池模板: 浦北县| 于都县| 万荣县| 肃宁县| 凤山市| 德化县| 文安县| 石林| 上思县| 稷山县| 应城市| 宾川县| 新巴尔虎右旗| 嘉禾县| 长阳| 霍林郭勒市| 茂名市| 彰武县| 清新县| 黑河市| 老河口市| 邢台县| 石狮市| 武汉市| 新泰市| 民乐县| 上蔡县| 安庆市| 阿克苏市| 堆龙德庆县| 会东县| 德清县| 牟定县| 呼玛县| 右玉县| 虎林市| 遵义县| 玛多县| 武功县| 额济纳旗| 大宁县|