OK, I'll show some very rough sketch of UML hierarchy. Very preliminary, pseudo-code, and only for
Class Diagram and top level. Perhaps you well see that you might under-estimate the task.
Let's start with abstract top level of hierarchy:
abstract class Element {
}
abstract class NormativeElement : Element { }
abstract class InformativeElement : Element { }
class Comment : InformativeElement {
}
Let's classify
NormativeElements
into three entities:
abstract class Type : NormativeElement {
}
abstract class Relationship : NormativeElement {
}
class Stereotype : NormativeElement { }
Now, model the types and generic type. Pay attention: we shall not classify them into types and generic types, for some good reasons:
class SimpleType : Type { }
class EnumerationMember : Element { }
class EnumerationType : SimpleType {
}
class ComplexType {
}
class Class {
}
class GenericParameter {
}
class Interface : ComplexType { }
class Member : Element { }
class Operation : Member {
}
class Attribute : Member {
}
enum AccessLevel { IsPrivate, IsProtected, IsPublic, }
enum ParameterPassingMethod { In, Out, InOut }
class ParemeterDescriptor {
}
Now, adding the relationships:
class Cardinality {
}
class RelationshipEnd {
}
abstract class DependencyBase : Relationship { }
class Dependency : DependencyBase { }
class Permission : DependencyBase { }
class Usage : DependencyBase { }
class Generalization : Relationship { }
class Realization : Relationship { }
class Composition : Relationship { }
class UniComposition : Relationship { }
class Aggregation : Relationship { }
class UniAggregation : Relationship { }
Finally, the top of object hierarhy:
class Model : Element {
}
abstract class Diagram : Element { }
class ClassDiagram : Diagram {
}
class UseCaseDiagram : Diagram { }
class UseSequenceDiagram : Diagram { }
class CollaborationDiagram : Diagram { }
class StateChartDiagram : Diagram { }
class ActivityDiagram : Diagram { }
class DeploymentDiagram : Diagram { }
You will also need to develop separate geometry classes and bind them with model classes as loosely as possible. You can face the problem of parallel hierarchies which can potentially compromise maintenance. I devoted a part of my CodeProject article to this problem. Please see:
Dynamic Method Dispatcher[
^].
To understand this chapter, you will need to read the whole article, which can be useful by itself.
What else? Well, you should understand the sense of what you are doing and why. This is a meta-model, a (meta)
3-architecture expressed in the form of (meta)
2 model. Generally, if the set of some classes present some model, then the modeling of the notion of the class itself and related notions is a meta-model of a class of different models, a meta-meta-model…
—SA