Arkiv for July, 2008

« Forrige indlæg |

BDD: Implementation og tilbageblik

Thursday, July 24th, 2008

Nedenfor er vist min første implementation af kode i EconomyDeluxe:
using System;
using Domain.Interfaces;
using System.Collections.Generic;
using System.Collections;
public class GeneralLedger:IGeneralLedger
{
private Dictionary _accounts;
public GeneralLedger()
{
_accounts = new Dictionary();
}
public void AddAccount(ILedgerAccount account)
{
if (account == null)
{
throw new ArgumentNullException(“Null account supplied”);
}
if (!account.IsValid)
{
throw new ArgumentException(“Invalid account”);
}
if (_accounts.ContainsKey(account.AccountId))
{
throw new ArgumentOutOfRangeException(“AccountId is already present”);
}
_accounts.Add(account.AccountId,account);
}
public void DeleteAccount(ILedgerAccount account)
{
if (account == null)
{
throw new ArgumentNullException(“Null account supplied”);
}
if (!_accounts.ContainsKey(account.AccountId))
{
throw new ArgumentOutOfRangeException(“AccountId [...]

BDD: Interfaces og Mocking

Wednesday, July 23rd, 2008

Efter at have fastlagt min adfærd, skal jeg have nogle ting på plads for at kunne komme videre med en faktisk implementering. Jeg har altid haft problemer med Interfaces – de har altid virket en smule overflødige, når nu man kan lave nedarvning istedet. For så kan man jo bare have en ’super’-klasse, som alle [...]

BDD: De første User stories og Acceptance Criteria

Wednesday, July 23rd, 2008

I mit EconomyDeluxe projekt er det nu tid til at få styr på hvad der er den vigtigste funktionalitet at få på plads først. Efter nøje gennemgang af de User Stories som jeg har skrevet ned på gule post-it’s, har jeg valgt følgende User Stories skrevet efter formlen “Som en…” “Vil jeg gerne…” “Så jeg [...]

« Forrige indlæg |