Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am delving into the science of UML. The tool I am using is ArgoUML. I feel very confident portraying OO designs through this tool. But what still vexes me is the incorporation of the database. What does one do in UML to show table structure? Stored procedures? So on and so forth.

share|improve this question
1  
I'm guessing you're not just looking for ERD ( en.wikipedia.org/wiki/Entity-relationship_model )? –  FrustratedWithFormsDesigner Jul 6 '11 at 21:23
    
FWFD, I am not just looking for ERD. I want to incorporate my database architecture within UML. Great link, though! –  user29981 Jul 6 '11 at 21:30
    
There's a science of UML? –  kevin cline Jul 7 '11 at 5:55
    
That's what it's starting to seem like! –  user29981 Jul 7 '11 at 6:16
add comment

2 Answers

up vote 0 down vote accepted

Start here: http://www.agiledata.org/essays/umlDataModelingProfile.html

What does one do in UML to show table structure?

Classes are tables. They just lack methods. Perfectly simple UML. Indeed, the UML for entities and relationships was carefully considered.

Just set your class definitions so they don't show the compartment with methods. That's all.

You can use a stereotype to identify those classes that map to tables.

Stored procedures?

Stored procedures are an abomination. You can think of them as free-standing objects (i.e., special-purpose classes with only one instance and only one method.)

You can think of the "schema" as class which contains stored procedures as methods. That's not too bad.

My preference is to simply disallow them entirely and save yourself the agony of designing and documenting them. Everything you think you might want to do with a stored procedure can be done with a "Model-layer" class (and methods) that maps to a "Persistence-layer" RDBMS tables.

See this: http://en.wikipedia.org/wiki/File:ERD_Representation.svg

It seems quite clear.

share|improve this answer
    
Are you talking about not using Stored Procedures in my design? Or just my UML diagram? If the former, then I would have to disagree. –  user29981 Jul 7 '11 at 1:15
    
@Surfer513: The former. I realize that many people have an unsupportable love for SP's. Feel free to use them, even though they add no measurable value. Almost any UML notation is fine for them, but they are simply a development and maintenance nightmare waiting to happen. Please don't justify their use by responding; you are already free to use them in the same way you are free to use other bad programming practices. Bad practices (like stored procedures) don't require elaborate justification. Just use them as you see fit. –  S.Lott Jul 7 '11 at 1:17
add comment

I think that there are two opposite visions of UML and databases.

On one side you have traditional and old methodology using Model Driven Development and books such as Scoot Ambler.

On the other hand you have new initiative where UML is reversing Java annotations and adding this information in the code. I mean that UML is synchronized with the java code persistence annotations used by the EJB3 specifications (e.g. hibernate annotations). These annotations are created by using a Database profile composed by database stereotypes. This database modeling at the same stage as the object UML model modeling is only possible because of the use of JDK 5..7 annotations with ORM mappers. It means that you have to know not only UML but also the way the mapper will be working. Pretty hard but really powerful and time saving approach.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.