cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <...@apache.org>
Subject Re: cvs commit: cocoon-2.1/src/blocks/scratchpad/java/org/apache/cocoon/ant AntBuildGenerator.java CocoonTask.java
Date Sat, 17 Apr 2004 15:13:53 GMT
Il giorno 17/apr/04, alle 15:31, Antonio Gallardo ha scritto:

> I think it is a good programming practice plus:
>
> It saves resources.

No, it does not.

``String literals-or, more generally, strings that are the values of  
constant expressions (ยง15.28)-are "interned" so as to share unique  
instances, using the method String.intern.''

(http://java.sun.com/docs/books/jls/second_edition/html/ 
lexical.doc.html#101083)

This means, unless I'm seriously mistaken, that you can always use ""  
instead of StringUtils.EMPTY without using a single bit of memory more.  
And there's no GC involved.

It's just obfuscation without any efficiecy gain.

> Did you really think it is better to make a:
>
> Boolean b = new Boolean(true) instead of
>
> Boolean b = Boolean.TRUE

Never said that.

> Both expresion got the same result, but the first innecesary create
> another Object on the memory. That later the garbage collector need to
> free. This is my POV. The same happen with
>
> StringUtils.EMPTY vs. ""

I'm afraid you are wrong about this, dear friend.

> I really believe in the code reutilization. Jakarta commons lang is  
> part
> of the core of Cocoon. Why we need to wrote the same code over and  
> over?

There is NO code to write or reuse in this case. A simple "" is enough.

	Ugo


Mime
View raw message