Sunday, November 25, 2012

Don't do it (share code).

"... You see, this profession is filled to the brim with unrealistic programmers. Programmers who thought their code would age like wine. If you mean it turns to vinegar, it does. If you mean it gets better with age, it don't. ..."

Marsellus Wallace (1994)

During my years as a software developer, I (and a lot of colleagues) have been thinking, talking and trying to figure out how to store and share our code. Code that we have spent time writing in the projects. I have always thought it would be nice if there was a common place to store stuff, to be reused in upcoming projects and shared between teams and local offices. That's a great idea, isn’t it?

No. It's not. It is actually a bad idea.

Recently I had a moment of enlightenment: stored code for later use is waste. When reusing code it creates waste and sometimes even confusion. Waste is expensive stuff. Confusion is risky stuff. Avoid it.

Here's an example:
Back in the .NET 1.1 days, do you remember what we needed to write to check if a string was null or empty? After a couple of projects I ended up writing a StringUtilities class with an IsEmpty method. Happy with the result I added it to a Common Utilities library in our version management system, for future use. If I remember it correctly, I also wrote my full name in the code comments section. (Today I don’t need that kind of confirmation. I have matured. I just settle with someone liking my current Facebook status.)

The next version of .NET of course had the IsNullOrEmpty method built in and that made my String Utilities code totally unnecessary. Too bad the class already had been reused all over the code base in an other project. And now people started to wonder:

- What weird stuff does that utilities code do? Why didn’t they use the built in method? Whatever. Better leave it as it is.

Another example:
Let’s say that we are about to write some c# code that should read RSS feeds and display them in a nice list. Before .NET 3.5, you would probably need to write a custom Feed class, a Feed Item class, and most likely a couple more of those custom classes. You would also need to write stuff that maps the RSS data with your custom classes. Once done, maybe it all should be stored in a Common Utilities folder for future use? 

Don’t do it!

Because in the future people will start to wonder:

- What weird stuff does that utilities code do? Why didn’t they use the built in SyndicationFeed class? I don’t understand. Better leave it as it is.

Both the string.IsNullOrEmpty method and the RSS Syndication namespace are part of the current .NET Framework. Code that is a part of the Framework is stable and (most likely) a lot more tested than our custom made ones.

Fine Code that we write today quickly turns into vinegar. Marsellus Wallace was right.

Okay, so Code is aging very quickly and that sucks. However, good ideas often stand the test of time. I think that we should rather share the ideas, and not the code. Use code only as an example to explain a concept. When understanding concepts, people will find better and modern ways to solve problems.

I think the same goes for Company policy Code Standards and Design Guidelines. Don’t spend too much time writing documents that will be buried forever in the Graveyard, aka the Intranet or Team Foundation Server.

The ideas and practices are better shared at informal lunch presentations and in blog posts. Maybe even in an Open Source project? Once the library or the blog post is out there, I mean really out there (outside the company firewalls and indexed by Google), it will be obvious to the world if it is fine wine (maintained) or vinegar (not maintained).

Got stuff to share? Invite your fellow geeks to a lunch session! Bring your laptop and start talking.

Mr Marsellus Wallace:

Wednesday, August 29, 2012

Rediscover JavaScript - Återupptäck JavaScript

Do you know the difference between x == y and x === y when coding JavaScript?
Don't Google it!

Next week I will talk about JavaScript at Add Your Color in Stockholm (in swedish). Didn't know the answer? Well, this session is made for you. 

Register at:



Vet du (utan att googla) vad skillnaden mellan x == y och x === y är i JavaScript?

Om du inte kan svaret, är första onsdagen i september hos Add Your Color rätt forum för dig! Under en kväll återupptäcker vi JavaScript som programmeringsspråk.

Anmäl dig här:


Sunday, August 12, 2012

The Developer that turned into a Garden Gnome

A couple of months ago when I was on my way to beautiful Sigtuna (the oldest city in the kingdom of Sweden, founded in 980), excited about having a session about those Agile principles all of us follow (right?), the bus passed a nice little yellow house with a nice little garden. I froze. Right there, staring at me was at least three small garden Gnomes.

I don't like garden Gnomes. They scare me.

There was probably more of them, I was too horrified to remember. Those lifeless gnome eyes really freaked me out. But were they really lifeless? What if each of those little garden gnomes once upon a time were full of life and actually had productive days, filled with joy and laughter? What if they once were software developers? When passing by all of this, I shivered and silently said "Oh, my God...". I think the old lady with the little beige hat in front of me heard that. Did I see her nod, confirming that my assumptions were correct?

When the bus arrived to the conference centre in lovely Sigtuna I quickly shook it all off, and spent about two hours having interesting conversations and valuable sharing of agile ideas. Shortly after I had forgotten all about garden Software Developer Gnomes.


