<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

  <channel>
	<title>Alfonso Jiménez</title>
	<link>http://www.alfonsojimenez.com</link>
	<description>El somni d'una nit d'estiu</description>
	<pubDate>Mon, 17 Nov 2008 16:20:11 GMT</pubDate>
	<generator>http://www.alfonsojimenez.com</generator>

	
    <image><url>http://www.alfonsojimenez.com/images/2006/12/nuevodiseno.png</url></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/alfonsojimenez" type="application/rss+xml" /><feedburner:emailServiceId>604351</feedburner:emailServiceId><feedburner:feedburnerHostname>http://www.feedburner.com</feedburner:feedburnerHostname><item>
      <title><![CDATA[TwitterContacts]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/456151309/17-twittercontacts</link>
      <pubDate>Mon, 17 Nov 2008 16:20:11 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;&lt;a href="http://twittercontacts.com" title="Twitter Contacts"&gt;&lt;img src="http://www.alfonsojimenez.com/images/2008/11/twittercontacts.jpg" class="centro_sinmarco" alt="TwitterContacts" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twittercontacts.com" title="Twitter Contacts"&gt;TwitterContacts&lt;/a&gt; is just a simple application that I built in a few nights. It&amp;#8217;s purpose is to provide an option to check out which of the people who you are following on &lt;em&gt;Twitter&lt;/em&gt; are not following you. Simple, clear, easy and all-in-one-page.&lt;/p&gt;
&lt;p&gt;Someone asked me about the real value contributed by this application. Apart from the purpose, I think the real value is that you can get the &lt;a href="http://svn.twittercontacts.com" title="TwitterContacts"&gt;code here&lt;/a&gt; (&lt;em&gt;GPL&lt;/em&gt;). Anyway, doing this was just a pastime.
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/456151309" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F11%2F17-twittercontacts</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/11/17-twittercontacts</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[2008, un año más]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/456115235/17-2008-un-ano-mas</link>
      <pubDate>Mon, 17 Nov 2008 15:38:58 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;&lt;img src="http://www.alfonsojimenez.com/images/2008/11/wd.jpg" class="centro" alt="2008" /&gt;&lt;/p&gt;
&lt;p&gt;Como todos los años, 2008 ha sido un año singular. Un año en el que los que se &lt;a href="http://www.20minutos.es/galeria/3940/0/5/" title="Zapatero gana las elecciones"&gt;supone que saben&lt;/a&gt; ganan a los que sin duda &lt;a href="http://es.wikipedia.org/wiki/Mariano_Rajoy" title="Mariano Rajoy"&gt;no saben&lt;/a&gt;. Para muchos, 2008 será recordado como el año en el que se demostró que los &lt;a href="http://es.wikipedia.org/wiki/Crisis_econ%C3%B3mica_de_2008" title="Crisis económica de 2008"&gt;ricos también lloran&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Para otros sin embargo, ha sido el año donde perdieron a su &lt;a href="http://www.adn.es/ciudadanos/20080820/PGL-0003-fotos-accidente-barajas-spanair-aeropuerto/_withThumbs.html" title="Catástrofe de Barajas"&gt;padre&lt;/a&gt;, a su &lt;a href="http://www.abc.es/20080821/nacional-sucesos/muertos-estrellarse-despegue-avion-200808210736.html" title="Catástrofe de Barajas"&gt;hija&lt;/a&gt; o a su &lt;a href="http://www.elpais.com/fotogaleria/Catastrofe/aerea/aeropuerto/Barajas/5729-1/" title="Catástrofe de Barajas"&gt;mejor amigo&lt;/a&gt;. Ha sido el año en el que durante unos días &lt;a href="http://www.elmundo.es/mundodinero/2008/05/21/economia/1211394543.html" title="Huelga de Transportistas"&gt;el pan no llegaba&lt;/a&gt; a nuestras casas.&lt;/p&gt;
&lt;p&gt;2008 ha sido el año en el que se cumplió &lt;a href="http://www.america.gov/st/elections08-spanish/2008/November/20081105130532pii0.3045923.html" title="Barack Obama gana las elecciones"&gt;un sueño&lt;/a&gt; donde las personas no son juzgadas por el color de su piel sino por su caracter. El sueño de la esperanza, el sueño americano.&lt;/p&gt;
&lt;p&gt;Ha sido el año en el que &lt;a href="http://news.bbc.co.uk/hi/spanish/latin_america/newsid_7486000/7486564.stm" title="Betancourt"&gt;algunos&lt;/a&gt; volvieron a saborear la libertad, y &lt;a href="http://es.wikipedia.org/wiki/Fidel_Castro" title="Fidel Castro deja su mandato"&gt;otros&lt;/a&gt; perdieron la libertad que nunca debían de haber tenido.&lt;/p&gt;
&lt;p&gt;Para los más deportistas, este año quedará en sus corazones como el año en el que dijimos: &amp;#8220;&lt;em&gt;sí, podemos&lt;/em&gt;&amp;#8221; y &lt;a href="http://www.marca.com/edicion/marca/futbol/eurocopa/cronica/es/desarrollo/1140473.html" title="La Selección Española gana la Eurocopa 2008"&gt;pudimos&lt;/a&gt;. Y como ocurre todos los años, siempre mueren los &lt;a href="http://news.bbc.co.uk/hi/spanish/misc/newsid_7639000/7639699.stm" title="Paul Newman"&gt;buenos&lt;/a&gt; &lt;a href="http://www.diariodigital.com.do/articulo,31763,html" title="Bernie Mac"&gt;de&lt;/a&gt; &lt;a href="http://www.elmundo.es/elmundo/2008/04/06/videos/1207478383.html" title="Charlton Heston"&gt;las&lt;/a&gt; &lt;a href="http://www.elmundo.es/elmundo/2008/01/22/cultura/1201039144.html" title="Heath Ledger"&gt;películas&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;2008 también ha sido el año en el que la ciencia progresa a pasos &lt;a href="http://en.rian.ru/world/20080805/115771418.html" title="HLC"&gt;agigantados&lt;/a&gt; y los &lt;a href="http://es.biz.yahoo.com/16102008/185/google-demuestra-inmune-crisis-eleva-beneficios-pronos.html" title="Google demuestra ser inmunes a la crisis"&gt;gigantes&lt;/a&gt; no entienden de crisis. Ha sido el año de la esperanza, donde las &lt;a href="http://www.kde.org/announcements/4.0/index-es.php" title="Lanzan KDE4"&gt;comunidades&lt;/a&gt; &lt;a href="http://www.fayerwayer.com/2008/08/linux-crece-en-el-mercado-de-servidores/" title="GNU/Linux crece en el mercado de servidores"&gt;libres&lt;/a&gt; avanzan, y con ellas avanzamos todos.&lt;/p&gt;
&lt;p&gt;2008 ha sido un año más.&lt;/p&gt;
&lt;div style="position:relative"&gt;
       &lt;img src="http://www.atrapalo.com/images_new/mkt/microsite/promo/1any1post/boton_votar.gif" border="0" usemap="#Map" /&gt;&lt;br /&gt;
       &lt;img src="http://www.atrapalo.com/promo/1year1post/votaciones/25" style="position:absolute;left:140px;bottom:5px;" /&gt;&lt;br /&gt;
       &lt;map name="Map" id="Map"&gt;&lt;br /&gt;
          &lt;area shape="rect" coords="5,3,309,45" href="http://www.atrapalo.com/promo/1year1post/" alt="Atrápalo" title="Atrápalo" /&gt;&lt;br /&gt;
          &lt;area shape="rect" coords="4,49,100,83" href="http://www.atrapalo.com/promo/1year1post/votar/25" alt="Votar" title="Votar" /&gt;&lt;br /&gt;
          &lt;area shape="rect" coords="209,47,308,84" href="http://www.atrapalo.com/promo/1year1post/ranking" alt="Ver otros participantes" title="Ver otros participantes" /&gt;&lt;br /&gt;
       &lt;/map&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/456115235" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F11%2F17-2008-un-ano-mas</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/11/17-2008-un-ano-mas</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[Visualization of a Phing buildfile]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/437231356/30-visualization-of-a-phing-buildfile</link>
      <pubDate>Thu, 30 Oct 2008 19:50:08 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;&lt;strong&gt;Raphael Stolt&lt;/strong&gt; published a method to get a &lt;strong&gt;visualization of a Phing buildfile&lt;/strong&gt; a few days ago:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Out of the box the Phing -l option can be used to get a first overview of all available targets in a given buildfile but it doesn&amp;#8217;t untangle the target dependencies and sometimes a picture is still worth a thousand words. Luckily the Ant community already provides several tools to accomplish the visualization of Ant buildfiles, reaching from solutions that apply a Xslt stylesheet upon a given buildfile.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;He uses the &lt;em&gt;ant2dot&lt;/em&gt; tool and the &lt;em&gt;Graphiz&lt;/em&gt; library to show the XML from a buildfile into a graphic. The image represents the flow of the build.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://farm4.static.flickr.com/3030/2974636277_e31efcd536_o.png" class="centro_sinmarco" alt="Phing" /&gt;&lt;/p&gt;
&lt;p&gt;Via | &lt;a href="http://raphaelstolt.blogspot.com/2008/10/getting-visualization-of-phing.html" title="Visualization of a Phing buildfile"&gt;Raphael Stolt&lt;/a&gt;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/437231356" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F10%2F30-visualization-of-a-phing-buildfile</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/10/30-visualization-of-a-phing-buildfile</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[Webgrind: A web frontend for Xdebug]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/423588059/17-webgrind-a-web-frontend-for-xdebug</link>
      <pubDate>Fri, 17 Oct 2008 11:11:37 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;&lt;strong&gt;Webgrind&lt;/strong&gt; is a web frontend for the popular &lt;strong&gt;Xdebug&lt;/strong&gt;. Written by &lt;a href="http://jokke.dk/"&gt;Joakim Nygård&lt;/a&gt; and &lt;a href="http://oettinger.dk/"&gt;Jacob Oettinger&lt;/a&gt;, &lt;strong&gt;Webgrind&lt;/strong&gt; parses the Xdebug output and shows it on a dropdown table.&lt;/p&gt;
&lt;p&gt;It doesn&amp;#8217;t make such a big job, but it&amp;#8217;s nice to see the result on a clean interface. The last release is 0.81, and you can get it from &lt;a href="http://code.google.com/p/webgrind/" title="Web Grind" rel="nofollow"&gt;Google Code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.alfonsojimenez.com/images/2008/10/webgrind.png" alt="Webgrind" class="centro_sinmarco" /&gt;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/423588059" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F10%2F17-webgrind-a-web-frontend-for-xdebug</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/10/17-webgrind-a-web-frontend-for-xdebug</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[Rasmus, Think again!]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/421662517/15-rasmus-think-again</link>
      <pubDate>Wed, 15 Oct 2008 15:43:37 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;I would like to share with you my friend &lt;a href="http://www.bermilabs.com/en/team/arno-schneider/" title"Arno Schneider"&gt;Arno&lt;/a&gt;&amp;#8217;s slides. He expounded this presentation during the last &lt;strong&gt;PHP Conference&lt;/strong&gt; in Barcelona. He gave a speech on the usage of frameworks and software components in order to build PHP applications.&lt;/p&gt;
&lt;p&gt;The famous Rasmus Lerdorf&amp;#8217;s dixit is shown up in these slides, via some amusing examples: &lt;em&gt;Frameworks are performing poorly&lt;/em&gt;. Arno prooves this statement using a &lt;em&gt;Hello World&lt;/em&gt; application, and yes, Rasmus is right and framework performances suck for &lt;em&gt;Hello Word&lt;/em&gt; applications.&lt;/p&gt;
&lt;div style="text-align:center; margin-bottom: 20px"&gt;&lt;object width="450" height="346"&gt;&lt;br /&gt;
&lt;param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=rasmus-think-again-agile-framework-happy-php-developer-1222716601566030-9"&gt;&lt;/param&gt;
&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;
&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=rasmus-think-again-agile-framework-happy-php-developer-1222716601566030-9" type="application/x-shockwave-flash" width="420" height="336" allowFullScreen="true" allowScriptAccess="always"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/421662517" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F10%2F15-rasmus-think-again</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/10/15-rasmus-think-again</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[10 ways to demotivate your team]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/405608970/28-10-ways-to-demotivate-your-team</link>
      <pubDate>Sun, 28 Sep 2008 19:56:36 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;&lt;img src="http://www.alfonsojimenez.com/images/2008/09/unmotivated.jpg" class="centro" alt="Unmotivated" /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Set up impossible deadlines.&lt;/li&gt;
&lt;li&gt;Let them work overtime.&lt;/li&gt;
&lt;li&gt;Don&amp;#8217;t allow breaks.&lt;/li&gt;
&lt;li&gt;Place a ban on laughing.&lt;/li&gt;
&lt;li&gt;Break the coffee machine.&lt;/li&gt;
&lt;li&gt;Don&amp;#8217;t shield them from the dirty daily business.&lt;/li&gt;
&lt;li&gt;Don&amp;#8217;t challenge them.&lt;/li&gt;
&lt;li&gt;Underpay them.&lt;/li&gt;
&lt;li&gt;Bribe them.&lt;/li&gt;
&lt;li&gt;Infiltrate a team member who is demotivated anyway.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Seen on &lt;a href="http://klimek.box4.net/blog/2006/12/20/top-10-ways-to-demotivate-your-programming-team/"&gt;Manuel Klimex&lt;/a&gt;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/405608970" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F09%2F28-10-ways-to-demotivate-your-team</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/09/28-10-ways-to-demotivate-your-team</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[Google 404]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/376082021/27-google-404</link>
      <pubDate>Wed, 27 Aug 2008 11:44:33 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;I gotta say, I had thought this before. &lt;strong&gt;Google&lt;/strong&gt; provides a new way to enhance 404 pages. If our visitors get a &lt;em&gt;not found&lt;/em&gt; error, we can give them some alternatives using a simple Google snippet. This code provides the &lt;strong&gt;closest match&lt;/strong&gt; (for the URL) and other things to try such as search into the site. This is useful information designed to help them find the information the users need.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.alfonsojimenez.com/images/2008/08/google404.jpg" class="centro_sinmarco" alt="Google 404 Pages" /&gt;&lt;/p&gt;
&lt;p&gt;You can read more about it on the &lt;a href="http://googlewebmastercentral.blogspot.com/2008/08/make-your-404-pages-more-useful.html" title="Google 404 Pages"&gt;Official Google Webmaster Blog&lt;/a&gt;.
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/376082021" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F08%2F27-google-404</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/08/27-google-404</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[Closed for holidays]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/350644965/30-closed-for-holidays</link>
      <pubDate>Wed, 30 Jul 2008 17:14:03 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;Closed for &lt;strong&gt;holidays&lt;/strong&gt;. I&amp;#8217;ll be in &lt;strong&gt;Japan&lt;/strong&gt; until 15th August. I think I deserve a rest. Up until then, have a lovely summer.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Japan_flag_-_variant.png/800px-Japan_flag_-_variant.png" style="width:450px" class="centro" alt="Japan" /&gt;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/350644965" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F07%2F30-closed-for-holidays</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/07/30-closed-for-holidays</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[Multiple Constructors in PHP]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/349770954/29-multiple-constructors-in-php</link>
      <pubDate>Tue, 29 Jul 2008 21:02:25 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;&lt;img src="http://www.alfonsojimenez.com/images/2008/07/bob.jpg" class="izquierda_sinmarco" alt="Bob the builder" /&gt;As you probably know, it&amp;#8217;s possible to have multiple constructors in Java. They need to have the same name as the class, and they can only be distinguished by the number and type of arguments. In PHP5, you can only have &lt;strong&gt;one constructor&lt;/strong&gt;. You can define it using the reserved word &lt;em&gt;__construct&lt;/em&gt;. If the &lt;em&gt;__construct&lt;/em&gt; function doesn&amp;#8217;t exist, PHP5 will search for the old-style constructor function (by the name of the class). So if we cannot have multiple constructors, how could we create objects with different initial conditions? It&amp;#8217;s not a big deal. There&amp;#8217;s a pattern called &lt;strong&gt;Factory Method&lt;/strong&gt;, which &lt;strong&gt;defines &lt;em&gt;virtual&lt;/em&gt; constructors using static methods&lt;/strong&gt;. Let&amp;#8217;s see an example:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
class Person
{
    private $name;
    private $email;

    public static function withName($name)
    {
        $person       = new Person();
        $person-&gt;name = $name;

        return $person;
    }

    public static function withEmail($email)
    {
        $person        = new Person();
        $person-&gt;email = $email;

        return $person;
    }

    public static function fullPerson($name, $email)
    {
        $person        = new Person();
        $person-&gt;name  = $name;
        $person-&gt;email = $email;

        return $person;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We have a class called &lt;strong&gt;Person&lt;/strong&gt; which contains 2 private attributes: &lt;strong&gt;name&lt;/strong&gt; and &lt;strong&gt;email&lt;/strong&gt;. It also has 3 static methods: &lt;strong&gt;withName&lt;/strong&gt;, &lt;strong&gt;withEmail&lt;/strong&gt; and &lt;strong&gt;fullPerson&lt;/strong&gt;. These methods will behave like constructors.&lt;/p&gt;
&lt;p&gt;So if we want to create a Person object just with the name value, we can do it using the following statement:&lt;/p&gt;
&lt;pre class="code"&gt;
&lt;code&gt;
$person = Person::withName('Example');
&lt;/code&gt;
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/349770954" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F07%2F29-multiple-constructors-in-php</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/07/29-multiple-constructors-in-php</feedburner:origLink></item>
	
    <item>
      <title><![CDATA[7 tips to write intelligible code]]></title>
      <link>http://feeds.feedburner.com/~r/alfonsojimenez/~3/347391800/27-7-tips-to-write-intelligible-code</link>
      <pubDate>Sun, 27 Jul 2008 12:52:41 GMT</pubDate>
      <author>alfonso</author>
      <description>&lt;p&gt;&lt;img src="http://www.alfonsojimenez.com/images/2008/07/php_logo.jpg" alt="PHP" class="derecha_sinmarco" /&gt;Writing &lt;strong&gt;intelligible code&lt;/strong&gt; helps to increase the productivity of a developing team, even if you are an independent worker. Why is it so important to write intelligible code? How can it improve the productivity of my team? A messed up code could delay your partners understanding, or it could create a barrier for new developers. Even trying to understand your own code could be a real challenge as well. Here are 7 tips of how to make more &lt;strong&gt;intelligible PHP code&lt;/strong&gt; (&lt;em&gt;coding style tips&lt;/em&gt;):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;75-85 characters per line&lt;/strong&gt;: Each line must contains approximately 75-85 characters. If a line exceeds more than 85 characters, consider splitting the line into multiple lines. It will be helpful for code readability. You can see a great post on this topic in &lt;a href="http://paul-m-jones.com/?p=276"&gt;Paul Jones&amp;#8217; blog&lt;/a&gt;. He talks about why this limitation is not really arbitrary, and he puts some brilliant examples such as this one:
&lt;p&gt;&lt;em&gt;Bad&lt;/em&gt;&lt;/p&gt;
&lt;pre style="overflow: scroll;"&gt;&lt;code&gt;list($foo, $bar, $baz) = array(Zim::getVal('foo'), Dib::getVal('bar'), Gir::getVal('baz', Gir::DOOM));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Good&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$foo = Zim::getVal('foo');
$bar = Dib::getVal('bar');
$baz = Gir::getVal('baz', Gir::DOOM);
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Assignment statements&lt;/strong&gt;: Assignment statements ought be aligned for better readability. Let&amp;#8217;s see an example:
&lt;p&gt;&lt;em&gt;Bad&lt;/em&gt;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
$example = 'string_value';
$anotherExample = 42;
$exampleInst = new ExampleClass();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Good&lt;/em&gt;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
$example        = 'string_value';
$anotherExample = 42;
$exampleInst    = new ExampleClass();
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;4-spaces block indentation&lt;/strong&gt;: Use an indent of 4 spaces with no tabs. It helps to avoid problems with diffs, patches and SVN history. It helps the readability as well. Usually tabs are 8 spaces length, which means a 5th-block indent starts 40 spaces from the left border (nearly to 50% of a code line).&lt;br /&gt;
&lt;pre class="code"&gt;
&lt;code&gt;
{block1}
    {block2}
        {block3}
            ...
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control &amp;#038; conditional structures&lt;/strong&gt;: These statements must have &lt;em&gt;one space&lt;/em&gt; between the control keyword (if, else, for, while, &amp;#8230;) and the opening parenthesis, to distinguish them from function calls (which obviously don&amp;#8217;t have a space). It&amp;#8217;s nice to always use curly braces because they help to decreases the likelihood of logic errors.&lt;/p&gt;
&lt;pre class="code"&gt;
&lt;code&gt;
if ($display === 1) {
    while ($obj-&gt;next()) {
        echo $obj-&gt;toString();
    }
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Class and function/methods declarations&lt;/strong&gt;: Class and function/methods declarations have their opening brace on a new line.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
class Foo
{
    private $_obj;

    public function __construct($obj)
    {
        $this-&gt;_obj = $obj;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Comma-space between items of a list&lt;/strong&gt;: When we list some items, it&amp;#8217;s nice to separate them clearly with a comma followed by a space.
&lt;p&gt;&lt;em&gt;BAD&lt;/em&gt;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
$example = array(Foo::get('key',2),$value,true);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;GOOD&lt;/em&gt;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
$example = array(Foo::get('key', 2), $value, true);
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use constants properly&lt;/strong&gt;: If we have a method which returns some status codes, it&amp;#8217;s nice to use literal constants. Having descriptive constants helps to make better intelligible code. For example:
&lt;p&gt;&lt;em&gt;BAD&lt;/em&gt;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
class Foo
{
    public static function getStatus()
    {
        $res = 0;

        if (!self::isValid()) {
            $res = 1;
        }
        ...

        if ($res === 0 &amp;#038;&amp;#038; self::isRepeated()) {
            $res = 2;
        }

        return $res;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;GOOD&lt;/em&gt;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;code&gt;
class Foo
{
    const STATUS_SUCCESS  = 0;
    const STATUS_FAILURE  = 1;
    const STATUS_REPEATED = 2;

    public static function getStatus()
    {
        $res = self::STATUS_SUCCESS;

        if (!self::isValid()) {
            $res = self::STATUS_FAILURE;
        }

        ...

        if ($res === self::STATUS_SUCCESS &amp;#038;&amp;#038; self::isRepeated()) {
            $res = self::STATUS_REPEATED;
        }

        return $res;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;These tips are just some &lt;em&gt;coding style tips&lt;/em&gt;. If we really want to write intelligible code, we would keep in mind many more things like to use software patterns, to make use of well established software practises, &amp;#8230;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/alfonsojimenez/~4/347391800" height="1" width="1"/&gt;</description>
    <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetItemData?uri=alfonsojimenez&amp;itemurl=http%3A%2F%2Fwww.alfonsojimenez.com%2F2008%2F07%2F27-7-tips-to-write-intelligible-code</feedburner:awareness><feedburner:origLink>http://www.alfonsojimenez.com/2008/07/27-7-tips-to-write-intelligible-code</feedburner:origLink></item>
	

  <feedburner:awareness>http://api.feedburner.com/awareness/1.0/GetFeedData?uri=alfonsojimenez</feedburner:awareness></channel>
</rss>
