The Artima Developer Community
Sponsored Link

.NET Buzz Forum
The Space for Names in TDD

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Udi Dahan

Posts: 882
Nickname: udidahan
Registered: Nov, 2003

Udi Dahan is The Software Simplist
The Space for Names in TDD Posted: Apr 30, 2004 2:00 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Udi Dahan.
Original Post: The Space for Names in TDD
Feed Title: Udi Dahan - The Software Simplist
Feed URL: http://feeds.feedburner.com/UdiDahan-TheSoftwareSimplist
Feed Description: I am a software simplist. I make this beast of architecting, analysing, designing, developing, testing, managing, deploying software systems simple. This blog is about how I do it.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Udi Dahan
Latest Posts From Udi Dahan - The Software Simplist

Advertisement

This just sort of popped up onto my radar after reading Roy's post on creating group projects under a single solution. Roy states the advantages of this from a TDD perspective as follows: "For example, usually I'll have a pair of projects for each Application tier, one for unit tests and another for the tier implementation (“Dal“,“Dal.Tests“). Using such a folder scheme as mentioned above I'd have a folder under my solution called “Dal” under which these two projects will reside."

While I agree that the group project idea is great, the one thing that bothers me is the example. More specifically, the namespaces there. Anyone see it ? It's right there, "Dal", and "Dal.Tests". No takers ?

The problem with this arrangement is that all classes in Dal.Tests will be a part of the namespace Dal as well. What this means is that any internal classes to Dal, which you obviously didn't want anyone to know about outside the Dal project, are suddenly accessible in Dal.Tests !

Now, if you are the only developer working on both Dal and Dal.Tests, you'd probably remember not to make any use of InternalDalClass or any other internal classes. But, in many cases you're not the only developer. And in almost all cases, you're not going to be the only one maintaining the code over time. So, some other developer when writing a test class in Dal.Tests would see just another class he could use to test the functionality of Dal.

This is OK if you intend on doing white box testing. However, I think that it is generally agreed that black box testing be done outside the project (Dal) while white box testing be done within. ( If it's not generally agreed, well, sorry, but I've seen it done a lot, and the logic behind it makes more sense than all the alternative approaches I've seen. )

So, for black box testing, instead of "Dal.Tests", just call it "DalTests" and voila, a separate namespace where the internal classes of Dal are not accessible.

Read: The Space for Names in TDD

Topic: What does it mean to be an MVP? Previous Topic   Next Topic Topic: SharePoint and EIF: Sore point for Microsoft documentation

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use