This blog contains reflections and thoughts on my work as a software engineer

Viser opslag med etiketten best practise. Vis alle opslag
Viser opslag med etiketten best practise. Vis alle opslag

tirsdag den 10. marts 2009

Why developers love a big whiteboard

If you ever wondered why developer's love for whiteboards is so passionate you get the answer here:

http://www.agile-software-development.com/2009/03/power-of-whiteboard.html

I like the last comment best:

"Tools can certainly help to organise information more efficiently. But I would challenge any tool to do all of that! I'm not against tools. Not at all. But I think they should supplement the whiteboard, not replace it. Tools should be used for things they can do that a whiteboard can't. For instance, keeping track of longer lasting information, doing calculations, searching, etc."

Question, just out of curiouosity - it might even be a little stupid but here goes: Did you ever work somewhere (as a developer) where whiteboards were regarded as You Ain't Gonna Need It ??

Regards K.

mandag den 2. marts 2009

Code reviews done "right"

This is the second post in a series of posts related to 10 things I don't believe in.

"I don't believe in code conventions" - hmm... Did I really write that? How can reviewing code be bad? It's not, actually. Code reviews can be beneficial if they are done right because to have someone review code you have written is one of the top 3 things you can do as a software developer to improve your skills. It's just the way things work - you can be a winner in life, in love and in any Xbox game by not repeating your mistakes more than once - and you will be a pitiful looser with no friends and no money if you have one success and spend the rest of your life doing whatever made you a success in the past over and over again.

When I think "code review" I think:

  • Get a timeslot in everyone's calendar and book a meeting for i.e. half an hour or an hour
  • Once at the meeting: Get everyone lined up in front of a projector
  • Pick some code from the project you're working on
  • Have the person who wrote it to walk you through
  • Feedback

95% of all the formal code reviews I have ever attended followed that prescription - and it never really worked out the way it was intended for the following reasons:

  • Get a timeslot in everyone's calendar and book a meeting for i.e. half an hour or an hour
    • Developers hate meetings. It takes time from their coding, quite literally. Developers don't like to be interrupted unless they feel an urgency to attend the meeting - and code reviews aren't percieved as something you'll die of if you don't get your weekly dosis.
  • Get everyony lined up in front of a projector
    • The more formal the approach, the merrier. There might even be some sort of agenda: "Class X: 10.00 A.M, Class Y and Z, 10.20 A.M. T-SQL changes 10.40 to 11.00 A.M"... Let's see some code, right?
  • Pick some code from the code you're working on
    • Is everyone working on the same project? If yes that's fine - proceed. If no, you'll lose every single developer who hasn't been actively committing to the code you've picked. People just don't feel committed to concentrate on understanding Javascript if they regard themselves as being primarily Database guys. And the clientside guys and gals don't have much input to a discussion about classes not implementing IDisposable in a correct manner.
  • Have the person who wrote it walk you through
    • Being up on the stage in the spotlight takes some balls to everyone who isn't used to being looked at - you're in a very vulnerable position up there. Also having to communicate some crappy code you wrote in front of perhaps some senior developers who you know have at least a dozen better ways to implement a variation of the combined Visitor / Strategy pattern you've been working on can be frightening.
  • Feedback
    • If basic trust and respect between the parties attending the code review aren't there code reviews can actually do more damage to team morale than anything else because creative people (like developers) tend to block their minds when being critizied because they put so much of themselves into their work. Even if a developer has got the arguments to prove his way of doing things he might not be able to communicate well because of the spotlight and the crowd of people staring at him.
    • If feedback to code reviews aren't backed by i.e. code conventions or architectual documentations in terms of "this is how we do things here when we deal with datetime formatting" they will mostly be based on personal bias towards a solution you like better - not necessarily the right solution for the problem at hand. That's the way it works in real life if there are no code quality measures beyond the team that the code should live up to.

Only very mature teams can handle a code review which includes a projector, I think. And why, why, why make things so complicated? Why call everyone in and disturb everyone because "code reviews are important"? When I want my code reviewed I do this:

  • Write some code
  • Ask anyone of my collegues to look it through
    • He or she moves to my desk and we sit down together and go through things together
    • We might refactor while pairprogramming
  • Put my taskcard on the "To be verified" column on our sprint board

This informal approach has a number of advantages: It doesn't feel like a code review. You don't get to attend meetings which you feel eats away your coding-time. Nobody is put up on a stage and asked to speak loud and clear because there are 6 people sweating and a projector humming in the background. Feedback happens informally and instant - and you feel safer walking through the code because it is fresh in your mind (you just wrote it, remember?). Feedback is also more valuable because it happens 1-1 in an atmosphere of "how do I solve this problem the right way". You're in problem-solving mode while sitting at your desk - chances are that you're not if you're being interrupted on-stage while trying to remember why class X implements interface Foo instead of the more general interface Bar.

