DMXzone Summer Sale: Save up to 51% with code DMXSUMMER26. Ends in

How to Write Testable and Maintainable Code in PHP

Begin structuring your code to achieve testability and maintainability

Frameworks provide a tool for rapid application development, but often accrue technical debt as rapidly as they allow you to create functionality. Technical debt is created when maintainability isn't a purposeful focus of the developer. Future changes and debugging become costly, due to a lack of unit testing and structure. Here's how to begin structuring your code to achieve testability and maintainability – and save you time.

 

We'll Cover (loosely)

  • DRY
  • Dependency Injection
  • Interfaces
  • Containers
  • Unit Tests with PHPUnit

Let's begin with some contrived, but typical code. This might be a model class in any given framework.

Comments

Be the first to write a comment

You must me logged in to write a comment.