Re: Factory pattern and building object
- From: opamail1-googlenews@xxxxxxxxx
- Date: 28 Sep 2005 08:55:01 -0700
Thanks for the replies.
I'm using my own serialization, but serialization is off topic.
My issue is building the diagram from a file containing diagram items
and their properties (color, size, location, etc...). I've since
implemented
a builder pattern, but looking at the constructs of this pattern, there
no
consideration for passing in arguments. The constructs of the builder
pattern show
a Construct method in the Director class, but with no arguments.
Generally speaking
is it ok for me to change the contructs of pattern tailored to my
needs, or is doing so
going to cause unforseable problems later on in my design? I can give
a more concrete
example if needed.
Nick Malik [Microsoft] wrote:
> <opamail1-googlenews@xxxxxxxxx> wrote in message
> news:1127767570.752816.225950@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >I am creating a FlowChart type GUI application which has several
> > diagram items. I have a DiagramItemFactory which creates concrete
> > diagram item objects. I call this factory to create diagram items at
> > runtime via drag and drop, insert or other. Then I serialize my diagram
> > to an XML file. Everything is ok so far.
>
> > My problem is when I open the file a go through the diagram items
> > defined in the file, I want to the DiagramItemFactory again to create
> > the diagram items for the diagram, but the problem is that
> > the factory only creates the default diagram items and the file
> > also contains size, color, coordinate and other properties.
>
> Hi Opa,
>
> If you are using the serialization capabilities of the framework, it will
> serialize the concrete object and all public properties, not just the
> generic object. How are you serializing your object? Also, your snippet
> shows the factory but not the definition of the child objects. The
> attributes that you use in the code of the objects will determine both how
> the objects will be serialized and how they will be deserialized.
>
> See:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml01202003.asp
>
> Also, you will get much more specific help on your C# problems by posting to
> the microsoft.public.dotnet.languages.csharp newsgroup.
>
> --
> --- Nick Malik [Microsoft]
> MCSD, CFPS, Certified Scrummaster
> http://blogs.msdn.com/nickmalik
>
> Disclaimer: Opinions expressed in this forum are my own, and not
> representative of my employer.
> I do not answer questions on behalf of my employer. I'm just a
> programmer helping programmers.
> --
.
- Follow-Ups:
- Re: Factory pattern and building object
- From: Nick Malik [Microsoft]
- Re: Factory pattern and building object
- References:
- Factory pattern and building object
- From: opamail1-googlenews
- Re: Factory pattern and building object
- From: Nick Malik [Microsoft]
- Factory pattern and building object
- Prev by Date: Abstract factory pattern
- Next by Date: Re: Abstract factory pattern
- Previous by thread: Re: Factory pattern and building object
- Next by thread: Re: Factory pattern and building object
- Index(es):
Relevant Pages
|