Martin Fowler once wrote that If it hurts do it more often. If code reviews don't feel right you're doing it wrong - and probably you should begin by loosen up the tie and try a less formal approach because informal approaches always works the best while dealing with developers.

Until next time...

Regards K.

mandag den 18. februar 2008

How to share knowledge amongst teammembers

I had an idea today - it was triggered by the countless number of Emails flooding my (and my teammember's) Inbox. The problem as I see it is not that people send Emails - that is perfectly fine. The problem is that they often send me valuable information which I have a hard time backtracking when I need the information 3 months after I recieved the Email....

I tried figuring out how to avoid this scenario and came up with a few stories:

S1: A user should be able to save valuable information received by Email
S2: A user should be able to search through stored information
S3: No anonymous access to the information should be possible
S4: The cost in time of storing information should be very close to zero to assure that the shared container of information will be updated frequently.


I think we actually achieved all goals in a matter of 2 hours work... How did we do it? Well, Uncle Google to the rescue:

I had an idea that saving everything in a private blog could be the silver bullet for us and ensure that story S1 and S2 was easily solved so I created a GMail account which could serve as a shared login to ressources hidden behind the login. I quickly set up a blog and clicked around a bit to ensure the privacy of the blog (no search engine should index the content, no pingback to tracking sites etc.). Then I changed the blog from being open for anybody to only being open to the people I invited. Everything went fine - until I discovered that RSS is not possible for a private blogs... Oooops. That wasn't part of my master plan at all because I always had the idea that invited people should be able to subscribe to the RSS-feed of the blog.

I tried fiddling around Google to see if I could establish a workaround but I discovered that due to the nature of RSS it is not possible to validate the viewers... Bugger, bugger, bugger, bugger, bugger... I knew for sure that my idea required that viewers should be notified somehow whenever new content was added otherwise the Email-hell would continue.

I actually thought that my idea was going down the tubes until I discovered that Blogspot has this nice feature called Mail-To-Blogger. When you want to add something to the blog you could simply do it by Email to make it magically appear on the blog! Voila, problems solved...

I set everything up and now whenever somebody in our team has something they want to share with us ("I updated the server X with patches Y and Z - it shouldn't have any effect on process B but be aware anyway. Read about the patches here" (where the link is the valuable information nobody can find 3 months later) they send an Email to each of us as usual - but they also send a CC to a special Email-address to save the Email in our private blog. If I recieve something such as a new password to a service we use I send it to this Email to ensure that when I go on vacation nobody is stopped in their work because the Email is located in my Inbox only. Sweeeet.......

Security? Well I have made a lot of effort to turn off RSS, to explicitly tell Google to NOT index anything on the blog etc. The content of the blog is viewable only to the people I have sent invitations to - the Gmail-account which was used to create the blog has been shared between all members so everybody are able to administer the blog. Does anybody have any experience with private blogs and how private they really are? Please let me know if you do.

We will evaluate the blog in a few weeks time to see if we have had any value out of it. The Email-hell is still there but Emails are not bad just because they are Emails. They only become a living hell when you as a user are unable to find that single Email which contains information you need and that's the problem we are trying to solve right now. I will get back to you with an update when we have more experience on the subject.

torsdag den 20. december 2007

Constant requiring explicit parsing == evil

I'm working on a project which includes the use of a service-enabled image uploader and imageviewer. The service defines a load of constants and properties in web.config which is fair enough.

However, when porting the assemblies to our local machines (we run all services, source and subsystems on our local machines to be able to work truly disconnected) we discovered a strange error while attempting to upload a test image to our service. Due to a lack of logging within the imageservice itself the cause of the error wasn't appareant at first but a quick review with the programmmer in charge of the imageservice reveiled that it was an issue with the configuration file.

One of the constants in the configuration defined a maximum height and width of an image being uploaded. If the size exceeded the maximums defined the upload would be rejected. The constants were defined in this way:

1024;768

What made the imageservice burp on our local machines had something to do with our regional settings which caused the configuration to try and interpret 1024;768 as an integer.

With our retrospective cap well in place what could / should have we done better to avoid such a problem from occuring?

- Never define constants which require explicit parsing to become valid
- If you decide to do provide detailed logging before and after the parsing occurs
- Take into account within your software that machine regional settings are - well, machine dependent ;o)