Leo Sutic wrote:

> NH> What happened to the XP voices in Avalon.
> NH> Value; SIMPLICITY
> 
> hammet> I tried to say that too.. :-(
> 
> 
> As my finger moves toward the delete key the code screams "Don't delete
> me! I'm simple!".
> 
> I reply "Yes you are simple now, but will you be simple in one year?"
> 
> And the code is silent...

Single Responsibility Principle.

If the code follows that, then it will remain simple.  I.e. One place to
perform a single responsibility.  If we have one utility code to discover
the set of classes, then we can take care of it in that way.

In general, attributes elegantly and simply solve many problems.  It works.
As with all things it does not solve all problems.  THat would be asking for
too much.

The first issue is easily solved:

How to generate and collect meta info on a known class.

The second issue is less easily solved, and some fear it:

How to collect all the types (AKA classes) that use a certain attribute.

Now, in the .NET world, they have an assembly.  That assembly allows you
to get all exported types and iterate over them.  I.e.

Assembly assembly = Load(assemblyName);

Type[] testTypes = assembly.GetExportedTypes();
foreach(Type testType in testTypes)
{
     if(IsTestFixture(testType))
     {
        // Do stufff
     }
}


This at least is how NUnit works.

The solution you proposed in not too different from that.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to