Modernizing Legacy Applications in PHP

Paul M. Jones

  • 出版商: Packt Publishing
  • 出版日期: 2016-08-31
  • 售價: $1,810
  • 貴賓價: 9.5$1,720
  • 語言: 英文
  • 頁數: 286
  • 裝訂: Paperback
  • ISBN: 1787124703
  • ISBN-13: 9781787124707
  • 相關分類: PHP
  • 海外代購書籍(需單獨結帳)

商品描述

Get your code under control in a series of small, specific steps About This Book * Learn to extract and replace legacy artifacts, * Improve your application from the ground up while keeping your codebase fully operational, * Improve the quality of your legacy applications. Who This Book Is For PHP developers from all skill levels will be able to get value from this book and will be able to transform their spaghetti code applications to clean, modular applications. If you are in the midst of a legacy refactor or you find yourself in a state of despair caused by the code you have inherited, this is the book for you. All you need is to have PHP 5.0 installed, and you're all set to change the way you maintain and deploy your code! What You Will Learn * Replace global and new with dependency injection * Extract SQL statements to gateways * Convert action logic to controllers * Remove repeated logic in page scripts * Create maintainable PHP code from crufty legacy PHP In Detail Have you noticed that your legacy PHP application is composed of page scripts placed directly in the document root of the web server? Or, do your page scripts, along with any other classes and functions, combine the concerns of model, view, and controller into the same scope? Is the majority of the logical flow incorporated as include files and global functions rather than class methods? Working with such a legacy application feels like dragging your feet through mud, doesn't it?This book will show you how to modernize your application in terms of practice and technique, rather than in terms of using tools like frameworks and libraries, by extracting and replacing its legacy artifacts. We will use a step-by-step approach, moving slowly and methodically, to improve your application from the ground up. We'll show you how dependency injection can replace both the new and global dependencies. We'll also show you how to change the presentation logic to view files and the action logic to a controller. Moreover, we'll keep your application running the whole time. Each completed step in the process will keep your codebase fully operational with higher quality. When we are done, you will be able to breeze through your code like the wind. Your code will be autoloaded, dependency-injected, unit-tested, layer-separated, and front-controlled. Most of the very limited code we will add to your application is specific to this book. We will be improving ourselves as programmers, as well as improving the quality of our legacy application. Style and approach This book gives developers an easy-to-follow, practical and powerful process to bring their applications up to a modern baseline. Each step in the book is practical, self-contained and moves you closer to the end goal you seek: maintainable code. As you follow the exercises in the book, the author almost anticipates your questions and you will have the answers, ready to be implemented on your project.

商品描述(中文翻譯)

在一系列小而具體的步驟中,將您的程式碼掌控在手。 關於本書 * 學習如何提取和替換遺留的工件, * 在保持程式碼庫完全運作的同時,從頭開始改進您的應用程式, * 提高遺留應用程式的品質。 本書適合對PHP有不同技能水平的開發人員,他們可以從本書中獲得價值,並將其麵條式程式碼應用程式轉換為乾淨、模塊化的應用程式。如果您正在進行遺留重構,或者您因為繼承的程式碼而感到絕望,那麼這本書就是為您而寫的。您只需要安裝PHP 5.0,就可以改變您維護和部署程式碼的方式! 您將學到什麼 * 使用依賴注入替換全域變數和new關鍵字 * 將SQL語句提取到閘道 * 將動作邏輯轉換為控制器 * 在頁面腳本中刪除重複邏輯 * 從雜亂的遺留PHP代碼中創建可維護的PHP代碼 詳細內容 您是否注意到您的遺留PHP應用程式由直接放置在網頁伺服器文件根目錄中的頁面腳本組成?或者,您的頁面腳本以及其他任何類和函數,是否將模型、視圖和控制器的關注點結合到同一範圍中?大部分的邏輯流程是否都是通過包含檔案和全域函數而不是類方法來實現的?與這樣的遺留應用程式一起工作感覺就像在泥濘中拖著腳步,不是嗎?本書將向您展示如何通過實踐和技巧來現代化您的應用程式,而不是使用框架和庫等工具,通過提取和替換其遺留工件。我們將使用逐步的方法,緩慢而有條理地改進您的應用程式。我們將向您展示如何使用依賴注入來替換new和全域依賴。我們還將向您展示如何將表示邏輯更改為視圖檔案,將動作邏輯更改為控制器。此外,我們將在整個過程中保持您的應用程式運行。過程中的每一個完成的步驟都將使您的程式碼庫完全運作並具有更高的品質。完成後,您將能夠像風一樣輕鬆地閱讀您的程式碼。您的程式碼將自動載入、依賴注入、單元測試、分層分離和前端控制。我們將添加到您的應用程式中的大部分非常有限的程式碼都是特定於本書的。我們將不斷提升自己作為程式設計師的能力,同時提高我們遺留應用程式的品質。 風格和方法 本書為開發人員提供了一個易於遵循、實用而強大的過程,將他們的應用程式提升到現代基準。本書中的每一個步驟都是實用的、獨立的,並使您更接近您所追求的最終目標:可維護的程式碼。當您按照本書中的練習進行操作時,作者幾乎能預見到您的問題,您將得到答案,可以立即在您的項目中實施。