The Summer! The Holiday! The time for resting the Mind and feeling ashamed of the chubby and lack-of-sun-exposed Body. During my daily holiday workout, i.e. Power Walking through the country side and passing by cows, sheep, horses and very few neighbors in sweet Värmland (where the people talk with that funny and lovable Swedish accent, you know), I walked by a little yellow house. My mind in workout mode and my ears filled with the latest Nas Album (damn good album, by the way), I saw something at the corner of my eye. A Gnome. It was just standing there in the garden. Staring at me. It freaked me out.

It all came back to me, the lifeless eyes, the little garden with the yellow house, the software developers. What really happened to them? I think we have the right to know. Right? This time I looked back at the Gnome, probably with "why???" written all over my face. Maybe I've had too much of that country side fresh air (and perhaps too much of the boxed dinner wine the night before), but I thought I heard the Gnome actually talking to me. Saying: - It's My Job

Aha, that one (and a couple of variations of it) I've heard before. I could now in fast forward mode easily imagine the Transformation from the It's My Job Developer to a staring Gnome in a little garden by a little yellow house.

I kept on Power Walking passing by the house, with loud Rap music in my ears. Maybe this is what we need to do, Power Walking our software developer careers? Keep moving, learning new things. Not necessarily listening to Rap music. Not necessarily being the passionate guy that develops Open Source software during holidays and weekends. Well, Passion probably is required for this kind of job, don't you think? What about that night time/weekend coding? Don't choose it before your family. But do Power Walk with Passion.

Sounds stressful? Come on, it's walking! You set your on pace, as long as it is a challenge. It's not like running the Marathon. I think stopping, however, should cause you panic. It actually should freak you out. The Gnome Transformation might be quicker than we expect.

Learn and expose yourself to knowledge the Power Walk style and start today. There already are too many of those little creepy garden Gnomes out there. Please don't turn into one.

 (swedish version)

Utvecklaren som blev en trädgårdstomte

För några månader sedan, när jag satt på bussen på väg till Sigtuna (Sveriges första stad), hände något märkligt. Jag satt där på min plats och repeterade presentationen om agila metoder som jag skulle ha på en kursgård i närheten. Bussen åkte sakta förbi ett fint litet gult hus, med en fin liten tomt. Jag hoppade till. På gräsmattan stod (minst!) tre trädgårdstomtar utplacerade. De stod där och stirrade.

Jag gillar inte trädgårdstomtar.

De där livlösa figurerna gjorde mig faktiskt rädd. Djävligt rädd.

Bussen åkte vidare och jag pustade ut. Tänk om de där små figurerna inte är så livlösa som man kanske tror? Tänk om de en gång hade helt vanliga liv: vaknade, jobbade, hämtade på dagis? Kanske var de alla systemutvecklare, någon gång för länge, länge sedan?

"Shit asså, tänk om det stämmer..." sade jag för mig själv där på bussen. Jag tror att damen med den lilla fyrkantiga hatten framför mig hörde, för det såg ut som att hon nickade åt mig. Som att hon ville visa att jag var på rätt spår.

Framme vid konferenscentret skakade jag av mig bilderna av de små tomtarna och spenderade de två följande timmarna med att dela erfarenheter med deltagarna på kursen. Efteråt hade jag glömt bort allt om små trädgårdstomtar som kanske en gång i tiden varit systemutvecklare.


Sommartider! Semestertider! Yes! Äntligen tid för återhämtning, vila och tillfällen att skämmas för sin bleka och otränade kropp. 

Det fina vädret och den friska lantluften har faktiskt gett mig inspiration att komma i form igen. Vid ett av mina dagliga träningspass, då jag "power"-promenerade förbi ett stort gäng kossor, några får och nästan inga grannar här i härliga Värmland, såg jag något bekant i ögonvrån. Jag ryckte till och slet av misstag av mig hörlurarna. Alldeles nyss var öronen fyllda med Nas senaste (bra skiva, förresten). Men nu: tystnad. Jag hörde bara min egen puls.

Där, vid ett litet hus, i en liten trädgård, fanns en trädgårdstomte. Den stirrade. Djävlar vad rädd jag blev.

Allt kom tillbaka: det gula huset i Sigtuna (Sveriges första stad), de livlösa ögonen. Systemutvecklarna. Men den här gången tittade jag tillbaka och jag måste ha sett ut som ett stort frågetecken. Jag har kanske fått lite för mycket av den där friska luften på landet (kanske också något glas för mycket av middags-lådvinet kvällen innan), för trädgårdstomten pratade ju! 

" - Jag gör bara mitt jobb.", sade den.

Aha, det där lät bekant. Nu trillade polletten ned och jag kunde lätt se förvandlingen framför mig, från "jag gör bara mitt jobb"-utvecklaren till en stirrande trädgårdstomte på en liten gräsplätt vid ett litet hus. Jag plockade upp hörlurarna och fortsatte träningspasset.

