Archive for the 'programming' Category

Published by Fabian on 30 Jun 2009

State of the Art Dependency Injection for PHP

The second symfony component has gone live. It is the Dependency Injection Monkey. For me as a Java guy, who is used to Spring or Guice it is a relief to see that finally there is a compact and great PHP DI container available. If you never have heard about dependency injection (also called Inversion of Control) you should try to understand it. If you have and are developing PHP you should try the symfony dependency injection. Or better If you are on Java, try Spring :-)

Published by Fabian on 14 Jun 2009

Look Around!

symfonynerds has been running a survey. 250 symfony developers filled it out and the majority answered to question 8:

I have never developed in another web application framework

I consider this very alarming. If symfony is you first framework, then it should not be your last. Good developers need to know multiple frameworks, libraries, design patterns, concepts and so on. There is so much around that it would be very ignorant to stay with one player. You might be missing much better choices for other scenarios.

When reading the Whats new in Doctrine 2.0 slides I was very happy that Jonathan did look around. Doctrine 2.0 was redesigned to follow the Java Persistence API (and inspired by Hibernate).

This also brings up an interesting aspect of specifications: They are not only valid for the language they were designed for.

Published by Fabian on 10 Jun 2009

Adding Javascript Event Handlers in Element Constructor

When replacing large server side generated structures with JavaScript generated elements, I found the “new” style of Prototype very convenient:

new Element('div', {
                 'class':'tooltip',
                 'style':'height: '+tooltipHeight+'px;',
                 'onClick': 'closeTooltip()'
                 })
            .update(tooltipText);

What I did not notice that this doesn’t work in all browsers. When then, after a while, checking cross browser compatibility, I wondered why the closeTooltip method was not called. It was called ok in Firefox. It shouldn’t have worked in Firefox, because it is actually the wrong way to register an event listener.
The correct way is:

new Element('div', {
                 'class':'tooltip',
                 'style':'height: '+tooltipHeight+'px;'
                 })
            .update(tooltipText)
            .observe('click',closeTooltip);

I assume that Firefox does scan the attributes of JavasScript generated nodes for event handling code, while the Internet Explorer does not.
The W3C DOM Level 2 Specification on event listeners says:

In order to achieve compatibility with HTML 4.0, implementors may view the setting of attributes which represent event handlers as the creation and registration of an EventListener on the EventTarget.

While all browsers do that consistently for generated HTML, it seems that it does not apply to JavaScript generated elements.

Perhaps Prototype people could add a note to the Element documentation (or document writeAttribute at all :-) )

Published by Fabian on 15 May 2009

Symfony components site launched

Fabien today activated Symfony components, a sub-project of symfony which aims at delivering high quality reusable components without dependencies. This is a bit more like the Zend Framework idea, but makes standalone components, not ones with many dependencies. They also power the symfony framework.

The website is really appealing, great layout and a crisp and clear design. Congratulations Fabien, keep up the good work.

PS: I really like the cartoonic animals you have chosen. Awesome!

Published by Fabian on 04 May 2009

Incremental and Agile Design Built in Lego

Lego Experiment, copyright it-agileI just wanna make sure you check this experiment done by a company called it-agile. It is an incarnation of the famous software-construction metaphor. And it shows how refactoring could work out when building a castle.
The most interesting part is the video they created out of many snapshots after each iteration.
An iteration was 30 seconds, and people could do refactorings, or new construction or actually what they liked.
I did a few myself, as this experiment was done at the JAX conference in Mainz.
There were three releases:

  1. Day: Build a castle
  2. Day: The Emperor decided that castle construction was not proceeding well, so he set up a priority list for walls, entrance and balcony.
  3. Day: The big changes of the 2. Day already resulted in something the royal family could live with so the third day was about brushing everything up and making it nice.

What this experiment shows clearly:

  • without correction, projects tend to go into the wrong directions
  • simple guidelines and refinement of them makes it much more structured
  • refactorings are seldom done, but they can improve a lot

Any more lessons you can take from this?

Published by Fabian on 21 Apr 2009

Blogging live from JAX

I am currently standing at out booth in the Rheingoldhalle in Mainz, where the JAX 2009 is taking place. Quite an amazing amount of high quality talks, and good talks and networking inbetween the session. codecentric is silver sponsor, we are having three nice sessions for you to attend and are also blogging live from here, and advertising meet the experts.

I already had a great talk from Angelika Langer which caused some worries about concurrency in my mind, and a talk about jBPM which looks really like a BPM solution one can include in an existing Java Architecture. I especially liked that you can JUnit test it.

Tonight we will have dinner at the famous Waldgeist Hofheim, where you can get a 2.5 kg Schnitzel! Hmmm tasty :-)

Update
Mirko just put up a new blog posting on our company blog including a nice picture showing us at our booth. I shamelessly copy it :-)

« Prev - Next »