Title: AW: (ROSE) Questions about modeling the factory pattern
Hi,
Does the factory pattern include the object persistence or just the 'Create' mechanism? If yes then how to go about it
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 08, 2000 7:34 PM
To: [EMAIL PROTECTED]
Subject: AW: (ROSE) Questions about modeling the factory pattern

My suggestion (factory method):

+--------------+    creates    +-----------------------+
| MyController |-------------->| MyFactory             |
+--------------+               +-----------------------+
      |                        | create(type : String) |      e.g.:  type="myPackage.MyClass"
      |                        +-----------------------+
      |                            |
      | doSomething                    creates
      |                            |
      \/                           \/
+---------------+   implements  +------------+
| MyInterface   |<|- - - - - - -| MyConcrete |     ( class MyConcrete implements MyInterface )
+---------------+               +------------+
| doSomething() |
+---------------+

your questions:
1) + 2): see diagram
3):(if i�ve understand you�re question right)
the dynamic nature is shown by the pattern itself. if you want, you can place a note there.
4): (dito)
in this modelled case you can implement the create-method in a way, that MyFactory checks, whether
MyConcrete has implemented MyInterface (by reflection) and throws an exeption, if don�t.


Mit freundlichen Gr��en
Jan Mat�rne

RZF NRW
Sachgebiet 314-P Software-Entwicklungs-Methoden
Fiscus AFG NW 42 SoftwareEntwicklungsUmgebung
Internet:       [EMAIL PROTECTED]



    -----Urspr�ngliche Nachricht-----
    Von:    Steve Caswell [SMTP:[EMAIL PROTECTED]]
    Gesendet am:    Freitag, 8. Dezember 2000 14:00
    An:     '[EMAIL PROTECTED]'
    Betreff:        (ROSE) Questions about modeling the factory pattern


    Greetings all.  I need some advice on modeling the factory pattern.  First
    the basics:

    My target language is Java.  I have created an interface, call it
    MyInterface.  I have created a factory, call it MyFactory.  I have created a
    controller class, call it MyController, that will invoke a create() method
    on the factory class and receive back an instance of a class that implements
    MyInterface.  The factory class will decide (perhaps based on an argument to
    the create() method) which implementation of MyInterface to create and
    return.  Also in the model I've included a concrete class MyConcrete, which
    implements MyInterface, on the model.

    Based on this (what I think is a) fairly straightforward model, does anyone
    have advice on:
    - what relationships make sense between all of these?
    - do you use associations or dependencies or both?
    - how do you account for the dynamic nature of the relationships between
    MyController and the concrete class(es) that may be returned by the factory?
    - how do you account for the fact that MyFactory may return other concrete
    implementations that do not yet exist?




                    Steven F. Caswell
                    Senior Software Architect
                    BuildNet
                    ______________________________________________________
                    1770 The Exchange, Suite 240,  Atlanta, GA  30339
                    main: 770-226-8089  |  fax: 770-952-6201  |  direct:
    678-931-2527
    [EMAIL PROTECTED]  |  http://www.buildnet.com

    ************************************************************************
    * Rose Forum is a public venue for ideas and discussions.
    * For technical support, visit http://www.rational.com/support
    *
    * Admin.Subscription Requests: [EMAIL PROTECTED]
    * Archive of messages: http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
    * Other Requests: [EMAIL PROTECTED]
    *
    * To unsubscribe from the list, please send email
    *
    * To: [EMAIL PROTECTED]
    * Subject:<BLANK>
    * Body: unsubscribe rose_forum
    *
    *************************************************************************

Reply via email to