Clean Code in Python: Refactor your legacy codebase (Paperback) (Python 清潔代碼:重構你的舊有代碼庫)

Mariano Anaya

買這商品的人也買了...

相關主題

商品描述

Getting the most out of Python to improve your codebase

Key Features

  • Save maintenance costs by learning to fix your legacy codebase
  • Learn the principles and techniques of refactoring
  • Apply microservices to your legacy systems by implementing practical techniques

Book Description

Python is currently used in many different areas such as software construction, systems administration, and data processing.

In all of these areas, experienced professionals can find examples of inefficiency, problems, and other perils, as a result of bad code. After reading this book, readers will understand these problems, and more importantly, how to correct them.

The book begins by describing the basic elements of writing clean code and how it plays an important role in Python programming. You will learn about writing efficient and readable code using the Python standard library and best practices for software design. You will learn to implement the SOLID principles in Python and use decorators to improve your code. The book delves more deeply into object oriented programming in Python and shows you how to use objects with descriptors and generators. It will also show you the design principles of software testing and how to resolve software problems by implementing design patterns in your code. In the final chapter we break down a monolithic application to a microservice one, starting from the code as the basis for a solid platform.

By the end of the book, you will be proficient in applying industry approved coding practices to design clean, sustainable and readable Python code.

What you will learn

  • Set up tools to effectively work in a development environment
  • Explore how the magic methods of Python can help us write better code
  • Examine the traits of Python to create advanced object-oriented design
  • Understand removal of duplicated code using decorators and descriptors
  • Effectively refactor code with the help of unit tests
  • Learn to implement the SOLID principles in Python

Who this book is for

This book will appeal to team leads, software architects and senior software engineers who would like to work on their legacy systems to save cost and improve efficiency. A strong understanding of Programming is assumed.

Table of Contents

  1. Introduction, Code Formatting, and Tools
  2. Pythonic Code
  3. General Traits of Good Code
  4. The SOLID Principles
  5. Using Decorators to Improve our Code
  6. Getting more out of our objects with Descriptors
  7. Using Generators
  8. Unit Testing and Refactoring
  9. Common Design Patterns
  10. Clean Architecture

商品描述(中文翻譯)

充分利用Python提升您的程式碼品質

主要特點


  • 透過學習修復舊有程式碼,節省維護成本

  • 學習重構的原則和技巧

  • 實施實用技巧,將微服務應用於舊有系統

書籍描述

Python目前在軟體建構、系統管理和資料處理等多個領域中被廣泛使用。

在所有這些領域中,有經驗的專業人士都可以找到糟糕的程式碼所帶來的效率低下、問題和其他風險的例子。閱讀本書後,讀者將了解這些問題,更重要的是,如何修正它們。

本書首先描述了撰寫乾淨程式碼的基本要素,以及它在Python編程中的重要作用。您將學習使用Python標準庫和軟體設計的最佳實踐來撰寫高效且易讀的程式碼。您將學習在Python中實施SOLID原則,並使用裝飾器來改進程式碼。本書更深入探討了Python中的物件導向編程,並向您展示如何使用描述器和生成器與物件一起使用。它還將向您展示軟體測試的設計原則,以及如何通過在程式碼中實施設計模式來解決軟體問題。在最後一章中,我們將從程式碼作為堅實平台的基礎,將一個龐大的應用程式拆分為微服務。

通過閱讀本書,您將能夠熟練應用行業認可的編碼實踐,設計乾淨、可持續且易讀的Python程式碼。

您將學到什麼


  • 建立有效的開發環境工具

  • 探索Python的魔術方法如何幫助我們撰寫更好的程式碼

  • 研究Python的特性,創建高級物件導向設計

  • 使用裝飾器和描述器消除重複的程式碼

  • 透過單元測試有效地重構程式碼

  • 學習在Python中實施SOLID原則

本書適合對象

本書適合團隊領導、軟體架構師和高級軟體工程師,他們希望在舊有系統上工作,以節省成本並提高效率。需要對程式設計有深入的理解。

目錄


  1. 介紹、程式碼格式化和工具

  2. Pythonic程式碼

  3. 良好程式碼的一般特點

  4. SOLID原則

  5. 使用裝飾器改進程式碼

  6. 進一步了解描述器

  7. 使用生成器

  8. 單元測試和重構

  9. 常見設計模式

  10. 乾淨架構