January 17, 2010 by tuxbear
I have been coding for some years now, and I have learned a lot the last couple of years. One of the most useful term I have picked up is the term Technical Debt. This weekend have been a reminder of how high the interest rates of technical loans really are.
Back in 2005 I wrote a complete CMS in ASP.NET for the company my mother and step-father owns. I had never done ASP.NET before, and design patterns was not something I cared to much about. The result was a working site! I learned a lot about .NET, C# and ASP.NET. I can remember how satisfied I was about the site. It boats multiple language support, automatic barcode generator and loads of cool features. Job well done!
This weekend my impression changed. I had to revisit the codebase; there were some new requirements, another thing I have learned to be inevitable. So I fired up Visual Studio knowing that this would get ugly, but I never thought it would be this bad. While trying to read the code I had to shake my head in frustration over 2005-me. The list of horrifying properties of the codebase includes but is not limited to
- No models
- No separation what so ever
- Zero tests – and also, no documentation
- Virtually unreadable code with methods the size of the Amazon River
Among my findings was a single method counting 150 lines of compact code. This was done directly in the code behind, of course, and the whole thing is sprinkled with direct calls to the database. The SQL queries were just as bad, and string.Format was not yet discovered. I must admit that my brain shouted “Redesign!” a couple of times, but I managed to shut it up and dive into the “code”.
It took me about 2 hours to get to the point where I knew what to do with the code to implement the new feature. It took another hour to identify the parts of the site that would be affected by the changes I were to make. I can’t help but feel a bit sorry for past-me. He didn’t know any better, so I guess he’s excused. But I am stuck with paying for his inexperience with my precious time, and so this whole post is a BIG NOTE TO SELF:
Dear self,
please minimize technical debt. Write clean code. Write tests. Don’t borrow time from the codebase unless you have no other choice. And if you do, pay it back as soon as possible. Someone will have to pay, and the longer it takes, the bigger the interest overhead gets. The result of long term technical debt is net loss of time. Time is a scarce resource; please minimize technical debt.
Posted in C#, Lesson Learned, Personal, Technical Debt | 1 Comment »
This weekend has been great. On fridayEline met me after work to go shopping for a new digital camera. She ended up with a really pink camera, and I ended up with a Xbox 360 PRO
It was not really planned, but I have been wanting a Xbox for quite some time now. When I saw that they had the Pro version (the one with HDMI and a harddrive) on sale I just had to buy it. So there goes the weekend. Bought GTA 4 and loving it
I just wish the wireless device for it wasn’t so expensive. I don’t wanna drag a cable around my livingroom (read: Eline wouldn’t allow a cable through the livingroom).
On another note Hønefoss won 6-0 in a football match against Moss yesterday. I saw the match on NRK WebTV (the stream all the matches from Adeccoligaen). This places Hønefoss on 2. place, 3 points behind Songdal. It would be truly epic to see Rosenborg on AKA Arena next season!
Tonight I’ll have to take a break from playing Xbox to see Vålerenga play against Tromsø, It should be a good match, and Vålerenga will win 2-1
Posted in Hønefoss, Personal, Vålerenga, Xbox | Leave a Comment »
The first SCRUM sprint of my life is over, and it was a very successful one. I learned a million things, and completed all my tasks on time!
Aside from actually completing all my tasks, I am very proud that all my production code has 100% test coverage, and was written using pure TDD, strictly following uncle Bob’s three rules of TDD. I also followed a lot of the principles from uncle Bobs book Clean Code. My code needed almost no comments, in fact, I can’t remember writing a single one in production code. Knowing that I have come one step closer to beeing a software Craftsman makes me proud of my self and my work. I want to be proud of the code I make. The ultimate goal is to sometime in the future be able to write straight down sexy code. Something you take a look at and say “Yeeees, that’s hot”.
I am very lucky to have gotten this job this summer. Capgemini is a nice place to be, with kind and helpful people. The other interns are great aswell, and we work very good as a team. Couldn’t have asked for more
So to something completely different: I got a new part-time job for this fall
I will be quitting my job as manager of gurutjenesten and start working for Star Information Systems AS. This is a more relevant job for me in the future, as this is a software developer job. I hope I can draw alot of experience from my summer job and bring it into my new part time job. I of course also will bring with me my new found love for Software Craftsmanship, and produce quality soultions and try my best at creating long-lived value for my employer.
Posted in Capgemini summer of code, Personal, SIS | 2 Comments »
The first few days on my summer job at Capgemini has been great. The learning curve is steep, but I am enjoying it. The project we are working on is also very very cool!
The first day on the job was spent getting to know the other members of the team and getting some basic introduction to tools and methods that we are going to use during the project. The project has an extra challenge to it because we are a team of eight working in two different places. There are five of us here in Trondheim, and three fellow team members in Stavanger. We have only met through a mysterious device known to me as “The eyecatcher”. We arrange daily SCRUM standp meetings with this “window to Stavanger”. It is working out nicely so far.
Yesterday and today I have been reading source code. Gøran had already started coding and he is using a design pattern known as MVVM.After several hours of reading, watching videos and implementing the pattern in my own Stock Trader program, I am finally starting to get a grip of what this MVVM is all about. For our project we are using a slightly extended version of the MVVM pattern, maybe I’ll come back to that in a later blogpost.
What I definitely will come back to what the project is all about, as I’m not sure when we go public with the process. All I am willing to say now is that it is going to be an open source .NET WPF/Silverlight suite of apps for professional developers. The project is sponsored by Capgemini in what we call Capgemini summer of code, to give the project a flying start before it hits the Internets hard as a hydrogen bomb
Posted in Capgemini summer of code, Personal | 1 Comment »
When reading the excellent F# book “Expert F#” I came across an a great example of a core principle in functional programming.
Consider this function in F#:
let two = Console.WriteLine(“Getting two”)
1+1
let four = two + two
The two function has a side effect, it writes “Getting two” to the console. Functional programming languages is not meant to be used with side effects, and this produes this(surprising) output when running the function four:
Getting two
4
One can clearly see that the function two is only “called” once. What happens (if I am getting it right) is that the value two is evaluated ONCE. As it have no parameters, it will never change. F# knows this, and does not bother with evluating the value of ‘two’ more then once, it’s the same value anyway. If you put a parameter into two’s definition, you will see “Getting two” two times. This would not be possible with C#.
Posted in C#, F# | Leave a Comment »
I have been playing with VS 2010 the last days and I must say I like it. But I need a new computer to get a smooth experience!
Invisual studio it selv there are not that many changes. There is the new startup window, but that’s really not very innovative. Most of the GUI have switched to using WPF. You can see it (un)clearly because of the CLearType issue with WPF. My computer does not like WPF all that much, and it slows down VS alot. This proably means that I need a new computer, even though It is a Core Duo 2GHz with 2GB ram it’s not enough anymore. More on my new computer later
What is innovative and really cool and helpful in VS2010 is the new debugging windows for debugging concurrent applications. The debugging window will let you swtich context between threads and have realy good support for the new Task concept in .NET 4.0. From there on out the changes in the language (C#) and the changes from .NET 3.5 to 4.0 are the ones I find most interresting.
The support for dynamic objects is really neat (allthough I had some trouble finding IDynamicObject as it has been moved to System.Core, and you now can inherit from DynamicObject). I have submitted a feature request for Intellisense on the dynamic feature of C#. I would like Intellisense to help me type, even if it does not know for sure that something exists in an object. For example:
dynamic dyn = DynamicFatory.Create(“Sonar”);
dyn.PingSonar();
…
dyn. <— here I want Intellisense to suggest “PingSonar()” as I have already called that method on this object in this scope. It can check to see if the variable has been reassigned since the last call, and not suggest it if it has been reassigned. Some warning about this being an assumption can also be displayed. I have made a suggestion for this feature on Microsoft Connect. You can support the feature request here.
I’ll be playing more with VS2010 in the near future, and I’ll be posting more
Posted in .NET 4.0, C#, Visual Studio 2010 | Leave a Comment »
So I have permanently moved all my activities to WordPress. I am going to try and update more often, and put more of my projects up here
Tuxbear.com is now hosted by WordPress and I like it very much. My last homepage was home grown ASP.NET and it was FULL of bugs. I am putting p the white flag and scrapping the code. No remorse though, I learned a lot from doing it. I like learning by doing, and that was the right thing to do then.
No I can’t keep up with my own changes in the requirements, so I have descided to cancel the project. Hopefully that means that I will have more time toactually post in my blog
I have a new found passion for F#, and I will try to post some F# findings to help myself (and maybe others) in understanding F#.
Posted in F#, Personal | 1 Comment »