• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Java Design Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java Design Question


  • Subject: Re: Java Design Question
  • From: Art Isbell <email@hidden>
  • Date: Wed, 9 Jun 2004 17:57:06 -1000

On Jun 9, 2004, at 5:32 PM, James Cicenia wrote:

I have decided to move my various methods which return arrays of
EOObjects to
their own classes. These classes will just look up the EOObjects based
upon
passed parameters and then return an array. If I create a new instance
of this
object and then use it to retrieve my records it seems to work great.

Now my java inexperience questions.

I have the method as being static, i.e.,
   public static NSArray pipelineQ4ByType(Portfolio portfolio){
is this correct that it is static?

A static method is known in object-oriented terminology as a class method. I.e., no instance of the class need be created to invoke a class method. So when you say that "if I create a new instance of this object and then use it to retrieve my records it seems to work great", you're wasting memory creating an instance when none is needed.


secondly since the methods are static, wouldn't this be a so called
singleton?

No, a singleton is a class of which no more than one instance can ever exist. This has nothing to do with static methods and variables because these have nothing to do with instances.


In other words wouldn't I just want one of these objects in memory ever?
If so, how would I make that so in WebObjects?

Each object of this class that you fetch or create is an instance of this class, so your app (and probably EOF) would break if you tried to make this class a singleton. So, bad idea.


Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Java Design Question
      • From: James Cicenia <email@hidden>
References: 
 >Java Design Question (From: James Cicenia <email@hidden>)

  • Prev by Date: Re: Secure WOHyperlink puts :443 in URL
  • Next by Date: page design help
  • Previous by thread: Java Design Question
  • Next by thread: Re: Java Design Question
  • Index(es):
    • Date
    • Thread