Object or Package ?
David Bernard <[email protected]> Thu, 07 Jul 2005 18:41:44 +0200
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
I need some precision to understand my misunderstood about organisation.
When I start to read document about Nice, I was happy because I think
great no more need to declare Helper class to enhance existing Class
(e.g. StringUtils in jakarta-commons/lang). I put the "jar" in the
classpath and the compiler detect extension So I could write :
String s ="...";
if (s.isBlank) {
...
}
without need to import other thing than String to tell compiler that
String is an alias for java.lang.String.
So if method about String could be define in any package. Do I need to
tell from witch package, the method come ?
In this case :
// in Nice
import stringEscapeUtils;
...
void doStuff() {
let s = "...";
println(s.escapeXml());
}
....
is similar to
// in java 1.2-1.4
import org.apache.commons.lang.StringEscapeUtils;
...
public void doStruff() {
String s = "...";
System.out.println(StringEscapeUtils.escapeXml(s));
}
// in java 1.5 (with static import)
import static org.apache.commons.lang.StringEscapeUtils;
...
public void doStruff() {
String s = "...";
System.out.println(escapeXml(s));
}
Is it true ?
In this case Nice is a functionnal language with advanced feature about
structure (like Constructor, Properties, Inheritance,...). I thing it's
important because it helps to understand the approach and how to
organize source, documentation/api (object or functionnal),
Is it equivalent to write "o.equals(o2)" and "equals(o, o2)" ?
--
--------------------------------------------------------------
David "Dwayne" Bernard Freelance Developer (Java)
mailto:[email protected]
\|/ http://dwayne.java-fan.com
--o0O @.@ O0o-------------------------------------------------
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click