Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Please Explain about FACTORY
Please Explain about FACTORY and Some Example .....

Report this thread to moderator Post Follow-up to this message
Old Post
apknight
04-28-05 01:55 AM


Re: Please Explain about FACTORY
In article <bdfbe.1134798$8l.491135@pd7tw1no>, "James J. Gavan" <jgavandeletethis@shaw.ca> 
writes:
> Lueko Willms wrote: 
> Constructor - YES

Though languages with constructors can also have factories.
Factories are quite common in more complex Java APIs, such as JAX,
for example.  They have certain advantages over constructors (like
polymorphism).

There was an article in DDJ a few years back on what's wrong with
Java's "new" and why factories are better in some cases.[1]  You
need to be a registered user to read the whole thing.


1. http://www.ddj.com/documents/s=7027/ddj0204a/0204a.htm

--
Michael Wojcik                  michael.wojcik@microfocus.com

I would never understand our engineer.  But is there anything in this world
that *isn't* made out of words?  -- Tawada Yoko (trans. Margaret Mitsutani)

Report this thread to moderator Post Follow-up to this message
Old Post
Michael Wojcik
04-29-05 01:55 AM


Re: Please Explain about FACTORY
"Lueko Willms" <l.willms@jpberlin.de> wrote in message
news:9VZ$-BE9flB@jpberlin-l.willms.jpberlin.de...
> .    On  26.04.05
>   wrote  dashwood@enternet.co.nz (Pete Dashwood)
>      on  /COMP/LANG/COBOL
>      in  3d4cvoF6re3v6U1@individual.net
>   about  Re: Please Explain about FACTORY
>
>
> PD> It's a place where you make things.
> PD>
> PD> In Object Oriented COBOL it contains storage and methods that can be
> PD> used to generate objects of the class.
>
>    Is that what in other languages is called the constructor or
> desctructor?
>

Yes. In other languages it is a constructor. (ususally it implements the
'NEW' method of the class. You don't need a factory for this, as this method
can be inherited from the class base, but putting it in the factory makes it
explicit, and the factory can combine references to other obect methods that
cannot be achieved by inheritance alone. For example, the factory could
store internally a number of references to related objects for a specific
instance of a specific object it was being asked to create. When the
specific object was instantiated, the factory would 'gather' the object
references of the related objects as part of an 'initialisation' or
'startup' for the new obect. These object references can be stored in the
factory's local storage. The reference returned for the new object can then
be used  to access the related objects, via the factory.

This is just one use of the factory. (Most OO languages provide a similar
facility, not just COBOL...)

The factory does not normally deal with destruction (although it certainly
can), as this is achieved by nulling the object reference. (Some less OO
systems require the specific invocation of a garbage collection object or
method.  I believe VB, Java, and Fujitsu COBOL, garbage collect
automatically when pointers are nulled.) Stateless systems like JavaScript
don't even need the pointer to be nulled, although it can be...

Often, the factory is useful where there is a hierarchy of objects, as it
can automatically 'fill in the blanks' when a new object at a new level is
instantiated.

HTH,

Pete.




Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
04-29-05 08:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:11 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.