Is this considered good programming?

jTextField1.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent fe) {
jTextField1_focusLost(fe);
public void focusGained(FocusEvent fe){
jTextField1_focusGained(fe);
Is considered the "right" way to do it?
Thanks

Personally I favour (most of the stuff I do is J2ME, and thus more classes == bad):
public class Boogle implements XYZListener, JeffListener, ActionListener {
       // Variables
      /// XYZ listener
     public void XZYHappened( XYZEvent e  ) {
            if( e.getSource() == jeff ) {
                  doStuff();
      /// Jeff listener
       public void jeffHasRanAway( JeffEvent e ) {
            System.out.println( "No!!!" );
       public void jeffHasComeBack( JeffEvent e ) {
            System.out.println( "Yeah!!!" );
       public void jeffHasDoneSomethingIDontCareAbout() {}
        // Action Listener
       public void actionEvent( ActionEvent e ) {
            if( e.getSource() == boggleButton ) { dance()  }
            else if e.getSource() == doSomethingButton ) { doSomething() }
      // Other Stuff
}

Similar Messages

  • Is this  considered good Customer Service

    I have recently signrd up for Photoshop and Lightroom (been using them until I retired,and now want my own account).
    Suffering like many others with the message "Develop disabled, please renew your membership".
    Having tried all suggested solutions from the forums, decided to use live support, only to be told that non of the Lightroom team were available to help (must be a nice day where they live and they are all at the beach)!
    Basically told to come back tomorrow. I attach no blame to the agent I spoke too, it's not his fault that Adobe can't be bothered to provide reasonable levels of support despite being considered the world leader in imaging software.
    Below is a transcript of the live chat:
    "Hi, we are currently helping other customers in line ahead of you. We'll be with you as soon as possible. While you wait, you can try our community forums where experts are online 24/7. You are now chatting with 'Vikas' Vikas: Hello. Welcome to Adobe Technical Support. Vikas: Hi Norman! Vikas: Please allow me a moment while I look into your account & verify the details. Norman Robinson: Lightroom develop disabled, please renew membership. Have followed all suggestions on forum. None worked. NOT HAPPY Vikas: Thank you for being online. Vikas: As I understand, you are facing issue with Lightroom application. Is that correct ? Norman Robinson: Yes Vikas: Thank you for confirmation of issue. Vikas: I'm sorry to inform you that Lightroom team is offline today. Vikas: You can contact us back on Monday. We will connect your chat to lightroom team. Norman Robinson: That is ridiculous - for an organisation of Adobe's size. Its today I need help. NOT TOMORROW!!!!!! Vikas: I'm sorry Norman, we are from download and install team, we do not have enough knowledge of Lightroom application. Norman Robinson: Maybe I should cancel my subscription - there are alternative applications. Vikas: I'm sorry for the inconvenience caused to you in this issue. Vikas: I wish I could help you but I'm sorry. Vikas: Is there anything else I can help you with? Norman Robinson: Perhaps you should forward this conversation to Adobe's CEO. I'm Know I am not the only one suffering from this issue. The level is service is very poor."
    Good job Bridge is still available with the 'Photography' contract.

    I downloaded Bridge, to be quite honest I am more familiar with the Bridge interface, but need to extend my knowledge of Lightroom (given that Adobe fix the issue).
    At least now I can work on my images unhindered by crap updates.
    I'm lucky, in as much as I created this account for my personal use now as a retired hobbyist so there is no pressure on deadlines. I feel for those who are still attempting to use Lightroom in a commercial environment and are suffering from this error and the appalling lack of support from Adobe.
    Searching for the email address of their CEO, nothing like going straight to the top!

  • Is this a good programming practice?

    Putting a "throws Exception" in the constructor.
    class Test
    public Test throws Exception {
    }

    I read somewhere that the possibility that something can go wrong in a constructor is one of the convincing arguments for having exceptions in the first place, since there's really no other (reasonable) way to report an error back to the caller. So yes, have a constructor throw an exception (and declare which one(s) it may throw) is a very fine practice as far as I'm concerned.
    I agree that "throws Exception" is poor practice for all methods. Much better to write "throws Exception1, Exception2, Exception47, ExceptionA, YetADifferentExceptionClass" even if it takes a couple of lines.
    Message was edited by:
    OleVV

  • I was surfing the web and got tricked into downloading MacProtector.  It says my system is infected!!  Of course they want almost $80 to register the copy that is on my laptop.  Is this a good product??  Should I get something else, like Norton antivirus?

    I was surfing the web and got tricked into downloading MacProtector.  It says my system is infected!  Of course they want almost $80 to register the program so I can then use it to clean up my machine.  Is this a good program??  Should I get something like Norton antivirus instead??

    Yes, turning off Javascript works, but turning it on and off is a pain if one has to make a trip to the preferences.
    Why many recommend the NoScript Add-on as one can drag a "allow" button to Firefox's toolbar and turn on scripts on a site per site, case per case basis.
    NoScript also protects against other web nasties, like Clear click jacking and zillions of other web based trickery.
    http://noscript.net/changelog
    Apple Support Forums works fine without Javascript running, I do it all the time, it also supports HTTPS encrpytion too.
    It might be that I'm not seeing a lot with Javascript and other things turned off, but the post box functions etc. work just fine.
    Maybe Apple is heading towards no scripts running on all their products?
    First Flash gets the axe, then Java is coming next and perhaps finally Javascript? hmmmm?
    Smart move possibly.
    Nope it's the same with it on or off.

  • Hi, My OS X is Leopard v10.5.8, w/Safari v5.0.6. I am considering downloading ClickToFlash 2.9.2 for general security reasons. I'm assuming this a good fit, being that Apple endorses this extension on their site. Does this mean i can download it w/out hav

    Hi, My OS X is Leopard v10.5.8, w/Safari v5.0.6. I am considering downloading ClickToFlash 2.9.2 for general security reasons. I’m assuming this a good fit, being that Apple endorses this extension on their site. Does this mean i can download it w/out having to worry about any conflicts?,.. that its coming from a safe source, etc? Does it have any downsides? Is it easy to install?, ..or uninstall if i dont like it?
       ALSO~ I’m assuming i dont need ClickToPlugin, because when on internet i always have “Enable Plugins” ~ DISABLED.
        Thanks for any advice,...  Jean in NJ

    I dont really understand~  When i open my Flash Player pane, click on Advanced tab, the heading "Updates" reads~ "Not updating may leave this computer vulnerable to security threats." The reason for my concern is that Adobe no longer offers FP updates for my OS [10.5.8],not even archived. So my original question probably should have read~ When visiting a web site does Flash automatically load onto safari.  If so, can using Click to Flash;... and NOT clicking to flash, prevent Flash from loading, and possibly carrying  a "security threat" [virus?], into Safari or my Mac?  Not trying to beat a dead horse,..just trying to understand what makes him run,   Thanks

  • Is this a good design -- XI and another EAI tool in the same landscape

    Hi All,
    I am working in a project wherein the client already has an EAI tool which is based on SOA(Web Services). They are implementing SAP systems in their landscape. They now want to use SAP XI in the landscape for the purpose of integration. They want to integrate their initial EAI tool with XI and have the existing integration with NonSAP systems as it is and integrate SAP systems using XI.
    Is this a good design having two EAI tools being used for integration between two systems? What are the various issues that need to be taken into account?
    Answers will be promptly rewarded.
    Thanks and Regards,
    RM

    R M,
    There are lot of points that has to be considered when evaluating the design of EAI landscape. I heard somewhere that even SAP does not recommend to scrap the existing landscape and bring in SAP XI there. I gues dual hub gateway is very common unless it is a fresh implementation becuase changing the existing landscape is re-investing the cost again for the customers.
    If you ask me then SAP XI is not yet so robust to handle huge volumes in real time data integration and SAP XI can be used in between for integration to SAP system as it is a SAP system and it works excellent integrating with SAP systems.
    Check out this thread which is a transcript of a 10 year EAI architect :
    in my company we had more or less the same situation 2 years back, a existing BizTalk solution, and whether we should introduce XI or not.
    We concluded with the following; BizTalk should be used as the main integration engine between the different system landscapes and ALL external communication, and XI should be used as the integration engine for all data to/from our SAP system landscape. Depending on the integration scenario, we may use both.
    BizTalk will not see any SAP systems, only web services exposed by XI or using IBM MQ depending on an async/sync integration scenario.
    We believe that XI is better with integration from/to SAP, and;
    - In future SAP will deliver out of box integration for the XI system (XI content) for Enterprise Services Architecture
    - Several components in the NetWeaver stack are using XI for communication
    We have a SAP system landscape with several 46C systems (IS/OIL, HR ...) and newer NetWeaver solutions.
    I can give you a brief resume of our experiences – my background is ABAP developer since ’98, I have implemented a few BizTalk solutions to SAP 46C, and I’m a certified XI developer and developed several XI solutions between SAP 46C/640 and BizTalk.
    BizTalk ******
    Overall communication between SAP systems and BizTalk depending on the integration scenario and who is the initiator:
    SAP 46C to BizTalk:
    There are no good mechanisms available for sending data from 46C to BizTalk, we are using HTTP_POST with XML payload. Then you must use the iXML library on the SAP side, its ok, but you will spend, in my point of view, too many hours on XML programming that can be generated automatically.
    BizTalk to SAP 46C - Which SAP adapter to use for BizTalk?
    We started with SAP adapter from IWay, but that adapter gave us a lot of problems on the BizTalk server (pretty complex adapter with strange behaviour, and several integration scenarios stopped working for no reason at all (unstable)).
    Due to several severe problems, we switched to SAP adapter from Microsoft 1 year back in time. If I don’t remember wrong, back then, the SAP adapter from Microsoft did not support parameter of type string or table types – so there are/were some limitations regarding the signature of the RFC function.
    The SAP adapter from Microsoft is more stable than the previous, BUT we have some hick ups with that one as well when BizTalk does very frequent calls to SAP 46C.
    SAP 640 to/from BizTalk:
    I assume you can use the web service functionality on the SAP side in order to send/receive data, but I don’t know whether 640 support asynchronous web service.
    XI *****
    The communication mechanism between different SAP systems and XI are much better than with BizTalk:
    SAP 46C to XI:
    Configure a sender communication channel with RFC adapter; basically the XI system will be RFC server so the only thing you have to do is to create a RFC port on the 46C system “pointing” to the XI system. In the Abap program, you can do normal function calls with destination (RFC port) AND the RFC call will automatically be translated to XML on the XI side.
    Thus, you can forget all about the iXML library and XML rendering of the payload to HTTP.
    Besides, you can choose to use sRFC, tRFC or even qRFC depending on the integration scenario and whether you want guaranteed delivery.
    XI to SAP 46C:
    More or less same as BizTalk using a SAP adapter, but string and table types are supported.
    SAP 640 to/from XI:
    This is a very nice situation, every 640 has a local integration engine, so the main integration engine (XI) can send/receive XML messages both async/sync. Another advantage is using the SPROXY transaction on the 640 system, generating automatically a proxy class being able to send/receive messages based on a message interface defined in XI (outside-in programming).
    Finally *****
    BizTalk and XI are at a conceptual level identical, two integration engines with the purpose of send/receive, route and do message transformation (mapping) using adapters to different technical systems.
    Microsoft has a lot of resources available and for sure, BizTalk will be a very good choice for most companies.
    SAP came late with XI, but they are not trying to make the best integration engine, but good enough. And for sure, I think SAP will come with very nice XI content in time (interface mappings between message interfaces – business solutions) which is beyond BizTalk.
    As an ABAP programmer I just love the transport system between development, quality and production systems. We are using the CMS transport systems between our development XI, quality XI and production XI – it is so nice and fast. With BizTalk you have to create a MSI file (installation file – which files to include…) and somehow transport the file (mail or whatever) to the quality environment for installation – really tedious work compared to XI.
    So we are using BizTalk 2004 and XI 3.0 and are very happy with both.
    Note:

  • Is VHDX for data drive considered good practice on a client PC?

    Hi!
    I don't like putting user's data files (documents, etc.) inside the user's Documents directory on C:. Instead I prefer having them on a D: disk, separate from the OS. On the other hand I don't want to create a fixed size partition as I consider it a waste
    of space, especially when everything is on a rather small SSD.
    Therefore, I consider creating a virtual hard disk (VHDX) on my C: drive and making it dynamically expanding. This would allow me to store data on that "separate" disk which is actually an expanding VHDX file on C:. One problem is that for some
    unknown reason Windows 8.1 is not able to auto-attach such disks on startup, but I have seen some workarounds to auto-mount them through tasks.
    My question is the following: Is it considered good practice to put all data files on such a dynamic VHDX instead on a separate partition? Reading the VHDX explanations it looks like this file format is very stable (even in case of power loss) and is widely
    used in virtual servers. Performance should be also very good. Therefore I don't see any reason to not use it for my data drive. Or are there any drawbacks?
    Thanks in advance for any help.
    Best regards,
    Anguel

    Hi,
    Since the VHDX is created on C which should be the system partition, I don’t think it is more safety than separate partition.
    Please consider that once the system corrupted and we have to format the C to reinstall the System, it may be difficult for us to recovery the date. But the separated partition will be easily stayed without changes.
    You can try to shrink the C volume in Disk management to create a new partition.
    Just my thought.  
    Kate Li
    TechNet Community Support

  • "insufficient privileges to access this directory C:/Program Files(x86)/iTunes/iTunes.Resources/nb.Iproj."

    I'm using a Windows 8 laptop and I updated my iphone 4s software to IOS7 and of course my itunes needs updating, but when I go to update it is in vain because it comes up with the message that the installer has insufficient privileges to access this directory C:/Program Files(x86)/iTunes/iTunes.Resources/nb.Iproj.
    and the installation cannot continue. I have tried changing the security permissions on this file which doesn't let me as it asks that I need Read Permissions etc...
    Has anyone encountered this issue, I've looked online but nothing helps for my situation

    If you can't delete the .lproj folders try renaming them or deleting/renaming a parent folder, i.e. \iTunes\iTunes.Resources or \iTunes.
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • Help me...does this look good?!?!?

    Hey all,
    I want a G4 to use in my music studio, have found one on ebay, does this look good to you...
    http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=8792713494&rd=1&sspagename= STRK%3AMEWA%3AIT&rd=1
    If you can't access that, basically it's this...
    Computer is in excellent condition, has been well loved and well upgraded:- 200GB hard disk (5400rpm) Dual 867 MHz, 1MB L3 cache per processor 1.25GB DDR SDRAM 16x DVD+/- RW (Superdrive) 4x DVD+ RW (original Superdrive) 4x USB 2.0 ports 2x USB 1.0 ports 2x Firewire ports Airport Card (WiFi) Ethernet Card 56kbps Modem Digital in/out for audio Again it is in excellent condition, well loved.
    Oh and there is still 2 slots left for memory upgrade and 4 other slots for your other upgrades, i.e. more firewire, usb, graphics card, music adaptors etc. I used the machine mostly for video editing and graphic design and it handles everything I throw at it. It is a beast of a computer but sadly by job entails I have a laptop now I will also include all the software that comes with it.
    Think it sounds good? What price do you reckon???
    Thank you!
    Olivia x
    G4 I hope    

    If you do decide to bid I'd keep in mind that it's the base model MDD G4 with a 133MHz system bus (the others had 167MHz). It's also one of the original models that got the nickname of wind tunnel as they could be fairly noisy, so much so that Apple under went a power supply replacement program using quieter fans, which may be an issue if it's intended for audio use. I'm not sure whether it's had the power supply replaced, but Verax also offered a noise reduction kit, which may give some indication of how noisy it can be.
    I'm not trying to put you off though, but I'd keep the above in mind if you do intend to place a bid.

  • Assistance with good programming

    Hey!
    I'm new to this Java game like most of the rest of us on here. I've just finished testing my first big project (calling methods etc.- all quite basic stuff)
    but I'm wondering if anyone out there could spare five minutes just to help me on the 'good programming' side of things.
    I didn't bother posting the code, but if someone can help me out I can get it to them.
    Many MANY thanks, and hopefully one day I'll be able to answer some of the other beginner questions myself!
    CoosMC

    From my limited programming knowledge, i believe that you are only suppose to put your variables outside of a method if absolutely necessary. This is because when the variables are declared outside of the method they are called global and will use up memory the entire time the program is running, compared to local variables which only use up memory when the specific method is called.
    As for the repeating of the variables as 0 or none outside AND inside the main method. If you are using global variables, then there is no need to repeat the numbers inside the main method, unless the values of the variables change AND the main method is called more than once in your program. Since your variables are within a while loop, then you will have to repeat the numbers if you want the same starting point every time. If you want the variables to keep the value of the previous loop, then do not put the 0 at the beginning.
    As for if private static int claimnum = 0 is necessary. take a look here to learn more about that and look at "Access Attributes" for more info as well as the rest of this tutorial.
    http://developer.java.sun.com/developer/onlineTraining/new2java/divelog/part1/page4.jsp
    anyone out there, please correct me if i'm wrong.
    i'm still a bit of a rookie myself.
    Andy

  • Good programming practices:   creating Iterator objects

    Hi,
    This is a question about Good programming practices for creating Iterator objects of ArrayList objects. The following line of code works fine in my program (as ridiculous as it may sound):
            Iterator cheesesIterator = cheeses.iterator();but I was wondering whether Java is automatically inserting the <Type> and new code to make:
            Iterator<String> cheesesIterator = new cheeses.iterator();and therefore whether it is good practice to use these everytime? Thank you. ("full" code shown below:)
    import java.util.ArrayList;
    import java.util.Iterator;
    public class DemonstrateIterator
        private ArrayList<String>  cheeses;
         * constructor:
        public DemonstrateIterator()
            cheeses = new ArrayList<String>();
            cheeses.add("Emmentaler");
            cheeses.add("Cheddar");
            cheeses.add("Stilton");
            cheeses.add("Brie");
            cheeses.add("Roquefort");
        public void listCheeses()
             //make an iterator object of the ArrayList object
            Iterator cheesesIterator = cheeses.iterator();
            while (cheesesIterator.hasNext()) {
                System.out.println(cheesesIterator.next());
            /** Exploring the toString and Super functions. **/       
            System.out.println("\na toString call to Super returns: " +
                                              super.toString() + "\n");
    }

    AJ-Phil wrote:
    Hi,
    This is a question about Good programming practices for creating Iterator objects of ArrayList objects. The following line of code works fine in my program (as ridiculous as it may sound):
            Iterator cheesesIterator = cheeses.iterator();but I was wondering whether Java is automatically inserting the <Type> and new code to make:
            Iterator<String> cheesesIterator = new cheeses.iterator();and therefore whether it is good practice to use these everytime? TFirst, new chesses.iterator() won't compile.
    iterator() is just a method that returns an iterator. It constructs an instance of a private or nested class that implements iterator, and returns a reference to it.
    As for the <T>, when you declare List<String>, that parameterizes that list with type String. The iterator() method returns Iterator<T>. You can look at the source code for yourself. It's in src.zip that came with your JDK download.
    Separate from that is your declaration of that variable as type Iterator, rather than Iterator<String>. Regardless of what you declare on the LHS, the iterator() method returns Iterator<T>. Your bare Iterator is essentially Iterator<Object> or Iterator<? extends Object> (not sure which, or what the difference is), which is assignment compatible with Iterator<T>. If you had declared it Iterator<String>, you wouldn't have to cast after calling next().
    Edited by: jverd on Nov 23, 2008 11:33 AM

  • Good programming tactics

    hi. i thought i'd like to start a thread on good programming tactics.
    ill start with a few questions:
    interfaces, abstract classes, and polymorphism, when are they REALLY useful?
    (and how does one REALLY use them?)

    Interface � An interface is like an agreement between you and another programmer. An example would be if you designed some software that needs an XML parser and you used an old XML parser that you wrote a few years ago. You know that the parser is not really, really good code but it�s good enough for your program. You also know that maybe someone who wants to use your code may want to add his or her own XML parser that work much better.
         If you use an interface to access the original parser in your code then you can give them the ability to rapidly add their own parser. What the interface does is give the other programmer a set of routines that he must have to work correctly with your program. If he can write a better parser that supports all these routines then he can use it and the interface is the guarantee that the compiler will use to verify that his program has all the proper methods to work with your program.
         Note: Some programmers use interfaces as a way to inherit multiple classes. java does not support extending (read inheriting) more than one class so a common way to get around this is to use interfaces which is not exactly the same but is the way to support this in java.     
    Abstract Class � An abstract class is similar in use to an interface. Where an interface is only a group of methods without any code, an abstract class is class that can never be created (instantiated), can have runnable code and will normally have some abstract methods which are similar to the methods in an interface.
    You can only use an abstract class to create other classes using the keyword extends and it must have it�s own version of every method that is abstract in the original abstract class. The use of abstract methods forces the programmer who uses your class to write methods that are necessary for the class to function correctly.
    An example of where to use this would be in graphics classes. You might have an abstract class called GraphicObject. This class would have several useful calls to methods ( i.e. setColor() ) and several useful fields and it might also have an abstract method called draw.
    The programmer would have to write a method to draw his GraphicObject as a circle would be drawn different than a rectangle.
    The original programmer knew that if you wanted to use his class GraphicObject then you must write a routine that will draw your GraphicObject. The absract class will take care of accessing the graphics card and setting up the environment to draw the object.
    The following I borrowed from http://www.developer.com/tech/article.php/983081 where you can read more about poly morphism if you want to. As you can see polymorphism is directly involved with interfaces and abstract classes.
    What is polymorphism?
    The meaning of the word polymorphism is something like one name, many forms.
    How does Java implement polymorphism?
    Polymorphism manifests itself in Java in the form of multiple methods having the same name.
    In some cases, multiple methods have the same name, but different formal argument lists (overloaded methods, which were discussed in a previous lesson).
    In other cases, multiple methods have the same name, same return type, and same formal argument list (overridden methods).
    Three distinct forms of polymorphism
    From a practical programming viewpoint, polymorphism manifests itself in three distinct forms in Java:
    Method overloading
    Method overriding through inheritance
    Method overriding through the Java interface
    Hope this helps and doesn't confuse you more. I am sure that someone is going to find things to correct but I believe the general ideas are right.

  • Good program to burn dvd's

    good program to burn dvd

    Hi manuweb_21.
    your thread contain an issue that apple prohibit user to post based on user agreement about ripping ditigal media with copyright.
    Do not submit software or descriptions of processes that break or otherwise ‘work around’ digital rights management software or hardware. This includes conversations about ‘ripping’ DVDs or working around FairPlay software used on the iTunes Store.
    Taken from:
    http://discussions.apple.com/help.jspa
    Good Luck.

  • Good programming practice - Abstract class

    Hi all,
    I have been trying to help another soul in this forum, and came to the conclusion that I don't know good
    programming practice when it comes to abstract classes.
    Is this correct?
    You CAN implement methods in an abstract class, but it's not recommended.
    I have NEVER done this...when is there possibly a need to?
    Regards.
    / k

    Yes, absolutely, you can implement methods in an abstract class. Any method that all subclasses will perform in the same way can be implemented in the abstract base class. If subclasses perform similiar functions depending on their type you declare those as abstract in the base class. Here is a contrived example that I have seen on job interviews.
    Suppose your developing an application that draws on a panel. We want to provide some canned shapes such as a circle, a square and a triangle. We want to be able to draw the shape set or get its color and calculate its area.
    Let's define an abstract base class Shape
    public abstract class Shape{
        private Color myColor;
       //  since color has nothing to do with what kind of shape we're working with, create concrete implementation
       public Color getColor(){
            return myColor;
    public void setColor(Color newColor){
       myColor = newColor;
    // however, drawing the shape and calculation its area are depending on the actual shape.
    public abstract void draw();
    public abstract double getArea();
    // so then Square would be something like
    public class Square extends Shape{
       public double get Area()
          return sideLength * sideLength  // assumes somehow we know sideLength
    public void draw(){
                  // concrete implementation
    }we can do the same things for Circle class and Triangle class.
    And, if you think about it you'll notice that we could have made a Rectangle class and then Square would be a subclass of Rectangle where both dimensions are equal.
    I hope that somewhat strained example helps answer your question.
    DB

  • [b]Is this a good a pricatice????[/b]

    Hi All,
    I am currently working on a new project and I just wanted to make use of DAOs and Singletons.
    I just wanted to make sure that what I am doing correct and that it would not cause any problems in the future.
    Here is what I am doing..
    1. I moved all my data base interactions into just one class (UserDAO.java).
    2. I created a factory class ( UserDAOFactory.java ) to make use of singleton.
    And this is what I am doing in the Factory calss
    public class UserDAOFactory {
         private static userDAO cdDAO;
         public static UserDAO getInstance()
                   //For lazy initialization
                   if(userDAO == null){
                        userDAO = new UserDAO();           
                   return userDAO;
    Is this a good practice??
    Since I made "userDAO" as a static variable just wanted to know how would it affect me in the future and what precautions should I take??
    I will really apprecaite any help, ideas and thoughts in this regards and I am a little new to this
    TIA,
    CK

    If the Singleton requires lots of resources but may
    not be used in a given execution of a program. For
    example let's say you have some kind of advanced
    screen in your text editor. When it opens up it
    takes a while to load, lets say 30 seconds. If you
    do this at startup, you added 30 seconds to startup
    for something that may not even be used.I agree in principle, but I've never seen a Singleton that took that long to start up. It's like Bigfoot: there are stories out there, but I've never seen one.
    The good news is that normally, the 'lazy'
    instantiation and the static initialization generally
    occur at the same time, the first time the
    getInstance method is called.Not very lazy, then.
    However, some environments will load a class before
    it is referenced. Sometimes this can cause fatal
    errors (I have dealt with this.)
    We had singletons
    that ran on an app-server (I know you are not
    supposed to do this.) When the server came up, it
    would load the class. However, the required
    resources were not ready and the singleton wouldn't
    initialize properly. So the 'lazy' version was
    required.Okay, I see. Thank you.
    This still doesn't fix double checked locking. Making it thread safe seems impossible.
    %

Maybe you are looking for

  • Intermittent freezes upon cold boot

    Greetings gurus, I've been experiencing intermittent freezes on cold boot since a few weeks. I did not have them on 10.5.4. I've only had 4 freezes and according to the CrashReporter log all are identical, as far as I can tell. I have not installed a

  • How Long....?

    I spoke to an Apple employee on the phone this morning about re-downloading songs lost to a hard drive crash. She said she would e-mail instructions to me. How long does it usually take to receive the instructions? It's been 20 minutes since I got of

  • No Extended warranty for HP printers in Canada!

    I contacted HP to purchase an extended warranty for a newly purchased printer, since we do not have a long warranty on HP A-I-O products. I was ready to spend money on purchasing a 3 year extended warranty, but to my surprise, it is not available out

  • Can I measure AC voltage using FP-AI-102? I want to measure in the range of 0-120 VAC

    Can I measure AC voltage using FP-AI-102? I want to measure in the range of 0-120 VAC

  • Desktop Manager Run Errors

    I am running the latest version of Desktop Manager. Something happened within the last couple of months that when I run the application I get a popup window called "Microsoft Exchange Setup Wizard" In the window there is a program checked off called