Paul wrote: "I think where ever possible we should start to use reusable Utility methods or UI components, there is a lot of local code and classes in JUMP which do exactly the same thing."
This is my goal Paul. Thank you for putting it so concisely. Larry wrote: "The trick is recognizing the difference between reusing code and creating dependencies." Here is what I use as a "measuring stick" to see if a method should be included in a utility class: Am I going to be using this method in more than one of my own classes? Could other programmers use the method? Could the method be a static method, or does it depend on the state of the host class? It seems like my example of setting the contents of the JList with layer names is an example that meets the criteria of the three (3) questions stated above. I could make the method local to my GUI component, but then I would have duplicated code in any of my GUI classes that need to have a JList that shows a list of Layer names. (I think this would be a fairly common use of a JList in OpenJUMP.) The only evil worse than a maze of dependencies is a bunch of duplicated logic. I only like to fix logic bugs one time. :] Like all other things, we must try to find the right balance. Thanks for the feedback. I know both Paul and Larry are more experienced programmers than I am. I always listen carefully to what they have to say! The Sunburned Surveyor On 9/18/07, Larry Becker <[EMAIL PROTECTED]> wrote: > True. The trick is recognizing the difference between reusing code > and creating dependencies. > > Larry > > On 9/18/07, Paul Austin <[EMAIL PROTECTED]> wrote: > > I think where ever possible we should start to use reusable Utility > > methods or UI components, there is a lot of local code and classes in > > JUMP which do exactly the same thing. > > > > The biggest case is a whole bunch of ActionListener classes which then > > call say xxx_actionPerformed on the main class. If you had an > > InvokeMethodAction that would take a method name and instance and just > > invoke that method, then you'd save a whole bunch of PermGen memory by > > having less classes. > > > > Paul > > > > Larry Becker wrote: > > > SS, > > > > > > If you are already using the other methods in DialogUtil, then don't > > > worry about it, otherwise why not just keep the method local? > > > > > > thanks, > > > Larry > > > > > > On 9/18/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > > > > > >> Larry, > > >> > > >> Would there be a solution that would work for SkyJUMP? I will be > > >> putting together an surveyos_openjump_utilities JAR file, and I could > > >> put a DialogUtil class in there if it is a better fit. > > >> > > >> I'm just trying to keep duplication to a minimum. > > >> > > >> The Sunburned Surveyor > > >> > > >> On 9/18/07, Larry Becker <[EMAIL PROTECTED]> wrote: > > >> > > >>> The only reservation I have is to note that this class exists only in > > >>> OpenJump. > > >>> > > >>> regards, > > >>> Larry > > >>> > > >>> On 9/18/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > > >>> > > >>>> Does anyone have a problem with my adding a method to the DialogUtil > > >>>> class? This method would accept a JListBox and a reference to a > > >>>> LayerManager as arguments. It would then set name of each Layer in the > > >>>> LayerManager as the values in the JListBox. > > >>>> > > >>>> If this method is not appropriate for the DialogUtil class I will put > > >>>> it in one of my own utility classes, but I was trying to keep this to > > >>>> an absolute minimum. > > >>>> > > >>>> If this method is available as a public method of another class, > > >>>> please let me know and I will use it instead. > > >>>> > > >>>> Thanks, > > >>>> > > >>>> The Sunburned Surveyor > > >>>> > > >>>> ------------------------------------------------------------------------- > > >>>> This SF.net email is sponsored by: Microsoft > > >>>> Defy all challenges. Microsoft(R) Visual Studio 2005. > > >>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > >>>> _______________________________________________ > > >>>> Jump-pilot-devel mailing list > > >>>> Jump-pilot-devel@lists.sourceforge.net > > >>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > >>>> > > >>>> > > >>> -- > > >>> http://amusingprogrammer.blogspot.com/ > > >>> > > >>> ------------------------------------------------------------------------- > > >>> This SF.net email is sponsored by: Microsoft > > >>> Defy all challenges. Microsoft(R) Visual Studio 2005. > > >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > >>> _______________________________________________ > > >>> Jump-pilot-devel mailing list > > >>> Jump-pilot-devel@lists.sourceforge.net > > >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > >>> > > >>> > > >> ------------------------------------------------------------------------- > > >> This SF.net email is sponsored by: Microsoft > > >> Defy all challenges. Microsoft(R) Visual Studio 2005. > > >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > >> _______________________________________________ > > >> Jump-pilot-devel mailing list > > >> Jump-pilot-devel@lists.sourceforge.net > > >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > >> > > >> > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2005. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > Jump-pilot-devel mailing list > > Jump-pilot-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > > > > -- > http://amusingprogrammer.blogspot.com/ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel