Geeks With Blogs

News
Geekus Con Livus Malcolm Anderson's home for Geeks With Lives

How do you set up your classes, and your file structures?

Below is a 1 sheet “handout“ that I'm preparing for my talk on Saturday.

It's really more of a handful of thoughts about how I want to do things rather than a suggestion.

 

 

Tools and methods I want all my classes to have.

 

Given Class Foo (and instatiation of myFoo)

 

myFoo.SaveSelfToDisk(“filepath.format”)

myFoo.LoadSelfFromDisk(“filepath.format)

Foo newFoo = myFoo.Clone()

Bool areEquals = (myFoo.IsEqualTo(newFoo)

 

 

An interface for Foo

A stub_Foo class that implements the IFoo interface

The stub should give ExceptionNotImplemented errors on methods not used.

The stub should be able to throw any exception that Foo can throw

 

Unit Tests for Class Foo

 

A factory somewhere that generates an IFoo object

 

 

 

Which bring us to architecture, should it be ( A )

 

Solution

Foo

            Foo.vb

            IFoo.vb

            Stub_Foo.vb

UnitTests

            UnitTests_Foo.vb

 

 

Or Should it be ( B )

 

Solution

Foo

            Foo.vb

Interfaces

            IFoo.vb

Stubs

            Stub_Foo.vb

UnitTests

            UnitTests_Foo.vb

 

I think I would look at B as a direction to go to, but that A would be a more expected start in a legacy app.

Posted on Wednesday, July 19, 2006 5:47 AM Contracting , Agile Development , Stupid Code Tricks | Back to top


Comments on this post: I need input on Unit Testing Architecture

# re: I need input on Unit Testing Architecture
Requesting Gravatar...
I also concur with B, or something similar. Everything in one directory IMO ends up getting unwieldy as the application expands, and it's easier to add structure at the beginning then at the end. My $0.02.

Left by Ben Strackany on Jul 19, 2006 6:59 AM

Your comment:
 (will show your gravatar)


Copyright © Malcolm Anderson | Powered by: GeeksWithBlogs.net