Brendan wrote:
> The CSpValue cast is unnecessary.
>...
> NULL is bad as an application level concept because it has many meanings,
> like not yet set, not included, unknown, not applicable etc.
> A static final String called NOT_SPECIFIED_BY_USER would be clear.
Excellent points.
Anyone who uses my bean advice, also do what Brendan says. :-)
> I quite like the bean approach as it hides the communication mechanism, but
> what object do you want to put the methods in Joel?
> As they are written they could be static and anywhere.
Yes, like in an external package such as
package com.mycompany.mydepartment.myproject;
public class MyUtilities { ... }
then imported by the page, applet, or whatever else like this:
import com.mycompany.mydepartment.myproject.MyUtilties;
I use these kinds of external packages for project-wide accessors,
string constants, utilty functions, etc. Yes, this creates static
functions, which violates object encapsulation; for me personally,
this is an acceptable tradeoff because I reuse a lot of code
among many projects, and CSpider is already static.
Another example would be the followup question about quoting;
my personal style is to do a utility function like this:
public String upquotes (String s) {
return "\""+s.toUpperCase().trim()+"\"";
}
public String getMy (String s) {
// I use this because I have other ways of storing sessions.
// Using a wrapper function isolates my other code from CSpider.
return CSpider.getUserSessionObject(s).toString();
}
public static final String kSesName = "sesName";
Then in my page.java, I would write:
CSpValue name = new CSpString(MyUtilties.upquotes(getMy(kSesName)));
-Joel
[EMAIL PROTECTED]
[EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]