Model Xtractor - Online Class Diagram Editor
Model Xtractor - Online Class Diagram Editor User Account   
    RSS Posts | Model Xtractor
  • Diagrams
  • Metadata
  • Blog
  • Support
  • Tutorial

Dependency Diagrams

Leave a Comment » Feb 25, 2010
Bookmark and Share
Categories: Tutorial

In Model Xtractor we treat UML “dependency” relationships between containers or groups just like the “usage” relationships between types, because they mean essentially the same thing: one entity requires the presence of another entity (of the same kind) and uses it in some way. We also call “dependencies” only the unidirectional relationships from one entity to another, when first entity “depends” in some way of the other (inheritance, implements, usage etc).

“Uses” dependencies are determined based on the external types included in an entity: whenever a container, group or type “uses” types from another container, group or type, an expandable “uses” dependency item appears under the Dependency shape folder. Container and group dependencies are automatically expanded, based on the shapes already added to the diagram. Whenever a bidirectional dependency is manually or automatically expanded, its  reverse dependency is also expanded, sharing the same connector link.

Container Dependency Diagrams

In Auto-Expand mode, most “uses” dependency items from the diagram below are automatically expanded each time you add a new assembly shape to the drawing area. For instance, you may start with mscorlib and add System.Xml. While second shape depends on mscorlib, a straight dash connector item will appear between them. Continue adding the other assemblies and the dependency diagram will get built by itself.

Click for the published entry of the diagram
EditViewPrint

The only remaining “uses” dependency items are for shapes not already added to the diagram, like System.Transactions and System.EnterpriseServices, in System.Data. You can eventually further continue manually dragging these items and dropping them in the drawing area. Or adding the dependent shapes from the Metadata tree, in which case the dependencies will be automatically expanded.

Just for a better layout and clear visual understanding of these relationships, we can move around all these shapes and make some connectors not straight (by double-click on their lines). Leave System.Data with the Dependencies folder expanded, to see the unexpanded “uses” items. You get a nice symmetrical diagram, that shows bidirectional (reverse) dependencies between some entities.

All assemblies depend on mscorlib, which it makes sense to keep in the middle. An interesting fact is you may already know from practice there is a bidirectional dependency between mscorlib and System (i.e. mscorlib also uses System), but it does not appear here. Why? Because Model Xtractor imports, works on and shows only the external model, with exported types and methods. mscorlib may internally use System and require this assembly at compile time, but it has no exported public type with method parameter types from System. We may say mscorlib doesn’t externally require or use the System assembly.

Imported database containers are abstractions for database connections, exposing one or more schemas or catalogs. For each specific vendor and DBMS type (MS Access, SQL-Server, Oracle, MySQL), Model Xtractor also created a unique and specific <<dbms>> catalog with the primitive data types (use in table columns and stored procedures). Any custom database product “uses” this last specific entry, the DBMS itself:

Click for the published entry of the diagram
EditViewPrint

Group Dependency Diagrams

These Model Xtractor diagrams are similar to the UML Package diagrams. For .NET assemblies, one namespace “uses” another namespace if it has (in its attributes, generics, member parameters or return types) types defined in the last namespace. While same namespace can be implemented by more than one assembly, you may encounter, in a shape, more than one “uses” item pointing to namespaces with the same name, but they will  however belong to different assemblies.

This NET namespace dependency diagram shows some namespaces with types defined in mscorlib v4.0. In Auto-Expand mode, each time you add a namespace shape, all “uses” dependencies between this shape and the shapes already added to the diagram are automatically expanded (including the reverse dependencies, which share the same connector and have arrows at both ends). We left in the expanded shapes only the Dependencies folder unexpanded, to show all other “uses” dependencies that can be further manually or automatically expanded:

Click for the published entry of the diagram
EditViewPrint

Similar diagrams can be created for Flash ActionScript packages. The dependency diagram below shows dependencies for MXML Charts packages:

Click for the published entry of the diagram
EditViewPrint

Database schemas or catalogs are also represented by Model Xtractor as “groups”. When metadata of an imported database product shows more than one schema or catalog, there may be inter-dependencies between them represented also by “uses” items. For instance, when one table has foreign keys propagated from a table defined in another schema, the database schema the first table belongs to “uses” tables from the second schema.

Type Dependency Diagrams

Types frequently depend on other types, in the sense they pass or return as method parameters instances of external types. The “uses” dependency for types is similar to the UML “uses” relationship, but Model Xtractor uses the same acronym and concept for containers or groups. Model Xtractor automatically determines and shows all “uses” dependencies of a type, by looking at its member signatures (parameters and return types, inherited members excluded). Very frequently used types – such as primitive types (int, bool etc) and some basic types (string, Array, DateTime, void) – are also excluded.

The type dependency diagram below has some “uses” dependency items manually expanded (unlike containers and groups, type dependencies are never automatically expanded). We left some uses items in DirectoryInfo unexpanded, but they can be dragged outside the shape and translated into similar connectors. We kept visible only those member items with the dependent types in their signatures, as parameter types or returned types:

Click for the published entry of the diagram
EditViewPrint

Model Xtractor also generates “uses” dependency items for database tables (which are similar to component types). One table depends on another table if it has foreign keys within, as propagation of the primary keys from the other table. Do not confuse these dependencies with table relationships, because they are more restrictive and have different meaning.

Take this dependency diagram, for all tables of the MS Access Northwind database. Orders may appear as an independent table, but each order requires a customer, shipper and employee, and Orders actually depends on the other tables. As an intersection table, Order Details is required for a many-to-many relationship between Orders and Products, and so depends on or “uses” these tables:

Click for the published entry of the diagram
EditViewPrint

Normally, when an IDL type is used from a different module, it has to appear with a fully qualified name. For instance, AbstractView, when used by TimeEvent, should be views::AbstractView. However, IDL modules usually typedef external types like “typedef views::AbstractView AbstractView”. In Model Xtractor, these definitions are however transparent and we never prefix types with their module name, for simplicity.

IDL interface <<uses>> dependencies will not consider the primitive and basic types defined in the Web IDL Types <<core>> module. DOMString or long, used by smil::TimeEvent, do not generate “uses” dependencies, because they are basic core types. However, other types, such as views::AbstractView and views::DocumentView will generate using dependencies, whether or not the interfaces are in the same module or component, or not:

Click for the published entry of the diagram
EditViewPrint

Leave a Comment

Accepts [code lang=".."] .. [/code], where lang is one of: csharp/vbnet/java/js/c/cpp/xml/sql/as3/php/ruby

E d i t   D i a g r a m s   O n l i n e !
Advertisement
Last Recommended Diagrams
  • WCF Binding
  • Membership (System.Web.Security Namespace)
  • System.ServiceModel.Syndication Namespace
  • System.Configuration: Sections and Groups
  • System.Configuration: Specific Sections
  • mx.utils
  • mx.preloaders
  • mx.controls.menuClasses
  • mx.controls.listClasses
  • mx.controls.dataGridClasses
Last Recommended Diagram
WCF Binding
WCF Binding
© 2010 Model-Xtractor.com - All Rights Reserved.
  • Terms of Use
  • Privacy Policy
  • News
  • About Us
  • Contact Us