Which pattern best suites a diagram application?

Hi all,

I need to implement an application such as Rational Rose or Visio.

I am intending to use the mvc pattern as all the info i have points in this direction.

I think MVC, Decorator, mediator, builder, etc are all possible candidates but susspect that MVC is the best.

Can someone please either confirm this or point me in the right direction

Thanks in advance for any constructive criticism

Graham

[445 byte] By [globba] at [2007-10-2 10:37:39]
# 1

[snip]

> I think MVC, Decorator, mediator, builder, etc are

> all possible candidates but susspect that MVC is the

> best.

Your context (the Visio-like app) is too broad to evaluate whether one pattern or another is "the best". You will likely use quite a few of them within your application.

Lee

tsitha at 2007-7-13 2:42:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

My appologies,

I suppose a rational rose static class diagram is the closest description

The application is a basic relational database tutorial tool

from the gui a user must be able to design a uml style drawing of a databse including

relations with attributes that will include pk fk etc.

the multiplicity between relations

this diagram is then used to generate an sql script

globba at 2007-7-13 2:42:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

> My appologies,

>

> I suppose a rational rose static class diagram is the

> closest description

>

> The application is a basic relational database

> tutorial tool

>

> from the gui a user must be able to design a uml

> style drawing of a databse including

>

> relations with attributes that will include pk fk

> etc.

> the multiplicity between relations

>

> this diagram is then used to generate an sql script

But "the application" scope is still too broad to talk about the relative merits of one pattern over another (except in some rather trivial applications). I could see wanting to use the MVC pattern to deal with separation of view and model, and I could see using the mediator pattern to deal with controlling user interactions in your GUI, and I could see using the Composite, Decorator and maybe Builder patterns to deal with your various UI components and how they relate to each other.

Those are all smaller contexts than the entire application.

Lee

tsitha at 2007-7-13 2:42:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

Please explain what you mean by the application scope?

The app is a uni project and it is to be implemented as i see fit.

The only specification i was given is to design an application that can allow a user to design a sql diagram the only objects are relations, relationships and the multiplicity between these relations.

Relations must have attributes the attributes in turn will have a domain. An attribute may be indexed. When generating the sql the relationships will need to be validated(foreign key must == primary key domain etc)

The application is quite simple as i see it and may possibly be done without a pattern i only sugested a pattern as a means of teaching myself (using a pattern may possibly be incorrect).

The GUI is a frame and each drawing in the frame may be done on an internalframe

Thanks for any help

Graham

globba at 2007-7-13 2:42:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

> Please explain what you mean by the application

> scope?

Asking, "Should I use Mediator or Director for this application I'm creating?" is like asking, "Should I use 2x4s or plywood for this house I'm building?"

You'll quite likely use more than one, and you don't use Mediator or Decroator or whatever for an application. You use them for smaller pieces of your app.

> The application is quite simple as i see it and may

> possibly be done without a pattern i only sugested a

> pattern as a means of teaching myself (using a

> pattern may possibly be incorrect).

Whether you know it or not, you probably will end up using at least one pattern somewhere in your app. If you don't, there's a statistically good chance you've botched your design.

I say this not because I think your app needs a pattern, but rather because patterns were created to codify recurring solutions that people used. Those patterns tend to pop up naturally all over the place in well-designed apps, so there's a good chance you'd have done the same thing.

It's like asking "should I use a for loop for this app"? It's not at the app level that you need a for loop, but it's highly likely that you'll use one somewhere.

jverda at 2007-7-13 2:42:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 6
ExcellantThanks for that,Graham
globba at 2007-7-13 2:42:20 > top of Java-index,Other Topics,Patterns & OO Design...