My first (formal) blog post

Hypothesis: PHP literature and community do a disservice to the platform’s potential and the perception of it.

exiquio
4 min readApr 28, 2014

Once upon a time I was a true novice to web application development and, like many of us, I started to learn the trade by applying code with PHP prior to the explosion of web application frameworks. Coming from a (so-called) non-traditional background, I would purchase the giant tomes on PHP from all the usual publishers hoping to get a grip on things. The books taught me how to build things and for that I’m thankful, but…

Later upon a time I became a bit more seasoned in my profession and I broadened my horizon by embracing other technologies ranging from Python and web frameworks like Django and Pylons (dating myself?), JSP and relearning JavaScript from the likes of Yahoo’s Douglas Crockford, to Ruby, Sinatra and the inevitably Rails (If I wanted your opinion I would have scripted you one). I’ve played with MySQL and MongoDB and I may have toyed with other technologies with and without web development running the gambit between the Eiffel Programming language to Go (the one from Google — yeah, there’s another, older Go). Needless to say, giving my (so-called) non-traditional background, I would invest heavily in books and alternative sources of information like recorded tech talks, blogs (look Ma, I’m a blogger now) and the rest.

Well, I learned that a) no one really likes PHP and that b) you don’t find the kind of literature and culture around the language itself as you do in communities such as Ruby and JavaScript. The latter language is important here because it is an example of what I’m hypothesizing is wrong with PHP, namely that the lack of good literature and a strong community around writing idiomatic, maintainable and extendable PHP is the fundamental cause for people not liking PHP, yet alone truly understanding it.

Like the days of yesteryear when people were wrongly clamoring that JavaScript is a toy language and should be more like… wait for it… Java, today after so many years of PHP and its evolution, people are still producing books that push off solid OO principles in PHP to the end of their anthologies which are tightly coupled to things that should be out of scope for a book whose subject is the programming language such as the inevitable MySQL tutorial with the compulsory shopping cart example. This, I believe, is a leading factor in people misunderstanding the power of the language and the fact that 99% of these books don’t cover things like best practices in writing S.O.L.I.D software with PHP5 perpetuates a culture where you end up with professional code that looks like spaghetti and “smart” developers shying away from the platform.

In the month of May I will start my first professional PHP engineering job. I initially thought I would hate it because, as I said, no one likes PHP, but I decided to keep an open mind knowing that incredible platforms like Facebook (every heard of it?) and Wikipedia (ever heard of it?) have been built and maintained with PHP. My future employer employs (see what I did there?) the Kohana PHP framework. I had to write a little code with it and I enjoyed the fact that it’s a lightweight, bare metal framework akin to Sinatra/Padrino or Pylons (of old) that is relatively easy to keep in mental scope and reason about. I noted that it was a so-called HMVC framework. This caught my attention.

HMVC (Hierarchical Model-View-Controller) is basically the natural evolution of MVC (do I really need to?) where each triad of model, view and controller are basically what we would call an object in object oriented programming of the Smalltalk tradition. These objects are self-contained encapsulations where the members model and view are private. Said objects or (more properly) triads are only allowed to message one another through the recieving object’s controller. Not only does this style of software architecture which was first introduced in the Java community (which has great literature) as a (unwitting) reinterpretation of PAC, Presentation-Abstraction-Control, encourage us to write better code and single purpose applications (UNIX philosophy FTW), it also scales well in the world of Das Cloud (aka SkyNET).

How many Rails developers know what HMVC is? Does Django readily allow this engineering approach? While part of the blame is on those communities perhaps being a little bit self absorbed (no elbows pointing at Rails), coming back to PHP from such cultures rich in knowledge on how to do the right things or what’s cool today from the community, I put most of the blame on the PHP community and the lack of good sources of information about pedantic use of the language itself and the wonderful things the very active community is doing with it such as being the first to implement HMVC in a web framework. That must change if the perception of PHP being a tool for hacking things together is to be evolved to a more proper respect for the platform and to encourage people to understand the language and the tools it provides for abstraction and composition to encourage the writing of beautiful code.

I am going to read a few of the books on PHP published in more recent months, but I don’t hold out much faith in them being much different from the kinds of poor (in my opinion) books I read in the past (in comparison to excellent books like O’reilly’s The Ruby Programming Language) which are never cheap. I will look into all the tech talks I can find online, etc. I will either post here that I’m wrong and recommend this book or that source, but I suspect I will end up finding and sharing the best sources of specific information that I can find in an organized manner here on my new blog.

Did I mention I have a blog now?

--

--

exiquio

Former dev. Currently in school with the long-term goal of becoming a lawyer. Humble crypto investor. I love my daughters Aliyah, Destiny, and Faith.