Results 1 to 2 of 2
  1. #1
    garnaout is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Quick Advice on bad design

    I am reading an array list through an Iterator. There are several displayModes that the user chooses previously (stored in an ArrayList) to decide whether to displayAll or disPlay portions of the screen.

    Java Code:
            ListIterator<String> iterator = myEventsList.listIterator();
    		float triggerTime          = Float.parseFloat(;
            String varA     =;
            String varB     =;
            String varC     =;
            String varD     =;
            ArrayList<String> varE = new ArrayList<String>();
              // all the rest 
            // loop through all chosen display modes
            for(int i=0; i < chosenDisplayMode.size(); i++)
                // no restrictions case - display all
                { return true; }    
                else if(chosenDisplayMode.get(i).equals(DisplayMode.DISPLAY_PART1)) 
                    if(varA.equals("part1")) {return true;}  
                else if(chosenDisplayMode.get(i).equals(DisplayMode.DISPLAY_PART2))
                    if(varA.equals("part2")) {return true;}
                else if(chosenDisplayMode.get(i).equals(DisplayMode.DISPLAY_IF_BOLD))
                    if(varC.equals("BOLD")) {return true;}
                // display static only
                else if(chosenDisplayMode.get(i).equals(DisplayMode.DISPLAY_DYNAMIC))
                    if(varD.equals("DYNAMIC")) {return true;}  

    looks to me a like a lot of if else statements....

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Quick Advice on bad design

    Not knowing about any details, I think the decision should be made by the DisplayMode object.

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Preview design vs Run design
    By diamonddragon in forum NetBeans
    Replies: 3
    Last Post: 02-06-2012, 08:11 AM
  2. advice
    By icedust in forum Advanced Java
    Replies: 1
    Last Post: 10-10-2011, 11:50 PM
  3. Replies: 2
    Last Post: 03-03-2011, 08:23 AM
  4. looking for OO advice
    By intrepid604 in forum New To Java
    Replies: 7
    Last Post: 02-16-2011, 05:01 PM
  5. Im new n looking for an advice
    By azlynn in forum New To Java
    Replies: 2
    Last Post: 12-10-2009, 02:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts