Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Scott Keck-Warren:
Making dataProviders More Maintainable
Sep 30, 2015 @ 14:44:18

Scott Keck-Warren has a quick post to his site sharing a method for keeping data providers maintainable in your unit tests. Data providers are a quick way to retest the same logic with several different types of data and not have an individual test for each.

I’m a big fan of using PHPUnit’s data providers feature because it allows you to easily run a lot of data through the same kinds of tests over and over again without having a bunch of duplicate code sitting around. But they aren’t always the easiest thing to come back to an understand.

He briefly introduces how data providers are used in PHPUnit testing, including a brief code example. The errors that can come up with this common setup can be cryptic to debug. He recommends a slight alteration to the data provider return structure to use an associative array instead of a single-level array. This way, if there's an error the resulting message refers to the index, not just a number making a bit more sense and aids in debugging.

tagged: dataprovider maintainable phpunit tip associative array

Link: http://www.thisprogrammingthing.com/2015/making-dataproviders-more-maintainable/

SitePoint PHP Blog:
Flexible and Easily Maintainable Laravel + Angular Material Apps
Sep 29, 2015 @ 16:58:19

The SitePoint PHP blog has a tutorial posted showing you how to combine Laravel and AngularJS to create flexible and easily maintainable applications on both the frontend and backend of the app. He also covers a topic he says other tutorials leave out: scaling.

In this article, we’re going to set up a Laravel API with Angular Material for the front end. We’re also going to follow best practices that will help us scale with the number of developers working on the project and the complexity behind it. Most tutorials cover this topic from another perspective – they completely forget about scaling. While this tutorial is not targeted at small todo apps, it is extremely helpful if you’re planning to work with other developers on a big project.

He includes a link to the final product in action and spends the rest of the tutorial walking you through it's construction. First he sets up the Laravel application, also installing the debug bar for easier debugging. He installs gulp, bower and the "laravel-elixir-angular" package to make creating the AngularJS frontend simpler. He shows how to create the folders for the Angular application and the creation of the gulpfile.js configuration to build out the app. He uses bower to install the latest Angular, builds out the main module and connections the frontend to the backend.

From there he starts building out the actual application that outputs some basic content, generated by Angular. He hooks in some other pieces of functionality and libraries including: ui-router, Restangular, Toast and the use of dialogs. He ends with a look at deploying the application and maintaining code quality via jshint, phpcs and JSCS.

tagged: laravel application angularjs tutorial maintainable application library elixir npm gulp bower

Link: http://www.sitepoint.com/flexible-and-easily-maintainable-laravel-angular-material-apps/

NetTuts.com:
How to Write Testable and Maintainable Code in PHP
May 16, 2013 @ 16:53:18

NetTuts.com has a new tutorial posted suggesting a few ways you can make testable and maintainable code in PHP applications.

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.

There's a few concepts they cover in the tutorial including DRY (don't repeat yourself), working with dependency injection and actually writing the tests with PHPUnit. They start with a bit of code that needs some work and use the tests to help refactor it into something that can be easily mocked (using Mockery).

tagged: testable maintainable code tutorial bestpractice mock object

Link: http://net.tutsplus.com/tutorials/php/how-to-write-testable-and-maintainable-code-in-php

PHPBuilder.com:
PHP Dependency Injection Creates More Maintainable Code
May 02, 2011 @ 14:52:05

On PHPBuilder.com Jason Gilmore has posted a new article looking at the benefits of dependency injection in helping you keep your code more maintainable and well-structured.

Of course, the advantages of object-orientation can only be fully exploited when implemented in conjunction with best practices such as encapsulation and inheritance. One such "implementational" best practice is dependency injection, a design pattern that facilitates the decoupling of otherwise dependent components. [...] Save yourself the trouble and decouple components using dependency injection.

He gives an example of how a simple dependency injection (DI) method on an "Account" class to take the database connection dependency out of the actual class and into an encapsulated object. This way, any sort of standardized database object can be passed in and acted upon. He also mentions two dependency injection containers you could use to help you implement it - Symfony's and Pimple.

tagged: maintainable code dependency injection tutorial

Link:

Maintainable Software Seeks PHP Developer (Telecommute)
Apr 06, 2007 @ 12:10:43

Company Maintainable Software
Location Telecommute
Title PHP Developer
Summary

Qualifications:

  • Strong understanding of XHTML, CSS, and standards-based design
  • Object Oriented Programming experience and familiarity with testing
  • Knowledge of key differences between PHP 4 and 5
  • Some experience with XML and web services
  • Familiarity with MySQL and be able to write SQL queries
  • Understanding of source control including branching and tagging
  • Working knowledge of the UNIX shell and configuring Apache with PHP
  • Strong work ethnic, be a team player, and have excellent reference

Link More Information
tagged: job post maintainable software telecommute developer job post maintainable software telecommute developer

Link:

Maintainable Software Seeks PHP Developer (Telecommute)
Apr 06, 2007 @ 12:10:43

Company Maintainable Software
Location Telecommute
Title PHP Developer
Summary

Qualifications:

  • Strong understanding of XHTML, CSS, and standards-based design
  • Object Oriented Programming experience and familiarity with testing
  • Knowledge of key differences between PHP 4 and 5
  • Some experience with XML and web services
  • Familiarity with MySQL and be able to write SQL queries
  • Understanding of source control including branching and tagging
  • Working knowledge of the UNIX shell and configuring Apache with PHP
  • Strong work ethnic, be a team player, and have excellent reference

Link More Information
tagged: job post maintainable software telecommute developer job post maintainable software telecommute developer

Link:

Laura Thomson's Blog:
NYPHP Conference 2006 ("Writing Maintainable Code")
May 26, 2006 @ 10:58:54

Laura Thomson has a brief mention on her blog today about the talk she'll be giivng at this year's New York PHP Conference concerning "Writing Maintainable Code".

I think of it as an anti-The-Daily-WTF talk, and it should be more entertaining than it perhaps sounds. (If you've never read the WTF, I strongly recommend it both for entertainment and enlightenment.) I believe in terse, elegant code that gets the job done, which perhaps reflects my origins as a C programmer rather than as a Java one.

You can get complete details on her talk and on the conference from the official New York PHP Conference website, including saving your place at the conference by registering.

tagged: nyew york conference talk laura thomson maintainable nyew york conference talk laura thomson maintainable

Link:

Laura Thomson's Blog:
NYPHP Conference 2006 ("Writing Maintainable Code")
May 26, 2006 @ 10:58:54

Laura Thomson has a brief mention on her blog today about the talk she'll be giivng at this year's New York PHP Conference concerning "Writing Maintainable Code".

I think of it as an anti-The-Daily-WTF talk, and it should be more entertaining than it perhaps sounds. (If you've never read the WTF, I strongly recommend it both for entertainment and enlightenment.) I believe in terse, elegant code that gets the job done, which perhaps reflects my origins as a C programmer rather than as a Java one.

You can get complete details on her talk and on the conference from the official New York PHP Conference website, including saving your place at the conference by registering.

tagged: nyew york conference talk laura thomson maintainable nyew york conference talk laura thomson maintainable

Link:


Trending Topics: