Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DZone.com:
The Duck is a Lie
Jun 27, 2012 @ 14:55:22

In this recent post to DZone.com Giorgio Sironi looks at duck typing and compares it in a few different languages (PHP, Ruby and Java). "Duck typing" is where the methods/functions define the structure or common interface rather than being functional.

What follows is my experience with Java, PHP and Ruby. I mainly use PHP as a dynamic language that supports duck typing but also the definition of Java-like interfaces, but does not force any of the two approaches as you can define interfaces whose method arguments accept any variable or not using interfaces at all. Is duck typing that a revolution?

He shares some of the common misconceptions he's seen including the idea that duck typing can help completely different objects work together and that, sometimes, despite naming conventions, functionality was intended to be different. He shows how even interfaces in PHP can be implemented loosely and the "acts as" and "single callback" architecture ideas.

tagged: duck typing interface misconception actsas callback

Link:

The Bakery:
Five New Posts - Custom Views, CSS, ViewInFile, ActsAs and Email Validation
Aug 31, 2007 @ 15:26:00

The Bakery has posted five new articles/tutorials for topics like customizing the view and sending emails a little differently:

  • $anything_for_layout: Making HTML from the View available to the layout - Did you ever have a side navigation that you wanted to change based upon changes in the view? Using this helper, you can write HTML and other output for display in the layout
  • css list-menu helper - A helper (method) to create a css formatable list-menu.
  • ViewInFile component - Sometimes in needed to output a view in a file. Most of the time for debugging, but also for some web service (xml) where you might need to send (by mail as a copy) an xml file reflecting the answer of the webservice.
  • ActAs Image column behavior - This behavior add new column to your model and allow to store images in file system. It can resize images, create several versions, and thubnails. After find model you got link to file for each record in model.
  • Email Validation - email validation replacement for /cake/libs/validation.php

Check out The Bakery for even more great CakePHP-related content.

tagged: thebakery cakephp framework view css viewinfile actsas email validation thebakery cakephp framework view css viewinfile actsas email validation

Link:

The Bakery:
Five New Posts - Custom Views, CSS, ViewInFile, ActsAs and Email Validation
Aug 31, 2007 @ 15:26:00

The Bakery has posted five new articles/tutorials for topics like customizing the view and sending emails a little differently:

  • $anything_for_layout: Making HTML from the View available to the layout - Did you ever have a side navigation that you wanted to change based upon changes in the view? Using this helper, you can write HTML and other output for display in the layout
  • css list-menu helper - A helper (method) to create a css formatable list-menu.
  • ViewInFile component - Sometimes in needed to output a view in a file. Most of the time for debugging, but also for some web service (xml) where you might need to send (by mail as a copy) an xml file reflecting the answer of the webservice.
  • ActAs Image column behavior - This behavior add new column to your model and allow to store images in file system. It can resize images, create several versions, and thubnails. After find model you got link to file for each record in model.
  • Email Validation - email validation replacement for /cake/libs/validation.php

Check out The Bakery for even more great CakePHP-related content.

tagged: thebakery cakephp framework view css viewinfile actsas email validation thebakery cakephp framework view css viewinfile actsas email validation

Link:


Trending Topics: