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

Ben Ramsey:
The Era of PHP Testing
Nov 22, 2012 @ 16:24:16

Ben Ramsey has a new post to his site where he reviews the "eras" of PHP that it's gone through in the past few years and ends up with what he calls the "Era of Testing" - the recent strong push that's being made to promote and encourage unit testing in PHP applications.

Over the past decade, the PHP community has progressed through a handful of distinct eras that have each been marked by a focus on specific best practices. This is most evident in the types of talks presented at conferences and user groups and in the articles published by php|architect magazine, PHPDeveloper.org, and the blogs of those whose feeds are distributed through Planet PHP. In thinking through this, I’ve come up with the following eras I think we, the PHP community, have had over the last ten years. These are in a general order, but eras overlap, and some have lasted longer than others, so there’s not a distinct beginning or end to each.

He briefly covers five different areas that PHP has evolved in over the past years: the shift to OOP, web application security, framework use, coding standards/organization and the push for better testing.

With the coming of the testing era, I’m seeing a lot of maturity in our community. The code we write is getting better. We’re following standards and best practices. We’re implementing a lot of good design principles. [...] I think the decade since PHP 5 was released has brought us to a great place as a community. [...] With each new era, we can’t forget what we’ve learned, though. We must continue teaching and revising these best practices as we learn more.
tagged: testing era language evolution phase topics community

Link:

Derick Rethans' Blog:
PHP's two-pass compiler
Jan 28, 2009 @ 18:06:34

While working on an issue with debugging a script of his via XDebug, Derick Rethans was reminded of something that is an integral part of the PHP language - its two phase compiler.

During the first pass, it will find out to which opcode it needs to jump in the jump instructions. However, the PHP engine (and Xdebug) expects a memory address to jump to while executing your script. In the second pass, the compiler will then go over the generated opcodes and calculate the memory address to jump to from the jumps to opcode numbers.

Because of the way that XDebug was handling the checks (with the user-defined error handler) and how the opcodes inside of PHP are handled, the user-defined handler happened in between the first and second phases and the latter run couldn't find the resources it was looking for, thus the crash.

tagged: two phase compiler xdebux vld userdefined error handler opcode resource

Link:

Alan Knowles' Blog:
Code Reviewing.
Aug 21, 2006 @ 12:56:39

In a great new post from Alan Knowles he takes a look at code reviewing, specificaly in a PHP environment.

He breaks the post up into phases (one through four) with the steps outlined along the way (including the "oh sh*t, it's getting urgent, we better fix the delivered code and make it work well enough for the client to start testing" phase). Phase four is the largest, being the bug finding and fixing stage, some of the more intensive (and sometimes numbing) times of development.

He also includes a good, long list of some of the codeing standards he's accumulated over time, including:

  • Not creating PHP includes with functions in them!
  • Never hard code email subjects etc. in code, use templates.
  • Not using libraries that where not specified.. or using non-PEAR libraries when PEAR ones are available...
  • Everything extends the base class, even code run via cron jobs.

He also talks about using print rather than echo, exiting on XMLHttpRequest calls, shortcuts in Javascript, and cloning dataobject arrays over creating simple structs.

tagged: review phase coding standards list mistakes review phase coding standards list mistakes

Link:

Alan Knowles' Blog:
Code Reviewing.
Aug 21, 2006 @ 12:56:39

In a great new post from Alan Knowles he takes a look at code reviewing, specificaly in a PHP environment.

He breaks the post up into phases (one through four) with the steps outlined along the way (including the "oh sh*t, it's getting urgent, we better fix the delivered code and make it work well enough for the client to start testing" phase). Phase four is the largest, being the bug finding and fixing stage, some of the more intensive (and sometimes numbing) times of development.

He also includes a good, long list of some of the codeing standards he's accumulated over time, including:

  • Not creating PHP includes with functions in them!
  • Never hard code email subjects etc. in code, use templates.
  • Not using libraries that where not specified.. or using non-PEAR libraries when PEAR ones are available...
  • Everything extends the base class, even code run via cron jobs.

He also talks about using print rather than echo, exiting on XMLHttpRequest calls, shortcuts in Javascript, and cloning dataobject arrays over creating simple structs.

tagged: review phase coding standards list mistakes review phase coding standards list mistakes

Link:


Trending Topics: