Real-World Solutions for Developing High-Quality PHP Frameworks and Applications

電子版価格 ¥3,257
  • 電書あり
  • ポイントキャンペーン

Real-World Solutions for Developing High-Quality PHP Frameworks and Applications

  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 378 p.
  • 言語 ENG
  • 商品コード 9780470872499
  • DDC分類 005.133

Full Description


Learn to develop high-quality applications and frameworks in PHP Packed with in-depth information and step-by-step guidance, this book escorts you through the process of creating, maintaining and extending sustainable software of high quality with PHP. World-renowned PHP experts present real-world case studies for developing high-quality applications and frameworks in PHP that can easily be adapted to changing business requirements. . They offer different approaches to solving typical development and quality assurance problems that every developer needs to know and master. * Details the process for creating high-quality PHP frameworks and applications that can easily be adapted to changing business requirements * Covers the planning, execution, and automation of tests for the different layers and tiers of a Web application * Demonstrates how to establish a successful development process * Shares real-world case studies from well-known companies and their PHP experts With this book, you ll learn to develop high-quality PHP frameworks and applications that can easily be maintained with reasonable cost and effort.

Table of Contents

Foreword                                           xxi
Introduction xxiii
Part I: Foundations
Chapter 1 Software Quality 3 (12)
External Quality 4 (1)
Internal Quality 5 (1)
Technical Debt 5 (2)
Constructive Quality Assurance 7 (1)
Clean Code 8 (2)
Explicit and Minimal Dependencies 9 (1)
Clear Responsibilities 9 (1)
No Duplication 9 (1)
Short Methods with Few Execution Branches 9 (1)
Software Metrics 10 (2)
Cyclomatic Complexity and npath Complexity 10 (1)
Change Risk Anti-Patterns (CRAP) Index 11 (1)
Non-Mockable Total Recursive Cyclomatic 11 (1)
Complexity
Global Mutable State 11 (1)
Cohesion and Coupling 12 (1)
Tools 12 (2)
PHPUnit 12 (1)
phploc 12 (1)
PHP Copy-Paste-Detector (phpcpd) 12 (1)
PHP Dead Code Detector (phpdcd) 13 (1)
PHP Depend (pdepend) 13 (1)
PHP Mess Detector (phpmd) 13 (1)
PHP CodeSniffer (phpcs) 13 (1)
bytekit-cli 13 (1)
PHP CodeBrowser (phpcb) 13 (1)
CruiseControl and phpUnderControl 13 (1)
Hudson 14 (1)
Arbit 14 (1)
Conclusion 14 (1)
Chapter 2 Software Testing 15 (34)
Black Box and White Box Tests 15 (1)
How Many Tests Are Needed? 16 (1)
System Tests 17 (4)
Browser Testing 17 (1)
Automated Tests 18 (1)
Test Isolation 19 (1)
Acceptance Tests 20 (1)
Limits of System Tests 20 (1)
Unit Tests 21 (4)
Return Values 23 (1)
Dependencies 24 (1)
Side Effects 25 (1)
Real-Life Example 25 (21)
Analyzing the Code to Test 28 (1)
Setting Up a Test Environment 29 (2)
Avoid Global Dependencies 31 (1)
Test Independently from Data Sources 32 (5)
Testing Asynchronous Events 37 (4)
Storing Changes in the Database 41 (1)
Unpredictable Results 42 (2)
Encapsulating Input Data 44 (1)
Further Reflections 45 (1)
Conclusion 46 (3)
Part II: Best Practices
Chapter 3 TYPO3: The Agile Future Of A 49 (22)
Ponderous Project
Introduction 49 (3)
The History of TYPO3: Thirteen Years in 49 (2)
Thirteen Paragraphs
Daring to Start Over! 51 (1)
Our Experience with Testing 51 (1)
Policies and Techniques 52 (8)
Bittersweet Elephant Pieces 53 (1)
Test-Driven Development 53 (1)
Tests as Documentation 54 (1)
Continuous Integration 55 (1)
Clean Code 56 (1)
Refactoring 57 (1)
Programming Guidelines 58 (1)
Domain-Driven Design 59 (1)
Course of Action in Development 60 (4)
Developing New Code 60 (1)
Extending and Modifying Code 61 (1)
Optimizing Code 61 (2)
Speed 61 (2)
Readability 63 (1)
Finding and Fixing Bugs 63 (1)
Disposing of Old Code 63 (1)
Test Recipes 64 (5)
Inadvertently Functional Unit Test 64 (1)
Access to the File System 64 (1)
Constructors in Interfaces 65 (1)
Testing Abstract Classes 66 (1)
Testing Protected Methods 66 (2)
Use of Callbacks 68 (1)
Into the Future 69 (2)
Chapter 4 Unit Testing Bad Practices 71 (20)
Why Test Quality Matters 71 (1)
Bad Practices and Test Smells 72 (18)
Duplication in Test Code 73 (1)
Assertion Roulette and Eager Test 74 (2)
Fragile Test 76 (2)
Obscure Test 78 (5)
Problems with Global State 78 (2)
Indirect Testing 80 (2)
Obscure Test Names 82 (1)
Lying Test 83 (1)
Slow Test 84 (1)
Conditional Logic in Tests 85 (2)
Self-validating Tests 87 (1)
Web-surfing Tests 87 (1)
Mock Overkill 88 (2)
Skip Epidemic 90 (1)
Conclusion 90 (1)
Chapter 5 Quality Assurance At Digg Inc 91 (24)
Problems We Are Facing 91 (4)
Legacy Code Base 92 (1)
How Do We Solve These Problems? 93 (2)
Size Does Matter 93 (1)
Team Size 94 (1)
Project Size 94 (1)
Code Size 94 (1)
Unit Testing and You 94 (1)
Choosing a Testing Framework 95 (1)
Working with an Expert 95 (3)
One Week in a Room 95 (1)
Training Our Team 95 (3)
Writing Testable Code 98 (2)
Avoid Static Methods 98 (2)
Dependency Injection 100 (1)
Mock Objects 100 (7)
Overview 100 (1)
Database 101 (1)
Loosely Coupled Dependencies 101 (1)
Subject/Observer for Testing Class 102 (1)
Internals
Memcached 103 (1)
Mocking a Service-Oriented Architecture 104 (3)
Model 104 (1)
Service Query 105 (1)
Service Endpoint 105 (1)
The Base Classes 105 (2)
Digg's Quality Assurance Process 107 (4)
Testing 108 (1)
Planning the Testing Effort 108 (1)
Tasks 108 (1)
Automation 108 (1)
Benefits 109 (9)
Testing Early 109 (1)
Testing Often 109 (1)
Challenges 110 (1)
Conclusion 111 (4)
Part III: Servers and Services
Chapter 6 Testing Service-Oriented APIS 115 (16)
The Problems 117 (1)
Solutions 118 (12)
API Credentials 118 (3)
API Limits 121 (1)
Offline Testing of Service Protocols 122 (4)
Offline Testing of Concrete Services 126 (4)
Conclusion 130 (1)
Chapter 7 Testing A Webdav Server 131 (22)
About the eZ WebDAV Component 131 (4)
WebDAV 131 (2)
Architecture 133 (2)
Development Challenges 135 (4)
Requirements Analysis 135 (1)
TDD after RFC 136 (1)
Testing a Server 137 (2)
Automated Acceptance Tests with PHPUnit 139 (10)
Capturing Test Trails 140 (1)
Test Recipe 141 (1)
Integration into PHPUnit 142 (12)
A Custom Test Case 142 (4)
The Acceptance Test Suite 146 (1)
Acceptance Tests by Example 147 (2)
Conclusion 149 (4)
Part IV: Architecture
Chapter 8 Testing Symfony And Symfony Projects 153 (18)
Testing a Framework 154 (7)
The symfony Release Management Process 154 (1)
Long-term Support 154 (1)
Code Coverage 155 (1)
Tests versus Real Code 155 (1)
Running the Test Suite 156 (1)
Main Lessons Learned 156 (5)
Never Use the Singleton Design Pattern 156 (2)
in PHP
Decouple Your Code with Dependency 158 (1)
Injection
Lower the Number of Dependencies 159 (2)
between Objects with an Event Dispatcher
Testing Web Applications 161 (9)
Lowering the Barrier of Entry of Testing 161 (1)
Unit Tests 162 (3)
Easy to Install 162 (1)
Easy to Learn 163 (2)
Fun to Use 165 (1)
Functional Tests 165 (7)
The Browser Simulator 166 (2)
The Fixtures 168 (1)
The CSS3 Selectors 168 (1)
Testing Forms 169 (1)
Debugging 169 (1)
Conclusion 170 (1)
Chapter 9 Testing The EZCgraph Component 171 (16)
Development Philosophy 172 (1)
Graph Component 172 (3)
Architecture 173 (1)
Test Requirements 174 (1)
Driver Mocking 175 (4)
Mock the Driver 175 (1)
Multiple Assertions 176 (1)
Structs 177 (1)
Expectation Generation 178 (1)
Conclusion 178 (1)
Testing Binary Data 179 (6)
The Drivers 179 (1)
Expectation Generation 179 (1)
SVG 180 (1)
XML Comparison 180 (1)
Floating-point Problems 181 (1)
Bitmap Creation 181 (2)
Bitmap Comparison 182 (1)
GD Version Differences 183 (1)
Flash 183 (8)
The Assertion 184 (1)
Conclusion 185 (2)
Chapter 10 Testing Database Interaction 187 (38)
Introduction 187 (1)
Reasons Not to Write Database Tests 188 (1)
Why We Should Write Database Tests 189 (1)
What We Should Test 190 (1)
Writing Tests: Mocking Database Connections 191 (1)
Writing Tests: PHPUnit Database Extension 191 (29)
The Database Test Case Class 192 (1)
Establishing the Test Database Connection 193 (3)
Creating Data Sets 196 (13)
XML Data Sets 197 (2)
Flat XML Data Sets 199 (1)
CSV Data Sets 200 (1)
YAML Data Sets 201 (2)
Database Data Sets 203 (1)
Data Set Decorators 204 (5)
Generating Data Sets 209 (1)
Data Operations 209 (2)
Creating Tests 211 (7)
Testing the Loading of Data 211 (4)
Testing the Modification of Data 215 (3)
Using the Database Tester 218 (2)
Applying Test-Driven Design to Database 220 (1)
Testing
Using Database Tests for Regression Testing 220 (2)
Testing Problems with Data 221 (1)
Testing Problems Revealed by Data 222 (1)
Conclusion 222 (3)
Part V: Q&A In The Large
Chapter 11 Quality Assurance At studiVZ 225 (24)
Introduction 225 (2)
About studiVZ 226 (1)
Acceptance Tests 227 (1)
Acceptance Tests in Agile Environments 227 (1)
Selenium 228 (2)
The Selenium Extension of PHPUnit 229 (1)
The Technical Setup of studiVZ 230 (2)
Development Environment 230 (1)
Test Environment 231 (1)
Best Practices 232 (10)
Sins of Our Youth 232 (2)
Monolithic Tests 232 (1)
Static Users 233 (1)
Strategy Change 234 (8)
Atomic Tests with Dynamic Test Data 234 (1)
Robust Selenium Tests 235 (1)
Test Scope Must Be Clear 235 (1)
Common Functionality or Browser 236 (1)
Compatibility as Well?
Fix Tests Right Away! 236 (1)
Stabilize Locators, and Use IDs 237 (1)
Speed, the Sore Subject 238 (1)
Recipes for Last-Minute Features 239 (1)
Tests Are Software Too 240 (1)
Capture and Replay versus Programming 240 (2)
Tests
The Team: A Good Mix 242 (1)
We Need a DSL 242 (4)
Internal DSL 243 (1)
Testing_SeleniumDSL 1.0 243 (2)
Problem: Context Sensitivity 245 (1)
Testing_SeleniumDSL 2.0, A Draft 245 (1)
State and Outlook on Version 2.0 246 (1)
Conclusion 246 (3)
Chapter 12 Continuous Integration 249 (32)
Introduction 249 (14)
Continuous Integration 251 (2)
Configuration 251 (1)
Build Management and Automated Tests 251 (1)
Version Management 252 (1)
Continuous Integration 252 (1)
Static Analysis 253 (11)
Code Clones 253 (1)
Refactoring 253 (1)
Software Metrics 254 (1)
Classic Metrics 255 (4)
Object-Oriented Metrics 259 (3)
RATS 262 (1)
Installation 263 (1)
Configuration 264 (11)
Static Tests 266 (6)
Programming Conventions 266 (2)
Coding Guidelines 268 (1)
Gradual Introduction into Legacy 269 (1)
Projects
Coding Standards in the Daily Work 270 (1)
Syntax Analysis 271 (1)
Dynamic Tests 272 (1)
Reporting 272 (2)
Notification in the Case of Errors 272 (1)
Statistics 272 (1)
PHP CodeBrowser 273 (1)
Deliverables 274 (1)
Operations 275 (1)
Advanced Topics 276 (2)
Continuous Deployment 276 (1)
Using a Reverse Proxy 277 (1)
Continuous Integration and Agile Paradigms 278 (1)
Conclusion 278 (3)
Chapter 13 Swoodoo: A True Agile Story 281 (20)
Introduction 281 (1)
Evolution: Only the Strong Survive 282 (6)
How We Reached the eXtreme Side 285 (3)
And While We Are Working 288 (4)
The Art of Evolution 292 (6)
Lack of Experience 293 (1)
The Java-developer-coding-in-PHP 294 (2)
Phenomenon
The Nobody-but-me-understands-my-code 296 (2)
Developer
Conclusion 298 (3)
Part VI: Non-Functional Aspects
Chapter 14 Usability 301 (16)
Anything Goes, But What Is the Price? 303 (1)
Design Aspects 304 (4)
Accessibility 304 (1)
Readability 304 (1)
Labels for Form Elements 305 (1)
Navigating by Keyboard 305 (1)
Effective Contrast 306 (1)
Logo Links to Home Page 307 (1)
Alternative Texts for Images 307 (1)
Background Image in Background Color 307 (1)
Usable Print Version 307 (1)
Visible Links 307 (1)
Good Bookmarks 307 (1)
No Frames 308 (1)
Scalable Fonts 308 (1)
Technical Aspects 308 (2)
Performance 308 (2)
Semantic Code 309 (1)
Fewer Requests 309 (1)
CSS Sprites 309 (1)
JavaScript on Bottom, CSS on Top 310 (1)
Link CSS Instead of Importing 310 (1)
JavaScript 310 (1)
User Guidance 310 (3)
The "Fold" Myth 311 (1)
Feedback on Interaction 311 (1)
Navigation 312 (1)
Pop-ups and Other Annoyances 312 (1)
Habits and Expectations 313 (1)
Fault Tolerance and Feedback 313 (1)
Testing Usability 313 (2)
Conclusion 315 (2)
Chapter 15 Performance Testing 317 (24)
Introduction 317 (3)
Tools 318 (1)
Environmental Considerations 319 (1)
Load Testing 320 (4)
Apache Bench 321 (1)
Pylot 322 (2)
Other Load Testing Tools 324 (1)
Profiling 324 (10)
Callgrind 325 (3)
KCachegrind 328 (1)
APD 329 (1)
Xdebug 330 (1)
XHProf 331 (2)
OProfile 333 (1)
System Metrics 334 (4)
strace 334 (1)
Sysstat 335 (2)
Custom Instrumentation 337 (1)
Common Pitfalls 338 (2)
Development versus Production Environments 338 (1)
CPU Time 338 (1)
Micro-Optimizations 338 (1)
PHP as the Glue 339 (1)
Priority of Optimization 339 (1)
Conclusion 340 (1)
Chapter 16 Security 341 (16)
What Is Security? 341 (1)
Secure by Design 342 (4)
Operations 342 (1)
Physical Access 343 (1)
Software Development 344 (1)
No Security by Obscurity 344 (1)
Separation of Concerns 344 (1)
A Matter of Rights 345 (1)
Error Handling 345 (1)
Basic Settings 346 (1)
What Does Security Cost? 346 (1)
The Most Common Problems 347 (8)
A10 Unvalidated Redirects and Forwards 347 (1)
A9 Insufficient Transport Layer Protection 348 (1)
A8 Failure to Restrict URL Access 349 (1)
A7 Insecure Cryptographic Storage 349 (1)
A6 Security Misconfiguration 350 (1)
A5 Cross Site Request Forgery (CSRF/XSRF) 351 (1)
A4 Insecure Direct Object References 351 (1)
A3 Broken Authentication and Session 352 (1)
Management
A2 Cross-Site Scripting (XSS) 353 (1)
A1 Injection 354 (1)
Conclusion 355 (2)
Chapter 17 Conclusion 357 (2)
Bibliography 359 (6)
Index 365