Visualizzazione post con etichetta books. Mostra tutti i post
Visualizzazione post con etichetta books. Mostra tutti i post

sabato, luglio 06, 2013

A quick introduction to Yii development


Some days ago, I have been invited to write a review for the book Yii 1.1. Application Development Starter, written by Jacob Mumm and Mark Safronov (Packt Publishing). The book is published in the "instant" book series, and is available only in its digital form. I received it as a complimentary copy from the publisher.


In the book you don't find anything that isn't available online amongst the official documentation on Yii's website or on Wikipedia. The example in the "Quick start" chapter is taken from (and links to) the official documentation, bringing your attention to the main aspects to consider and leaving out some less important details. The "Top 5 features you need to know about" chapter is a bit more interesting, because it gives you some hints about features that are a little hidden, with some usage examples. I found particularly interesting the sections about authentication and role-based access control. Again, everything is available on the web, so if you have time and want to achieve a deep knowledge of the subject this book is not for you: just go through the examples in the official documentation, access the forums, run your own experiments. But if you are short of time, and just want to know about the main benefits Yii has to offer, it might be worth buying and reading the book, because it offers a quick introduction to all the basic points you'd have to deal with when projecting and implementing a web application using Yii.

domenica, giugno 02, 2013

A good cookbook for Yii development

I just finished reading Alexander Makarov's Yii Application Development Cookbook that I found a really valuable resource to keep at hand if you are developing a web application using Yii.
In its thirteen chapters you are provided with lots of recipes that open your eyes on what the framework does for you under the hood, and on what you can do with minimal effort to improve your application.
The book can be really a time-saving resource: by reading the recipes provided, I ended up many times thinking "If I hadn't read this here, I would have reinvented the wheel, should I have faced the same problem described." For instance, I didn't know about decorators, custom input widgets, some methods automatically called as event
handlers, reusable controller actions, etc., and I found out that a very easy implementation of these concepts is actually just a few lines of code away.
Even for things that I already knew before reading the book, I found it very interesting to compare my solutions with what was described in the book, since I always try to write my code "in the right way",
following the best practices, and I am eager for improvements. Ideas and implementations of simple table inheritance, zii widget customization, role based access control, etc., fell for me in this
category.
Last but not least, the book provides very useful hints for the deployment, when one should fine-tune the application in order to improve the performances.
The only things that appeared to be wrong, from my point of view, is the use of "get", "put" and "post" HTTP methods, that in some recipes seem to be used in the wrong way. In a web application you should never allow somebody to delete something by clicking on an ordinary link, and that means that you should check whether the request is done via the "post" method (Yii provides a postOnly filter for that), and the cookbook should stress that. Another point is that in RESTful applications "post" is used to store new data, while "put" to update data already existing, not viceversa (this is already fixed in the errata page).