DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16229>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16229 Convenience methods to cut object allocations in application code ------- Additional Comments From [EMAIL PROTECTED] 2003-01-18 21:57 ------- Linus, Just an idea -- use it as you'd like. > I don't see the point of your checkedDebug() method. It does exactly the same > thing as the debug()-method except that same tests are run twice (if enabled). I'm not aware of the implementation of debug(). If it performs the check, then you are correct, checkedDebug() is unnecessary. > logger.debug(new Concatenator("some string", somevar, > "another string", anothervar)); >I considered this solution but I have two things against it. Firstly, this >means that somewhere in my code I will have this utility class or more likely >it will be implemented differently in several different parts of my code by >different developers and some will forget about it. Secondly, this suggestion No, it just has to be on your classpath. You could say the same thing about every class you use. Vector or ArrayList? Enumeration or Iterator? Class duplication is a fact of life. The only way to avoid it is to make sure that the developers on your team are on the same page as far as code conventions are concerned. How do you enforce the use of Logger over System.out? Use the same mechanism to enforce the use of your preferred Concatenation class. >results in the creation of the Concatenator object wether debugging is on or >off. It is better than the creation of StringBuffer+String but not good enough. OK. This is Java. (Almost) Everything is an object. I too am a member of the society against the proliferation of objects. But how much overhead is added to the memory footprint by the concatenation class? "some string", somevar, "another string", and anothervar are going to get allocated either way, AFAIK. That only leaves the pointers required to constitute the Vector in Concatenator. Given that these can/will be garbage collected after use, this is not much of a performance loss, IMO. Looking at your initial code (line 1), it appears that _headline.toString() is the expensive operation. The Concatenation object saves you this method call. I will admit that I'm not a memory optimization expert, so perhaps I've missed something here. If so, please let me know. Also, as you might have guessed, I think the pattern methodA(arg) methodA(arg, arg) methodA(arg, arg, arg) methodA(arg, arg, arg, ..., arg) is rather awkward from a design perspective. I've got to think that there is a better way. - Matt Munz [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>