Archive for the 'programming' Category

Published by Fabian on 22 Jun 2010

The Ideal Scrum Team

Last Friday, at our Meet The Experts conference, somebody asked what would be the ideal SCRUM Team.
I found that especially interesting as it mirrors the question of MMORPGs: whats the ideal group to beat XYZ Instance.

And I think the answer is exactly the same in both: It depends. Many combination’s can be successful. Even some exotic teams can make the impossible. It also depends on personal skill and dedication to the course.
But yes there are general recommendations. In an MMORPG you often need somebody…

  1. … keeping all the bad guys away. Taking the beating (the tank).
  2. … caring for you, healing your wounds. Saving your life (the healer).
  3. … attacking the troublemakers. Earning the glory (the damage dealer).
  4. … helping all the others to do their role better. Unsung heroes (the supporter).

For SCRUM Teams this is pretty much the same. You need various skills. Programming skills solving the issues and testing skills making sure you don’t blow up. Caching skills to help the team perform better, and documentation skills to make sure the project isn’t hit and run.

Side note: Somebody was missing form above. The Quest handing NPC. Which would be of course the Product Owner :)

For me the SCRUM Master would be the Tank, holding all the trouble away from the team. Frankly, this was not completely my idea, as Charls Miller from Atlassian blogged about holding Aggro before.

You do not need an ideal team. You need a team to get work done.

Published by Fabian on 17 Feb 2010

symfony core team meets again at symfony live 2010

First day of the symfony live conference is over. Many interesting talks from today and more for sure to follow tomorrow.
In our core team panel, Fabien already spilled some beans on the upcoming symfony 2 alpha release. If you missed that, I wont repeat it sorry :-)
prepare for the big news tonight when Fabien has his “revealing 2.0″ session.

bayarsaikhan took a great picture of the core team on stage:

From Left to right:

  • Bernhard Schussek, who works on Lime2 and Forms2
  • Stefan Koopmanschap, who is our Community Relations Manager (the one who buys beer)
  • Me, currently busy with Ticket Management and fixing the 1.x branch
  • Fabien Potencier, symfony Masterbrain
  • Jonathan Wage, our ORM expert developing Doctrine 2
  • Dustin Whittle, working for Yahoo and keeping an eye out on the big Web/Enterprise world for symfony
  • Kris Wallsmith, very busy with being Release Manager for our currently supported 1.3 and 1.4 release

Published by Fabian on 13 Jan 2010

Ugliest Code of the Year

Usually I rant about code from others. But this is something different. this is my code:

PdfPCell pdfPCell = table.getRow(0).getCells()[0];
List compositeElements = pdfPCell.getCompositeElements();
Paragraph p = (Paragraph) compositeElements.get(0);
Chunk c = (Chunk) p.get(0);
Jpeg jpeg = (Jpeg) (((Object[])c.getAttributes().get("IMAGE"))[0]);

Now comes my excuse for this crap. I need to parse this HTML and render it in a PDF (currently using iText):

<table cellspacing="0" cellpadding="0" border="0">
<td width="1%"><img height="100" border="0" width="150" src="/pat_to.jpg" /></td>
<td>some fancy text</td>

iText cannot automatically resize columns. So the column needs an explicit width. I don’t know the width of the table, because its not on the page, so I need the page width. I need to delve into the cell of the table which I know to contain the image. I need to know that its an Jpeg and that it had no alignment because if it had it would not be wrapped as chunk in a paragraph.
This is among the ugliest I ever wrote. But now my excuse. It is not my faul :)

The iText API (in 2.7.1) is not consistent at all, you have Arrays, Lists, Maps mixed and matched, keys as String, Constant (public or private constant) or no keys at all. Properties of images stored for each type in a different way. And you need to know a lot on yout parsed html structure, because iText cannot discover it. The way the HTML parser is implemented is way to basic and not extendable.

Currently thinking about switching to POI or rewriting the iTextParser….

Published by Fabian on 01 Dec 2009

Today is symfony Project Day

Last night I hung out with Fabien, Jon and Kris on IRC, preparing today!
Here the results of our hackathon

We all hope you enjoy our stuff hand have productive days till Christmas.

Published by Fabian on 26 Nov 2009

Management logic?

on one of my projects we introduced scrum… ok lets be honest, we are doing “scrum … but”. But we are now able to deliver much more than before, and the effort = money spend on each feature has decreased. However we track that we talk more than before. We do standups every day, and once a week a planning session (either backlog with the PO or sprint with the SM) and we are doing retrospectives.
But somehow the higher level management is unhappy. They tell us we spend to much time on “communication”. They are very much happy with our productivity though.
Might be that they have not realized that the increased communication time is related to the increased productivity?

Published by Fabian on 01 Nov 2009

Why do people code like that? And how do you review it?

if (!""==paramString.trim() && paramString.trim().length() > 0 && paramString != null)

I do like to coach colleagues and totally stangers in writing good code. I believe there is also a lot I can learn.
My colleague Thomas tweeted:

unless(!disable_message_hiding) {...}

quad negation. !@#$@# (via @mhevery)

I think I could have done this myself some time ago. You have to learn to avoid negations so this doesn’t pile up like that. I can understand that somebody might have coded that.
But coming back to the line at the beginning of this post:

if (!""==paramString.trim() && paramString.trim().length() > 0 && paramString != null)

How can somebody write this code? Obviously not test driven, because test would have showed that this code is actually mostly nonfunctional.
Ok, when beginning with Java it can happen to you that you check String equality with == and not with String.equals(). Interestingly this does work quite often (but people don’t know why).
trim() shows already some more advanced understanding, because why else would you understand that you want to remove spaces from the string first.
But after having understood that we need to trim() before comparing to empty string, why the additional length check?
And why the hell the not null check? I suspect there was once a stacktrace in the log and this was supposed to fix this. Obviously in reality this method almost never gets null.

So: How could this code have been created? I think the author had no understanding of what he was doing there.

if (paramString.length() > 0)

is code Newbies would write. Its not bad. it is actually covering most of the normal cases. It is almost not worse than the previous example but much easier to read.

Such “empty String” checking is almost in every code. This is why commons-lang provided us with something neat:

if (! StringUtils.isEmpty(paramString))

How do you handle talking about bad code in code reviews? Pair programming?
I found it hard. So i decided to go the way Douglas Crockford goes when he talks about JSlint:

JSLint will hurt your feelings.

I say: “that code makes no sense”, “that code is stupid”, “that can be done way shorter”, “code repetition – thats evil”.
It is like the standard measure for code reviews:

WTFs per Minute

WTFs per Minute

I usually try to avoid to call the author stupid. But I try also to be very clear on the code. Usually it helps showing how this can be done much better.
Can somebody recommend a paper or book on the topic?

Oh, in case I did review your code and say something nasty: I apologize. I want to make the code better. I want us all to produce better code. Better code saves us weekends!

Next »