| To: | "CinJug" <users@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [cinjug-users] Constants imply DP (was: Question on last Mond ay's meeting) |
| From: | "Edward Sumerfield" <esumerfd@xxxxxxxxxxx> |
| Date: | Fri, 25 Feb 2005 13:32:02 -0500 |
| Delivered-to: | mailing list users@cinjug.org |
| Mailing-list: | contact users-help@cinjug.org; run by ezmlm |
| References: | <E58DC1ED41D5D411AAEE00B0D078F16208EF78BE@arnie.collegeview.com> |
|
Agreed, but in this situation we are looking at modeling across languages so
we have the choice between duplication or bugs. Whether you are able to model out your constants for objects or not you have the same problem. I also agree that avoiding code generation would be preferable, just not at the expense of introducing bugs. I did think of a another approach. Since I presume that you have a java based website where the .js file are also deployed, you can easily parse the javascipt name=value format and assign your java constant at startup time. You can also add validation steps to prevent the duplication from being wrong. Make an ant task that compares the two. Make your java init routing validate that the javascript has the same value. Ok, one more solution, make a servlet that is called for .js suffixes and render the javascript live with the appropriate constant replacements as it goes. An implementation variation on this would be to put your java script inside a jsp page so that it can access your java constants directly and use the script tag like this <script language="JavaScript" src="myjavascript.jsp"></script> ----- Original Message ----- From: "Amol Deshmukh" <adeshmukh@xxxxxxxxxxxxxx> To: <users@xxxxxxxxxx> Sent: Friday, February 25, 2005 1:13 PM Subject: RE: [cinjug-users] Constants imply DP (was: Question on last Mond ay's meeting) ...that's still a way to deal with the problem using a Constants approach. (Not to mention that the fact that since MyConstants.java is generated during build, you could get into IDE code completion issues when accessing your constants) |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | RE: [cinjug-users] Constants imply DP (was: Question on last Mond ay's meeting), Amol Deshmukh |
|---|---|
| Next by Date: | Re: [cinjug-users] Does corp. America still trust Java?, Farhan Shah |
| Previous by Thread: | RE: [cinjug-users] Constants imply DP (was: Question on last Mond ay's meeting), Amol Deshmukh |
| Next by Thread: | RE: [cinjug-users] Constants imply DP (was: Question on last Mond ay's meeting), Weirich, James |
| Indexes: | [Date] [Thread] [Top] [All Lists] |