Surprising PHP


We’ve recently made the decision with the product I’m working on that in addition to everything working with the Cloud, it now also has to work On-Premise.
This instigated a quick proof of concept, which our architect put together using a PHP driven Web Api. This was an unusual choice for a Microsoft house and the ramifications for the long-term of this code are yet to be realised.
After a first look at the code, I was disheartened to discover that it appeared to be a procedural language. Having left that technology behind about 20 years ago I was not looking forward to writing something more than a simple configuration script in PHP.
However, instead of completely poo-pooing the language, I started a bit of Googling.
The first thing I was happily surprised about is that PHP is actually fully object oriented, supporting interfaces and abstract classes, no built in dependency injection (a la AngularJS) but wow … great … I can write SOLID style code.
I’m also heavily biased towards writing code in a TDD style. I’m convinced this is the right way to work in the software industry. Why spend time writing and guarding stuff you don’t need to?
That means I need unit testing and mocking … enter PHPUnit and PHPMock … fantastic … full speed ahead!
There are dependency injection libraries (PHP-DI, Pimple …) … some seem to rely on special tags in comments … or building dependencies from xml files … eek … which feels a bit of a hack and from a compiled language background a bit scary … I’ve already spent a few hours tracking down variables that don’t have values and trying to find out why … only to discover that the ability to invent variables on a whim results in no interpretation errors for randomly named variables or missing $this-> … and obstinate null values at execution time.
However … just reading through the examples on Pimple … that looks like exactly what I need … cool … my toolbag is bulging with shiny sharp new tools … now where’s that procedural code … I just need a decent development environment … enter Eclipse stage left … excellent …


Digital Employee Experience (DEX) in the Enterprise: Progress, Patterns, and Gaps

DEX Report