Just Did the String Calculator Kata

Just Did the String Calculator Kata Published: Oct 8, 2009 Source: https://khebbie.dk/just-did-the-string-calculator-kata/ I just did the [string calculator kata](the string calculator kata ), here is the output, first the test code: [TestFixture] public class CalculatorTests { readonly Calculator _calc = new Calculator(); [Test] public void Add_WhenGiven1_ShouldReturn1() { int result = _calc.Add("1"); Assert.That(result, Is.EqualTo(1)); } [Test] public void Add_WhenGiven15_ShouldReturn15() { int result = _calc.Add("15"); Assert.That(result, Is.EqualTo(15)); } [Test] public void Add_WhenGiven1comma5_ShouldReturn6() { int result = _calc.Add("1,5"); Assert.That(result, Is.EqualTo(6)); } [Test] public void Add_WhenGiven115comma23_ShouldReturn138() { int result = _calc.Add("115,23"); Assert.That(result, Is.EqualTo(138)); } [Test] public void Add_WhenGivenAlphaCharacter_ShouldThrowArgumentException() { Assert.Throws<ArgumentException>(() => _calc.Add("jens")); } [Test] public void Add_WhenGivenAlphaNumericCharacterWithNumericAtTheEnd_ShouldThrowArgumentException() { Assert.Throws<ArgumentException>(() => _calc.Add("jens1")); } [Test] public void Add_WhenGivenAlphaNumericCharacterWithNumericAtTheBeginning_ShouldThrowArgumentException() { Assert.Throws<ArgumentException>(() => _calc.Add("1jens")); } } And here is the implementation: ...

October 8, 2009 · Klaus Hebsgaard

[DK]Uncle Bob om software projekter (min formulering)

[DK]Uncle Bob om software projekter (min formulering) Published: Mar 11, 2009 Source: https://khebbie.dk/dkuncle-bob-om-software-projekter-min-formulering/ Uncle Bob om software projekter: “Tit haster vi igennem for at blive færdige til tiden, og sjusker for at gøre det hurtigere. Men når vi sjusker os igennem opdager vi tit, at det sjusk vi lavede for at blive hurtigt færdig, er det der forsinker os og gør at vi bliver forsinkede.”

March 11, 2009 · Klaus Hebsgaard

Craftmanship over heroics

Published: Nov 28, 2008 I read a good blog post the other day (http://softwarecraftsmanship.oreilly.com/news/2008/8/8/uncle-bob-on-craftsmanship-at-agile-2008) It was a comment on a statment by Uncle Bob: “Craftmanship over crap”, but in the above mentioned blog post Dave Hoover modified the statement to “Craftmanship over heroics”. I have really taken this statement in, since it speaks to me. So let me explain to you what it means to me: ...

November 28, 2008 · Klaus Hebsgaard

Trying Out Ruby on Rails on Windows Vista

Trying Out Ruby on Rails on Windows Vista Published: Nov 14, 2008 Source: https://khebbie.dk/trying-out-ruby-on-rails-on-windows-vista/ OK, so I am not excactly an early adopter, but I had some time and had to try it out. First I followed this guide: http://wiki.rubyonrails.org/rails/pages/RailsOnWindows Then I tryed out the first chapter of “Rails for .Net developers” from pragmaticprogrammers. I must say that it really just works! Of course this is a really simple app, but scaffolding is a great thing for CRUD.

November 14, 2008 · Klaus Hebsgaard

Great Webcast on Test Driven Development

Great Webcast on Test Driven Development Published: Oct 1, 2008 Source: https://khebbie.dk/great-webcast-on-test-driven-development/ http://www.patchedsoftware.com/RailsEnvy-LoveTests.mov

October 1, 2008 · Klaus Hebsgaard

Polyglot Programming

Polyglot Programming Published: Oct 1, 2008 Source: https://khebbie.dk/polyglot-programming-2/ At Anug last time we heard about F# and functional programming. One of the things we discussed was polyglot programming: Could one do a website where the UI was in ironRuby or ironPython, the business objects in C# and the harder calculations in F#? Actually I brought this up, and nobody seemed to buy it. The reason people used was that you would have to be in a bigger enterprise in order to do this kind of polyglot programming, simply because it will be too hard to deal with all these different languages (Correct me if I got this wrong!). ...

October 1, 2008 · Klaus Hebsgaard

[DK]Easy Refactorings to Improve the Readability of Your Code

[DK]Easy Refactorings to Improve the Readability of Your Code Published: Sep 23, 2008 Source: https://khebbie.dk/dkeasy-refactorings-to-improve-the-readability-of-your-code/ I dette blog indlæg lægges op til løsning på nogle dagligdagsproblemer: Easy Refactorings to Improve the Readability of Your Code Problemet som behandles i inidlægget går på readability, og handler om følgende kode: adapter.OpenConnection(@”C:\data\records.mdb”, true, false); Det som forfatteren har imod koden er at det kan være svært at huske hvad parametrene betyder, når der kun kaldes med true og false. Så løsningen der bliver fremsat i indlægget er som følger: ...

September 23, 2008 · Klaus Hebsgaard

About Ruby

About Ruby Published: Sep 23, 2008 Source: https://khebbie.dk/about-ruby/ Since there has been so much hype about ruby, I thought I’d better take a look at it. I must say it looks really good. There’s two things i like about Ruby: Duck-typing So many times I have been trying to make generic functionality for classes I didn’t own. So in C# I have no chance of implementing a common interface. With Duck-typing that is now possible, since I find that common functionality and do Duck-typing. ...

September 23, 2008 · Klaus Hebsgaard

Asserts, Exceptions (and Validation)

Asserts, Exceptions (and Validation) Published: Sep 6, 2008 Source: https://khebbie.dk/asserts-exceptions-and-validation/ This blog post was originally created at 2008-09-06 At work we have had a bit of a discussion about Debug.Assert and Exceptions. With a little help from google and Steve McConnell’s great book Code Complete we have come to the following definitions: Both Assertions and Exceptions has to do with technical stuff. Business stuff should be handled by validation logic. Business logic should never appear in assertions and exceptions. ...

September 6, 2008 · Klaus Hebsgaard

Two Great Links

Two Great Links Published: Jul 29, 2008 Source: https://khebbie.dk/two-great-links/ Just a short post to show two great sites/tools/whatever: The Joel Test: 12 Steps to Better Code 12 things that your software organization should be doing in order to perform well… Programmer Competency Matrix A matrix where you can evaluate programmer Competency

July 29, 2008 · Klaus Hebsgaard