July 17, 2006

...Learn TDD with Codemanship

C# Generics & UML

In the last few weeks, I've had a couple of enquiries about whether the UML for .NET Premium Package includes material to support .NET 2.0. One topic in particular has been mentioned - generic classes.

In .NET 2.0, a generic class allows us to parameterize our code - for example, method arguments. In UML, the equivalent is called a template class. The notation is very simple, and here's an example in both C# and UML so you can see how it works.



Now, I'm not a big fan of modeling implementation details - unless you specifically want to communicate some aspect of technical architecture. And so, it's unlikely that I'd bother to model a Stack because a stack is usually an implementation detail. (As are many types of collections). But I thought I should cover it anyway, since people are asking.
Posted 14 years, 6 months ago on July 17, 2006