Dusted Codes

Programming adventures

PHP UK Conference 2015

Last week was my first time at the PHP UK Conference in London. As a .NET developer who is very new to the PHP community I didn't have any particular expectations, but I think this year was a great time to be there!

The Venue

PHP UK Conference 2015 - The VenuePHP UK Conference 2015 - Open Bar

The conference took place on Thursday and Friday (apparently for the first time, because in previous years it was Friday and Saturday) at The Brewery, which is a great venue at a very central location in the city of London.

Also worth noting is that this year was the 10th anniversary of the event with a record high of more than 700 attendees coming from many different countries around the world. The hosting was excellent, food and drinks were available throughout the entire day and in the evenings they had many hundreds of free beer up for grab to celebrate this occasion.

As if this was not enough, the organisers even rented out the All Star Lanes in Brick lane to continue the celebration with some free bowling, free karaoke, more beer, more food and a cake on Thursday night.

I have to admit that due to a light cold I didn't make the most out of it, but I still had a fantastic time!

The Tracks

PHP UK Conference 2015 - Closing KeynotePHP UK Conference 2015 - Opening Keynote

Both days started off with two great key notes. The first keynote was by coderabbi, who walked us through some of his own experiences, spoke about code reviews and peer coding and eventually spread his wisdom over a packed room.

On Friday Jenny Wong, a developer and (according to her own words) a "community junkie" kicked off the second day with a very light hearted and extremely inspirational speech about bringing developer communities together.

Integrating Communities

The message which I took away is, that it doesn't matter who you are, which technology you use or how experienced you are. We are all connected through the same passion which brought us together - the passion for coding. Sadly we are in an industry where people burn out every day. Rather than belittling and laughing at other developers (even if it is a Wordpress developer :)) we should help each other and help this community to grow and not shrink.

Definitely one of the sessions which got stuck most with me!

Some other sessions which I really enjoyed were "Composer Best Practices", "Application Logging & Logstash", "Modern Software Architectures" and "HHVM at Etsy".

They were perhaps not the most technically advanced sessions, but they all had a great speaker, who was able to present something interesting from a personal experience and give some insights on the topic which were beyond the usual literature which you'll find in books or on the internet.

I won't rehash all of them in this blog post, but I picked a few where I wanted to share some interesting take aways!

Versioning

In the session about Composer best practices Jordi Boggiano started off by explaining the meaning and importance of semantic versioning.

We all know what a build number looks like. It consists at least of three numbers, separated by a dot, where the parts usually stand for the major number, the minor number and a patch or sometimes referred to as the build number.

e.g.: {major}.{minor}.{patch}

What semantic versioning does is to give a clearly defined meaning to each of these numbers with the aim to ease the upgrade and migration pain when developers use 3rd party code libraries.

In a nutshell, major stands for compatibility breaks (even the smallest!), minor stands for new features (without affecting other features) and patch denotes bug fixes (for existing features). Sounds simple, but this convention really makes a difference when you are dealing with someone else's code and you want to understand the implications of a NuGet package update or similar.

It definitely changed my view on versioning artifacts and if this was new to you as well, then I hope it makes as much sense to you as it did to me :).

HHVM and PHP 7

The other talk I wanted to quickly share with you was HHVM at Etsy by Dan Miller.

For those who don't know what HHVM is, it is a virtual machine which compiles PHP code down into native C++ for better performance. HHVM is written by Facebook in Hack and PHP, and Hack itself is written by Facebook as well.

HHVM stands for HipHop Virtual Machine and is a replacement for the initial HipHop compiler. The major difference is that HHVM is a just-in-time compiler, while HipHop wasn't.

Why a just-in-time compiler for PHP?

Now you probably ask yourself why did Facebook prefer a just-in-time compiler over the other? While there are lots of reasons for it, one of the perhaps minor, but interesting ones was the difficulty to introduce HipHop into the existing development culture. PHP developers are used to drop in replace a file on a server and know that the changes have taken immediate effect. Now with a compilation step in between this was not possible anymore and was a rather huge shift among engineers. A just-in-time compiler on the other hand allowed developers to continue their work flow as they were used to.

HHVM points of interest

Another few interesting things I have learned:

  • Facebook claims that HHVM increases the throughput between 3 to 6 times. These benchmarks were taken with a much older PHP version though and Etsy's experience was more towards 3x in comparison with PHP 5.
  • HHVM is used by other big companies like Wikipedia and Baido as well.
  • HHVM is extremely solid. Etsy had no issues with HHVM whatsoever and did not encounter any bugs, even though their entire code base is in PHP and they expected at least some weird PHP constraints causing errors - but to their pleasant surprise, they didn't.
  • BUT, they found many issues with 3rd party modules for HHVM. They had to fix some pretty major bugs for the Memcached and MySQL modules to get them running.
  • If a HHVM module is not yet in use by another big company, then expect to invest a fair amount of time for bug fixing.
  • Facebook seems to be very enganged with the project. There were stories told at the conference where people reported a bug and it has been fixed only a few hours later over night. This is kind of cool stuff and music in a developer's ear :)!
  • HHVM offers a variety of other extremely useful features like:
    • HHVM Debugger
      Allows you to set conditional break points, e.g.: only hit the break point for useid=123.
    • sgrep
      Great tool for static code analysis which offers a simpler syntax than conventional regex.
      e.g.: sgrep -e 'X && X' will return all the code lines where the left- and right hand statement of a logical AND operator is the same.
    • spatch
      Great tool for refactoring your code.
      Good PHP IDEs will offer you refactoring tools as well, but they all rely on text search and replace, why they won't give you 100% confidence that all changes have been made properly in your entire code base.
      e.g.: Remove 2nd argument from a method, etc.
  • And last but not least: Some early performance benchmarks between HHVM and PHP 7 showed that PHP 7 gets very close to HHVM. In one benchmark it even outperformed HHVM, but they didn't dived too much into the details and the quality of these figures, so please don't pin this on the wall yet.

Summary

All in all the PHP UK conference was an amazing event and I am glad I had the opportunity to be part of it! Will I go next year again? It is definitely on my list! Hopefully I will see you next year PHP folks!