-
出版商:
Packt Publishing
-
出版日期:
2016-08-31
-
售價:
$1,860
-
貴賓價:
9.5 折
$1,767
-
語言:
英文
-
頁數:
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,就可以開始改變您維護和部署程式碼的方式!
您將學到什麼
* 用依賴注入替換 global 和 new
* 將 SQL 語句提取到網關
* 將行為邏輯轉換為控制器
* 移除頁面腳本中的重複邏輯
* 從雜亂的舊有 PHP 中創建可維護的 PHP 程式碼
詳細內容
您是否注意到您的舊有 PHP 應用程式由直接放置在網頁伺服器的文件根目錄中的頁面腳本組成?或者,您的頁面腳本以及其他類別和函數是否將模型、視圖和控制器的關注點混合在同一範疇中?大多數邏輯流程是否作為包含文件和全域函數而非類別方法來整合?與這樣的舊有應用程式合作感覺就像在泥中拖著腳步,不是嗎?本書將向您展示如何在實踐和技術上現代化您的應用程式,而不是僅僅使用像框架和庫這樣的工具,通過提取和替換其舊有工件。我們將採用逐步的方法,緩慢而有條理地改善您的應用程式。我們將向您展示如何用依賴注入替換 new 和全域依賴。我們還將展示如何將呈現邏輯更改為視圖文件,並將行為邏輯更改為控制器。此外,我們將在整個過程中保持您的應用程式運行。每完成一步,您的程式碼庫將保持完全運行,並提高質量。當我們完成時,您將能夠像風一樣輕鬆地瀏覽您的程式碼。您的程式碼將自動加載、依賴注入、單元測試、層分離和前端控制。我們將添加到您的應用程式中的大部分非常有限的程式碼都是特定於本書的。我們將在提升自己作為程式設計師的同時,改善我們舊有應用程式的質量。
風格與方法
本書為開發者提供了一個易於遵循、實用且強大的過程,以使他們的應用程式達到現代基準。本書中的每一步都是實用的、自足的,並使您更接近您所追求的最終目標:可維護的程式碼。在您遵循本書中的練習時,作者幾乎預見了您的問題,您將擁有答案,隨時可以在您的專案中實施。