Det kanske är så man borde göra: Power Walk:a sig fram genom jobbet? Alltid röra sig framåt, lära sig nya grejer. Kanske inte nödvändigtvis med högljudd Rap-musik i öronen. Man kanske inte heller behöver vara den där extremt passionerade typen som hackar ihop ett Open Source-verktyg på kvällar och helger. Men jag tror att passion behövs för att hålla på med programmering. PWwP - Power Walk with Passion.

Låter det stressigt? Äh, kom igen nu. Det är inte Stockholm marathon vi snackar om. Välj ditt eget tempo, så länge det är en utmaning. Stressad borde man kanske bli om man stannar, förvandlingen går fortare än man tror.

Det finns redan för många av de där små läskiga trädgårdstomtarna där ute. Bli inte en av dem, för det är inte bara ett jobb.

Wednesday, August 1, 2012

aspConf 2012

It's about two weeks since aspConf, the online .NET developer conference, took place. This year had thousands of registered participants and about sixty booked speakers. I feel honoured being one of the speakers of aspConf 2012.

Check out the great stuff published at Channel 9, lots of interesting talks with a wide range of subjects within the .NET developer world. Is there an easier way to learn new things than this? 

My talk Quick Start: Test Driven Development was just published. Lots of thanks to all of you that joined the session! Have a look, please give your feedback and rate the video. Don't hesitate to contact me if you have any questions about Test Driven Development! 

För snart två veckor sedan kunde man följa aspConf - en utvecklarkonferens på nätet. Årets konferens hade sextio talare på schemat och flera tusen anmälda deltagare. I år var jag en av talarna och det känns stort att ha varit med på detta. På Channel 9 finns nu massvis med bra videor att kolla in, ett enkelt sätt att lära sig nya grejer!
Nu finns även inspelningen av min presentation Quick Start: Test Driven Development publicerad. Stort tack till er som följde den direktsända presentationen! 

Titta, ge din feedback och betygsätt gärna videon (den är strax under en timme lång). Hör av dig till mig om du har frågor om testdriven utveckling!

Saturday, June 23, 2012

It's Not You, It's Me

The other night I was browsing some of the local computer hardware online stores. It was a rainy (or was it sunny?) sunday night (or was it afternoon?). Aware of that it was only two days before the Apple WWDC event, I bought a new Ultra thin Ultra light Ultrabook (or was it a Notebook?). The purchase was made from my not-so-thin and high-fan-speed burning-hot laptop Macbook Pro First Generation Unibody Series. What about the new one?

No, It had no apples.

Yes, It was a rebel act.

I got carried away and made secret plans: “- I should go even further with this and install Ubuntu on it! Linux is cool.”. Man, I wish I had one of those Che Guevara T-shirts to wear that late rainy sunday night in Stockholm.

Later we had The Talk, my Apple Computer and me: “ - MBP, I think we need a break. Yes, I’ve met someone else. I have to find out if the grass really is greener the other side of the source code. It’s not You, It’s Me!”. It had to be said. I had to do it.

Tomorrow is Reboot Day! Time to install Ubuntu 12.04 on my brand new Core i7 Ultra Thin Ultra Light 15” Samsung Series 9. See you later Apple Macbook Pro. 

Actually, I already have installed Ubuntu. I couldn't wait. Friday, between 12 am and 2 am was The Real Reboot Day. To an external SSD. The internal one still has the pre installed Windows on it. I develop .NET stuff and gotta make a living! Well, that was actually not the entire truth. I had to buy a Windows Professional upgrade, the pre installed version from Microsoft could not even join a domain. The Man always wins.

But in the couch at home the rebel act flourishes. I run Ubuntu from the external SSD, download stuff from the Ubuntu Software Centre and wear that Che T-shirt. Okay, that last thing I made up. The Revolution continues (or is it just a dream?).


By the way, is it possible to dual boot the Nokia Lumia 800?


Friday, June 8, 2012

Code Food

Recently I got the chance to develop some really nice html5 features, learn new concepts and write code according to those strict JavaScript Douglas Crockford practices that I am a huge fan of. I want to share this knowledge, but how and when?

Most projects I've been a part of during my career has been sort of a silo development environment: experts doing this, other experts doing that. And when they finally meet it’s called “the Integration phase”. Sounds familiar?

I think silo expertise is bad, really bad, because nobody in the project will get the big picture.  When panic hits the project plan (it always does), developer X probably will need hours to figure out what developer Y has written. Start counting the number of WTF’s per minute! Who's paying for that? How can we break this Team Anti Pattern?

Here's a simple idea: have some lunch. Eat, drink and talk with your team - at least once a week. One of you will have something to share, maybe new insights in html5 development or a Visual Studio add in that makes our coding days brighter. It’s not a presentation, it’s just you talking about what you have learned the last couple of days while working in the project. The Project budget can probably afford to pay for the lunch session. If not, go get some pasta salad for your friends, bring your laptop, speak about something during 25 minutes and expect to be served lunch by one of your team members next week. Feeling hungry?