- Software Architecture with Python
- Anand Balachandran Pillai
- 241字
- 2021-07-02 23:29:57
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.
- Python快樂編程:人工智能深度學習基礎
- Mastering ServiceStack
- ASP.NET Core 5.0開發入門與實戰
- Mastering matplotlib
- Windows Server 2012 Unified Remote Access Planning and Deployment
- 人人都是網站分析師:從分析師的視角理解網站和解讀數據
- jQuery開發基礎教程
- QGIS By Example
- SQL經典實例(第2版)
- 大話Java:程序設計從入門到精通
- Spring MVC+MyBatis開發從入門到項目實踐(超值版)
- Learning Node.js for .NET Developers
- Mastering Android Studio 3
- Android高級開發實戰:UI、NDK與安全
- Drupal 8 Development Cookbook(Second Edition)