- 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.
- Django+Vue.js商城項目實戰(zhàn)
- .NET之美:.NET關(guān)鍵技術(shù)深入解析
- 在最好的年紀學Python:小學生趣味編程
- C程序設(shè)計簡明教程(第二版)
- 測試驅(qū)動開發(fā):入門、實戰(zhàn)與進階
- Python進階編程:編寫更高效、優(yōu)雅的Python代碼
- Mastering Python High Performance
- Windows Server 2012 Unified Remote Access Planning and Deployment
- Nginx Essentials
- Yocto for Raspberry Pi
- TypeScript項目開發(fā)實戰(zhàn)
- 低代碼平臺開發(fā)實踐:基于React
- Protocol-Oriented Programming with Swift
- Python深度學習原理、算法與案例
- Unity 3D/2D移動開發(fā)實戰(zhàn)教程