This is a simple booking project, created to get a taste of both technologies. Feel free to download and review the code on our github repository
There is extensive documentation in the code and readme file to help you navigate the technical details. In this article, we will stay at a purely architect/analyst level, allowing us to understand the pros and cons of these technologies and the hurdles involved with utilizing them
At first we found AngularJS cumbersome. It intrudes into the html in a way that jQuery never did. For example, once AngularJS has control of a form input field, you hard coded “value” attribute no longer works. This is now controlled by AngularJS, so you must initialize the value with it.
On the other hand, this intrusion makes some things easy. For example, in the past, when you want to create a selectbox (aka dropdown) option with jQuery, it can be tedious to set one of the options as “selected”. When hard coded, these options can require lots of coding to outline the options and specify which one is selected. With AngularJS, you can easily specify the options as an array and specify the selected value with a single line. This is where you really see the power of AngularJS over jQuery.
ZEND FRAMEWORK 3
Our team has had extensive experience with MVC applications, from CMS solutions like MODx to popular frameworks like Kohana and CakePHP. This 3rd incarnation of the Zend Framework, is pitched as a dynamic codebase which can be configured to be lighter than most but flexible enough to take on the competition. In our case, we utilize a particular flavor known as “expressive”
At first, Zend seemed like a lot of work for nothing to us. Unlike its competition, ther e isn’t ascaffolding option for rapid development. Also simple things like the routing are not intuitive, nor do they go far enough in simplifying the linkage between the url and the actions in your controller.
We also have a pet peeve about frameworks that profess to by MVC, but the method by which you go about implementing it can be different from installation to installation. With Zend, the location of your controllers and Models are dynamic and totally up to the developer. This all have to be specified in config files
On a positive side, all of the features you need are at your finger tips, PDO, templates, project building tools (composer), and strong OOP are included from launch. Various functionality is available via plugins. Once you wrap your brain around how to include them and use them, their use becomes intuitive and dynamic.
Using the two technologies together was simple enough. We implemented ajax (json) calls on the front end. These calls are posted (submitted) to a custom ZF3 controller where it is validated and passed on to the model where simple PDO commands handle the database interactions.
Error handling was managed by the Whoops error templating system. This system shows errors in fairly interesting layout which should theoretically make error tracing relatively simple. We found it useful in some cases and a waste of time in other. Then again, a lot of that is probably a result of the underlying Zend Framework. Some errors were easy to identify and fix, which others were a complete mystery.
Documentation on both technologies is abundant. ZF3 was a littler harder to follow just because of how dynamic it is. You can be looking at a github repository with the information you need, but its laid out completely different to your project. There is also different ways of doing things period, so an example might do what you need but not provide the syntax you need with the path you took on your application.
AngularJS and Zend Framework 3 Expressive are great tools for the right project. If you need something to be developed quickly, you may consider Kohana or CakePHP to be better tools. If on the other hand, you want to build a robust, complex, and stable website ZF3 might just be a great choice.
For the jQuery fans out there, AngularJS is rising in popularity for good reason. It simply does some things better than jQuery. With that said, jQuery has been around for a long time. There are tons of plugins/addons for it that are robust and work very well. There is also tons of documentation and examples available. We wont be switching any of our products to AngularJS right away, but we are definitely tempted to include it in upcoming projects