PHPLondon
I had a great time at the PHPLondon meeting. The meeting was held in the lounge above a English pub named “The Hope”. I was met at my hotel by Marcus Baker and Perrick Penet, and on the way we had a nice walk through London with a brief stop in another pub for a pint and a dinner of fish and chips. Here is a picture of me, Marcus and Perrick at the venue for PHPLondon.
As soon as I volunteered that I might be able to attend the meeting, Marcus slotted me for a presentation. This worked out well, because after the PHP|Tek conference this past April, he had given me some pointers on a very good restructuring to my Test Driven Development talk. My original talk started with an intruction to testing, an overview of SimpleTest, an outline of test driven development, and culminated with a live demo where the audience selected the subject and we used TDD to arrive at a solution. I had structured the talk that way so that all of my information had already been imparted should the live demo fail miserably. Marcus pointed out that for someone who had not already been doing these techniques, the benefits of using TDD seem to vague and abstract, by moving the live TDD demo up into an earlier portion of the presentation, even someone who has never written a unit test would at least have a passing familiarity now, and the benefits described would thus be more tangible. This is clear evidence of Marcus’ teaching background seeping through, and was very good advise. For this talk, I organized it as: a brief intro to testing and SimpleTest, and a brief outline of TDD, then jumping into the TDD live session. After a few iterations of red-green-refactor, we hopped back to the presentation and had some very good dialog.
For the live demo, I started with this bootstrap file:
<?php
< ?php
error_reporting(E_ALL);
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once 'simpletest/mock_objects.php';
class PhpLondonTestDrivenDevelopmentTestCase extends UnitTestCase {}
$test = new PhpLondonTestCase;
if (TextReporter::inCli()) {
require_once 'simpletest/ui/colortext_reporter.php';
exit ($test->run(new ColorTextReporter()) ? 0 : 1);
}
$test->run(new HtmlReporter());
?>
The audiance selected an object whose job was to calculated information regarding an annual salary. Over several iterations we built up this test case.
<?php
class PhpLondonTestCase extends UnitTestCase {
function testSalaryCalcExists() {
$this->assertTrue(class_exists('SalaryCalc'));
}
function testGetDaily() {
$sal = new SalaryCalc(41400);
$this->assertTrue(method_exists($sal,'getDaily'));
$this->assertEqual(180, $sal->getDaily());
$sal2 = new SalaryCalc(82800);
$this->assertEqual(360, $sal2->getDaily());
}
function testNegativeSalaryThrowsException() {
$this->expectException();
$sal = new SalaryCalc(-41400);
}
}
?>
which resulted in this code
<?php
class SalaryCalc {
protected $sal;
function __construct($sal) {
if ($sal < = 0) {
throw new Exception('Nobody works for free');
}
$this->sal = $sal;
}
function getDaily() {
return $this->sal/46/5;
}
}
?>
The entire power point presentation can be downloaded here.
Perrick followed up with a talk on using Agile development methodologies with PHP, less TDD which had already been covered ;). His talk generated a lot of lively discussion as well.
The facilities worked out well, the room was packed, and we had a very nice projector and screen. I was able to use the laser pointer/usb remote slide clicker given to me as a present for being a speaker at PHP|Tek this year.
After the presentations were over, we all enjoyed a few pints, many thanks to those attendees who choose to buy me a pint afterwards, I am very greatful. A few attendees were able to find out some personal details about me (and I think I broke a few sterotypes about typical American beer drinkers, though I by no means consider myself typical in these respects 😉 ). One attendee managed to talk me out of the only copy of my book I had with me, so he now has a signed copy :).
One thing an American should be prepared for in London is a lot of walking! Bring a decent pair of walking shoes, because if they are not good, you might have what happend to me affect you. The first thing is I have sore feet, and some good sized proto-blisters brewing. The second is I walk the soles off of my shoes…literally. I saw they were starting to split at the hotel, but I figured they would last the trip home where I could throw away my shoes. By half way through my flight back to Chicago from London, it became apearant the sole would fall off if I did not do something. I asked the stewardess if they had any tape, and somehow they managed to come up with a role of masking tape. I attempted the hidden repair by making loops of sticky tape and putting them between the sole and the bottome of the shoe, but it was obvious this was not going to work. I then bit the bullet and wrapped the tape around the outside of the shoes to hold the sole on until I could get to my bag and change into an alternate pair I had brought with me. If you don’t believe it, here is the proof, shot on the airplane shortly after the repair.
Speaking of the flight, I had a very nice gentleman next to me from Dice, a company specializing in matching qualified technical candidates with technical jobs. It was very interesting to contrast our different companies, a giant industrial manufacturer vs. an internet company, yet we had quite a number of similarities: use of PHP and the LAMP stack, use of Oracle databases, use of Siebel for a Customer Relationship Management system, and both of our companies use other open source solutions where they are beneficial. If anyone is on the job hunt for technical jobs, it is probably worth using Dice as a good starting point.
Sounds fun.
Hi Jason,
Was good speaking to you, however we never did manage to get that minimum wage exception. Anyway it was a great little presentation and look forward to seeing more…
Thanks
Andy
I clicked on “the only copy of my book I had with me” link, but it’s dead.
Thanks Joha, the correct link is http://phparch.com/books/isbn/0973589825