On July 10th, we had a not-common hackday organized a Liip in Fribourg. The theme was “Symfony 2 for non- (or old-) developers”. The goal of this workshop was to build a better understanding of what our developers at Liip are struggling with in their every day life, on most of our projects. This workshop was intended to business people, product owners, sys admins or anyone to whom coding is not the main task and who wanted to get his hands “dirty” for a while. Here is how it went for us.
The goals that we fixed for this adventure where the following :
- Install a local LAMP environment so that we can install SF2 on it
- Follow tutorials
- Create a small SF2 application
Understanding MVC architecture
Before getting our hands into command and code lines, we noticed that our programming knowledge where quite out of date and we had to refresh our mind on some basic software development concepts. Among others we needed to build an understanding of the Model View Controller architecture. We tried to explain it ourselves and searched quickly through the SF2 documentation website. What's funny is that we finally went through a very concise MVC overview video from the Ruby community :)
Install a local LAMP environment
After this first discussion on modern best practices in development and some comparison with what were our habits 8 to 10 years ago (I remember my MVC's being basically one big file ;) , we moved on to installing a local LAMP stack on our machines. Of course, some of us took advantage of the binary script of the PHP OSX project (born after a previous Liip hackday btw) and fought a bit with MySQL configuration. Others used MAMP (which is fine for local installations and has the advantage of installing MySQL as well).
Our local install running, we could finally start installing Symfony2. For this we followed carefully the instructions available on the Symfony2 Quicktour. While doing so, we were reminded that Symfony2, and also the documentation, is still a Release Candidate :). Most of the commands worked, however to our opinion, the instructions missed clarity and precision in some cases. Fortunately, while helping one another, we made it through the end of the tutorial. It was actually quite helpful for us to understand how routing, controllers and templating work. We also discovered and understood how Symfony2 applications are organized in bundles.
Create a small SF2 application
Now that we went through the basic tutorial, we had experienced how to create a controller and a view for a basic application. Now we decided to create a real application with also a “model” (see as our MVC refresher was helpful ;) component and some logic behind it. Two types of applications were created : some created an address book and others a wishlist. And this is where we noticed the power of the framework.
Basically, we were able to create these applications by going through a minimum of commandlines :
1) generate:bundle creates a new bundle
2) doctrine:generate:entity to create a new entity (the datamodel, here an “address” or a “wish” entity)
3) doctrine:database:create to create the new database
4) doctrine:schema:create allowed us to create automatically the tables and fields related to our entity previously defined
5) doctrine:generate:crud created automatically the CRUD commands used to manage our addresses and wishes.
That's it, in 5 steps, my Wishlist application just works (no look at the styling, we didn't do any) :
We were amazed how the Symfony2 prepares us most of the work, and how fast it is. Moreover, the routes allows to have nice paths automatically from the start. However, we also noticed that code “magic” has downturns : one of us didn't manage to finish its application on time for a reason that we were not able to identify. Here, the help of one of our Symfony2 specialists would have been helpful.
We noticed that we are not developers, and thanks for our clients and colleagues, we do not get the chance to write lines of codes ;)
Symfony2 seems to have a bright future ahead and by largely adopting it within Liip, we are getting better and better at building customized web apps from scratch. That's good and that's what we do best, anyway.
For “first timers” like us, it's not that easy to get going with Symfony2 at the moment. The tutorial still has bugs in it and it took us some time to work them around. But it will probably get better as the framework evolves (it's RC4 at the moment).
Anyway, we now will be better prepared when selling our solutions and speaking about them. And thanks to this hackday we also will be a bit closer to our great developers. Thanks Liip for these awesome hackdays.