Home > Articles > Data > SQL Server

SQL Server Reference Guide

Hosted by

Microsoft's Visio for Database Folks

Last updated Mar 28, 2003.

Most technical professionals I know have some sort of tactile hobby. I guess it makes sense. After working with your head all day on things you have to repeat tomorrow (and that most people never see or even appreciate), it's nice to work with your hands on something you can actually finish.

One of my hobbies is cooking, so I watch a lot of the Food TV channel. My favorite show is Good Eats, and the host, Alton Brown has one basic tenet: He doesn't like gadgets that do only one thing. I'm kind of like that too, only with software. I like having a product that can multitask, not only on the CPU but in function. And Visio definitely fits that bill.

I've covered database design in a few of my other articles. In those articles I discussed database objects and the process you use to create them. To refresh your memory, the oversimplified checklist (you know I love checklists) for database design is:

  • Engage the users

  • Document their business processes in paragraphs

  • Break the paragraphs into single concept sentences

  • Pull out the nouns and verbs from those sentences

  • The nouns become columns, which are grouped into tables

  • The verbs become relationships, which are enforced with keys and other constructs

Recall that you use a series of graphics to show these objects and relationships – and therein lies our tale.

There are lots of database design tools. I have used (and continue to use) quite a few of them, but I keep coming back to Microsoft's Visio. The reason is pretty simple: I can use Visio for more than just databases. Alton Brown would be proud.

Sure, you can use Visio for everything from organizational charts to building layouts, but does it perform well as a database design tool? Let's find out.

First, there's the confusing matter of Visio's various versions. I focus on Visio 2003 in this article, but check http://www.microsoft.com/office/visio/prodinfo/compare.mspx to see how the older products stack up against this year's model.

But even the 2003 vintage has three editions. There's Visio Standard, Visio Professional, and Visio Enterprise. I'll explain a little about each, but we'll start with the basics that apply to all of them.

Visio is a drag-and-drop diagramming tool. You can drag shapes onto a document, size them, and add text, graphics and even backgrounds to the document. You can save the document in several formats, including HTML.

The basic unit in Visio is the SmartShape. SmartShapes are similar to clip art, but have additional properties. It is these properties that make Visio well suited to so many tasks, including database design.

SmartShapes are placed in Stencils which are like Word documents. Stencils are similar to vector files in that they have scale. Stencils have other properties as well.

Visio also has Template files, with contain predefined Stencils and SmartShapes, along with their associated settings; it's sort of a design shortcut. This feature is useful in standardizing your database designs across the organization.

Those are the commonalities among all the versions of Visio. These constructs allow you to at least document your database, even in the Standard Edition.

To use the Standard Edition of Visio to design your database, you simply open a new Stencil, select SmartShapes to represent database objects, and join them with connector shapes. You don't inherently get more detailed database shapes with the Standard Edition, but you can still use this version to document your design.

Visio Professional has features that are better suited to creating a proper database design. For one thing, it includes database shapes and stencils. It's not just that the database SmartShapes are included; they have properties that contain places for table names and constraints, right out of the box.

The process for creating designs using the Professional Edition involves creating a new document using the Database Template. Once you select this option, you can drag "Entities" (which are SmartShapes) onto the Stencil. These Entities lists various properties at the bottom panel of the tool. You can see an example of these properties below:

Figure 135Figure 135

You fill out these properties to complete your design.

Once you define the design, you can link the Stencil to a database to physically create or alter the objects.

You can also "reverse-engineer" a database. To do this you select a menu option, answer a few questions, and Visio creates the diagram for you.

Figure 136Figure 136

To link the database diagram to the physical model, you use ODBC drivers.

The Professional Edition is very useful on smaller database designs. The drawings are very portable, and can be given to your clients when the design is complete.

The highest version, Visio Enterprise, is available in Microsoft Visual Studio .NET for Enterprise Architects. As a matter of fact, you have to install Visual Studio to use Visio Enterprise. I've always found that to be a bit odd. If the product has certain dependencies on portions of the .NET Studio code, why not just include it in the install?

That little quibble aside, the Enterprise version of Visio is where you really get into some hard core design options. You have all the features I've mentioned regarding design, and one better: the Object Role Modeling tool.

If you haven't heard about ORM for database modeling, zip over to http://www.orm.net and check out a few of their whitepapers. I'll give you a quick overview so that we can discuss how Visio implements the concepts.

A Brief Introduction to Object Role Modeling

Object Role Modeling is a design theory based around the idea that most people think in terms of objects. A person is an object, a pizza is an object, a computer is an object, and so forth.

Objects have relationships with each other. A person eats a pizza, and a pizza is eaten by a person. A computer is used by a person, and a person uses a computer. These relationships are called facts.

Like most deep concepts, ORM is quite simple on the surface. Using these simple concepts, however, you can explain complex business rules making them easy to understand. ORM can also be used to create a logical database model. >From the logical model, you can create a physical database.

The Enterprise version of Visio contains an ORM wizard that walks you through an ORM design. You create your objects first, and then your facts. You can further refine the definition of your objects with their cardinality (how many and how much) and other properties. Visio takes the ORM diagram and then creates a database for you.

ORM is a relatively new method of designing database objects. Most Data Architects don't really find a great benefit in using it over other methods. However, I've found that it is a fantastic tool when I have to design a database by committee. Here's what I mean.

Sometimes (very rarely) you've got the luxury of a well-thought-out set of specifications. These specifications come directly from other technical professionals, are complete and thorough, and are communicated in technical language. In that case, you can fall back on whatever design methods serve you best.

In other cases, however, you aren't given any specifications, and you're asked to work with the users to create the design. When this happens there is often a disconnection; you don't understand their business practices perfectly, and they don't understand your database technology. This is where ORM really shines. You can take a tool like Visio, pop it up on the overhead and say, "Tell me what you do each day." Right on the screen, in plain old English, you begin to enter all the objects and facts they know. When you're done, you've got a documented diagram that all of you understand. You follow a few more steps in the wizard, and the database is created for you.

TIP

Just a word of advice: don't let them see you do that part! They'll begin to believe that designing a database isn't really that difficult at all, which isn't true. The tool helps you with the process, but as with all wizards, you should understand what's going on underneath.

So does Visio have a place in the Data Designer's toolkit? I think that it does. It's not necessarily good eats – but it's good tech!

Online Resources

Want to know more about Visio and ORM? Check out Microsoft's site for the complete story.

InformIT Tutorials and Sample Chapters

The Safari site has an excellent set of books on Visio, and Sams Teach Yourself Visual Studio .NET 2003 in 21 Days by Jason Beres is one of my favorites. It has a great tutorial on Visio for Enterprise Architects and databases in it.