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

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.

主站蜘蛛池模板: 兴城市| 称多县| 白水县| 平罗县| 汨罗市| 嘉善县| 商洛市| 巨野县| 南皮县| 永顺县| 精河县| 会理县| 达拉特旗| 湘潭市| 郸城县| 洞口县| 绍兴市| 和平区| 隆尧县| 石景山区| 宣武区| 德钦县| 壤塘县| 襄樊市| 博爱县| 陆良县| 衡阳县| 乌海市| 木里| 英山县| 昌图县| 玉树县| 陆良县| 育儿| 改则县| 宝清县| 库车县| 京山县| 桃园县| 江门市| 会昌县|