Thinking differently about default parameters in PHP
You’re likely to find this pattern in PHP code:
The problem with this pattern and a limitation of PHP, is that PHP does not have named parameters.That is, when I switch the orders or add a new parameter in the middle of the existing code, everything breaks.It breaks because when constructing the Person object, it requires fname, lname, and age in that specific order.
Using Grip with Zend Framework 2
If you’ve been following / contributing to Zend Framework 2 then you have most likely have read / seen Rob’s (@akrabat) Getting started with Zend Framework 2.
Throughout the tutorial you use Zend’s Dependency Injection container to inject all the dependencies into each class. If you’re interested in using Grip’s powerful IoC container, I’ve included the gist of the changes needed to be made including the equivalency mapping of the objects the tutorial uses.
Excellent JavaScript resources for beginners to veterans
Excellent JavaScript resources
For beginners and masters here is a small list of excellent JavaScript resources, and blogs, which will improve your knowledge of the language and hopefully teach you something new.
Automatically semicolon insertion, or do I always have to use semicolons is a hot topic in JS. Experts claim it’s confusing if you don’t add them in, some claim it’s inconsistent. Here is a great article eloquently explaining ASI:
http://inimino.org/~inimino/blog/javascript_semicolons
The tilde operator in JavaScript or bitwise NOT gives you the power to express yourself creatively in conditionals:
http://javascriptturnsmeon.posterous.com/the-tilde-operator-in-javascript
A big problem for JavaScript beginners is usually understanding what `this` means when. Yehuda Katz clears up the confusion with this great article:
http://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/
Another common pitfall for beginners is variable scoping. Unlike languages like C and Java which have lexical scoping, JavaScript has function scope, what does this mean exactly? Well, variables and function declarations are hoisted to the top, read more here:
http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting
An article on understanding for-in and which properties are iterated:
http://javascriptweblog.wordpress.com/2011/01/04/exploring-javascript-for-in-loops/
Equality vs Strict Equals
http://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/
Last but not least, two book recommendations.
JavaScript Pattersn by Stoyan Stefanov
http://www.amazon.com/JavaScript-Patterns-Stoyan-Stefanov/dp/0596806752/ref=sr_1_1?s=books&ie=UTF8&qid=1322015883&sr=1-1
High Performance JavaScript by Nicholas Zakas
http://www.amazon.com/Performance-JavaScript-Faster-Application-Interfaces/dp/059680279X/ref=sr_1_1?ie=UTF8&qid=1322015870&sr=8-1
Layering your PHP application
In many Java EE applications you’ll find the following architecture:

The controller layer makes a call to the service layer.The service layer makes a call to the DAO (Data Access Object) layer. Once at the DAO, it’s main responsibility is to make a database call or a web service call and build a simple DTO (Data Transfer Object). Afterwards, the DAO returns the DTO to the service layer, which then the service layer creates a business object with the DTO and finally hands it over to the controller.
