Move That Bus!

I remember it well… It was the summer of 1998. ZDTV had just started broadcasting, the
antitrust suit against Microsoft had just been filed, Windows 98 had just been put on the
market, and PHP 3 had just been released. Being in high school, we didn’t have much to do
for the summer, so we read up on the latest and greatest web development techniques
trying to learn more about this “dynamic” thing we had heard about. We had been
developing websites for people for a little while, but they were all static and we wanted to
play with the big kids. We knew there was potential for vast improvements in our
capabilities if only we could learn PHP. So three days later we had a box with Windows 98
up and running with Apache 1.2.6 and PHP 3.

We read up on everything we could find about PHP. We learned about including files so that
we only needed one copy of the code and how to make fancy visitor counters and flat file
guest books. We were hot stuff. We even managed to get PHP to send us an email when
we submitted a contact form. This was going to change everything we knew!
We continued on in this fashion for a good while making “dynamic” sites for a few local
businesses and some churches, including common headers (inc.php FTW!) and footers,
making forms to mail people, etc. We learned a little more about what we were doing every
week, but we knew we could do better.

Jump to 2001, we had just finished the school year at North Carolina State University
(Jason his sophomore year, and Garrison his freshman year). Again with nothing to do for
the summer, we decided that we should form a company to create these dynamic websites
for people and make some money for ourselves. Our company was called Fuzionsoft, and it
was green (neon green, not Al Gore green). We had ourselves a few clients, they were
happy with what we had to offer, but again, we felt like we could offer more. Thus we
started our first large-ish scale website. It was going to be a community-centered tool for
our town where everyone could go to get things like the weather, local business
information, news, restaurants, etc. The tag line was “The Virtual City of Newton and
Conover North Carolina.” To create it, we pulled out all our PHP stops, including screen
scraping data from weather.com. Unfortunately, we were still in the land of having included
common headers and footers and such. It certainly wasn’t scalable and it was pretty
fragile. After moderate success with the project we had to go back to college, which pretty
much killed the site and Fuzionsoft.

Jason started working full-time at NC State after graduation as a web developer. Garrison
went on to work at IBM as a web application developer for a year and a half before coming
back to work at NC State alongside Jason in March of 2006. We were back working as a
web development team again, and we knew a lot more than we did the last time we worked
together.

Jason had helped build a common code library called JigSaw that resembled a framework.
It included some classes to connect to a database, parse RSS feeds, do HTTP requests, etc.
It had a common JigSaw.php file that was included in every application, then you could load
modules from a centralized repository. Every module was in one place, so if you had to
make a change it was propagated to all the applications that used that module. It was a
decent little system that helped prevent us from reinventing the wheel every time we
needed common code.

The system did have some flaws. Because it was centrally housed, if one file had an error
and it was included in every application, every application broke.

One day when browsing around the internet Jason came across a posting about the 2006
Zend Conference being held in November. It was billed as “the premiere PHP conference.”
We asked our manager if there was any way we could attend. If we were going to be “real”
PHP developers, we felt like we needed to be at this event – it was the definitive place to be
if you were in the PHP world. Our management was able to find the funds to allow us to
make our way to San Jose for the 2nd Annual Zend / PHP Conference.

We had no idea what to expect or what we were getting ourselves into, but we thought we
were pretty on top of everything. We had a centralized library of code and a system that
worked well; we thought we were pretty efficient about our application development. We
figured we would at least be on par with the other attendees if not ahead of the curve.
We went to the first tutorial session: “Best Practices for PHP Development” with Matthew
Weier O’Phinney & Mike Naberezny. It was fantastic… and intensely frightening. Our
mutual response was straight out of a movie: The main characters have just made the
realization that their car wasn’t in park and is plummeting down a hill towards the edge of
the cliff. They both slowly turn to each other and simultaneously say, “Oh, crap…”

Here were just a few of the key points of the talk:

* Have some kind of coding standard, but do not invent your own
* Using Classes is not Object Oriented Design
* Use some kind source control (they talked about Subversion)
* Never edit code on the server
* Deploy to a staging area on your production server first

We were floored…more than floored even. We were basemented! Our blinders had been
removed and we suddenly were painfully aware of the many clear downfalls to our
development environment and practices.

* We were still using PHP 4 even though PHP 5 had been released over two years before.
* Nothing was object oriented. We used the pseudo object oriented techniques in PHP 4 for the common library, but everything else was procedural.
* We didn’t have any way to develop applications in a development environment, so we had to edit the live production code. We knew this was bad, but there just wasn’t anything in place to avoid it.
* There was no source control to speak of. We really weren’t even sure how to use it properly.
* We had no coding standards. Sometimes we used hyphens and sometimes we didn’t. Variable names like $count were often used for hundreds of lines of code. No one’s code looked like anyone else’s and it was a nightmare to understand.
* We used no real framework to speak of. We had our custom JigSaw library, but nothing like Zend Framework. We were still including common headers and footers and putting SQL queries in our pages. And there was no hint of the MVC architecture to be found.
* All our apps had multiple single points of failure. If something happened to the JigSaw code (a parse error or if an editor crashed while someone was saving and corrupted a file) every application would cease to run.
* We didn’t use any IDEs at all. Jason used Notepad and (shutter) FrontPage, Garrison used Notepad and Dreamweaver — nothing that actually helped with the coding process.

We went to the sessions and talks at the conference and realized how far behind we really
were. We sat at lunch with random people and listened to them talk about how they
operated and learned that we didn’t do any of those things.

Conclusion: we weren’t on top of anything at all. We weren’t even close. The only thing
that made us feel good about ourselves was that we both managed to pass the Zend PHP 4
Certification test.

