Category: ZF2

Zend Framework 2 – Part 1

What I am about to say about PHP Frameworks may depress and disappoint you.  So don’t say I did not warn you.

What are you building?

This:

 

Or This:

1910 Ford Model T

1910 Ford Model T

While it pains me to tell you this, using a PHP Framework is more like building a Model T than a satellite, and I am going to tell you why this is a good thing.

Lets take a look at the LAMP stack without a PHP Framework:

If you are like most PHP developers, the hardware is a critical part of your application, no hardware, no application.  But when is the last time you flew up to Intel headquarters to discuss issues in your application with Intel engineers?  The OS is probably also a critical part of your application.  But when was the last time you called up Linus to go over kernel threading?  The point I am trying to make is that every day as a developer, you rely on Engineers you have never worked with.

You don’t have to know the intimate details of kernel threading because Linus and his fellow Jedi Knights have taken care of those details for you.  You don’t need to go over voltage limits with Intel as other Engineers have taken care of that for you.  A billion details that you as a developer rely upon are taken care of by people you have never met.  You just need to know how to use their work to complete your own.

If I have seen further it is by standing on the shoulders of Giants. – Isaac Newton

This entire process is just a follow on to the Industrial Revolution idea of division of labor.  As the software industry has matured it has specialized.  We have divided up the software stack into specialties.  We don’t need to know every part of the stack.  We just need to know how to use what they’ve built.

Lets put a Framework stack and LAMP stack side by side:


The green represents all the great work done by others that you use in your application.  If you are not using a modern PHP Framework, you are missing out on all that great Composer work by others.  But that is just part of it.

Lets look closer at the light blue…

Notice the Module Package and Composer Packages.  This is even more division of labor, inside your team.  This is how you can break up work inside a large application, reducing large complex problems into smaller simpler problems.  These smaller problem can be split up among team members dividing the work up among many people.

But its not all rainbows and sunshine…

intro-quality

If you don’t write test for the packages you probably just have C.R.A.P code.

The C.R.A.P. (Change Risk Analysis and Predictions) index is designed to analyze and predict the amount of effort, pain, and time required to maintain an existing body of code.

The key to using a Framework properly is to have solid blocks of code.  Both the code you import from other places, and the code you use inside your company.  If you put C.R.A.P.py code into your project, you will get crappy results in your application.

So the job becomes less about writing the whole application and more about writing solid packages of code, assembly line fashion.

Ford Highland Park Plant engine installation, 1913

There it is.  The long and the short of it.  The job of a PHP Framework coder is less about writing the entire application and more about writing a small module that is solid.  By focusing on the small you can built the big, spreading the work out among many people, making the unmanageable, manageable.

Although there are examples of government satellites taking 10 years or more to develop and launch, the data reflects that, on average, it takes 7½ years to develop and launch a first vehicle, and just over 3 years to assemble and launch subsequent vehicles.

(http://www.iceaaonline.com/ready/wp-content/uploads/2014/03/Davis-Satellite-ICEAASoCal-090915.pdf)

…Ford’s cars came off the line in three-minute intervals… (https://en.wikipedia.org/wiki/Ford_Model_T)

ZF2.ppt (70 downloads)