Garrison had a friend that worked at Google and he offered to give us a tour of the campus,
so on the next to last day of the conference we took the train up to Mountain View to visit.
Coming from our 8 x 15 taupe plaster box of an office, Google was amazing. We envied the
fun spirit and attitude of their offices and corporate culture. On the light rail ride back from
Mountain View to San Jose, we put together a plan to change everything about how we did
business.

For the previous two years we had focused on writing “scripts” in PHP specifically for our
little part of the world. These were cleverly disguised as applications with some common
functionality, but for the most part they were so specific that even duplicating them for
other folks in our unit was tedious. They shared no common structure, no file or variable
naming scheme, no code formatting, nothing. They were specific to their task and they did
their job, but maintenance and extensibility was a daunting task. We were short-changing
ourselves and the people for whom we wrote applications.

First things first, we had to get PHP5 going on campus. Our request was initially met with
cynicism as money and resources were tight, but we were persistent in our mission. Jason
managed to round up the funding to purchase four brand new web servers, and convinced
our system administrators that it would be a good idea to let us run PHP 5 when NOBODY
else on campus was doing it.

We also convinced them to install and manage a bank of Subversion servers so that we
could start versioning our code. Again, it wasn’t easy to get funding or find time to get this
going, but it was critical and we were on a mission!

Next on the checklist…coding standard. We evaluated the PEAR coding standard and the
Zend Framework coding standard. Both were about the same, and since our master plan
included using Zend Framework, we decided to adopt the Zend Framework coding standard.
We also put in requests to get copies of Zend Studio for each of us. With the Zend
Framework integration and Subversion integration, that product would help immensely.
After we got our environment set up, we were ready to figure out Zend Framework and the
whole MVC world. Our searches took us to Rob Allen’s tutorial about “Getting Started with
Zend Framework.” Over a period of about 2 weeks, we had the demo application up and
going. That seems like a long time now, but we were learning to look at PHP in a
completely different way. We also didn’t want to just go through the tutorial; we wanted to
understand each intricacy of why things were done the way they were. It was totally
fascinating.

We soon discovered that this made more sense than anything we had ever done before. We
realized that there was no reason to reinvent the wheel and write your own database
abstraction layer or authentication system. A sign with the aphorism “Do not reinvent the
wheel until you know everything there is to know about wheels” was prominently displayed
in our office.

In one short year, we changed almost everything we knew about web application
development. We learned new paradigms, new best practices, new standards, and most
importantly, implemented them. We went from taking four to six months to develop an
application, to four to six weeks. The results were undeniable, and our management
noticed.

Our story is one of success (at least from our perspective) in our attempt to do things the
“right” way, and we owe it all to the experiences we got at ZendCon. We went back to
ZendCon the next year and sat at the same lunch tables with people and we were the ones
talking to people asking them how they had done something. We were surprised and
relieved to find out that 1) other people were doing it the same way we were, and 2) we
saw our year-ago selves in some of the other attendees. We got to tell them that we
indeed knew exactly where they were coming from and that they were at the best possible
place to change their ways for the better.

Going to our second ZendCon in 2007 and earning our PHP5 certifications validated
everything we had worked on in the previous year. We were able to nod along in
agreement when someone would say you should adopt a coding standard, and we didn’t go
cross-eyed when someone started talking about how they were able to streamline their
access control using Zend_Acl. We were finally at a point where we felt like a part of the
PHP community rather than just beneficiaries of it.

Our experience at ZendCon made us want to evangelize our new methodologies to our
campus peers. We wanted other developers on campus to know about the more efficient
way were were developing. We created our first workshop – MVC with Zend Framework –
as a hands-on workshop showing how to develop a complete application with Zend
Framework. The twenty spots for the workshop filled up within 30 minutes after the
announcement. There was clearly interest in what we had to share. What we found in
teaching the workshop was that a lot of people were in the same place we had been – using
unfounded and adhoc development practices that didn’t follow any kind of standards. On
the success of that workshop, we created two more: one on Object Oriented PHP and
another on Design Patterns.

Our role as evangelists for doing things the “right way” led us to the opportunity to host an
Uncon session on “Implementing Best Practices in the Real World” at the 2008 ZendCon. In
our talk we were pleasantly surprised to discover that most of the people were already
using version control and adopting coding standards. We see this as reflective of the
maturation of the PHP community at large. Most developers are focusing on the larger
picture rather than trying to keep their spaghetti code organized. It was refreshing to see
the growth of the community in just three short years. Imagine what the next three years
will bring…

During ZendCon ’08 we participated more than we ever had before. From engaging in
discussions with the community members who develop Zend Framework to having breakfast
with the bigwigs at Zend, we were able to take advantage of the best resource ZendCon has
to offer – its attendees. We also passed our Zend Framework Certification exam and left
California finally feeling like we were in a place to contribute to the greater PHP community.
I think it’s best to describe our experience at ZendCon in terms of Extreme Makeover: Home
Edition. ZendCon was the Ty Pennington to our decrepit house. They came in, tore down
our 700 square foot house with a Kool-Aid sized hole in the wall and built us a glorious 8000
square foot mansion in under a week. We stood there, they moved that proverbial bus, and
our professional abilities improved by leaps and bounds.

Jason Austin and Garrison Locke are the Outreach Technology web application development
team at North Carolina State University (“http://webapps.ncsu.edu”:http://webapps.ncsu.edu). They both hold
degrees in Computer Science from NC State and are converts to Mac. A Kentucky Fried
Chicken cashier once asked if they were brothers. They are not.