[ 
https://issues.apache.org/jira/browse/DERBY-223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534290
 ] 

John H. Embretsen commented on DERBY-223:
-----------------------------------------

I think there is a tradeoff here between simplicity and IDE (Eclipse?) 
compatibility (and Java recommended practices). 

First of all, this change will make things a little bit more complicated for 
users who run the demo outside an IDE. For example, this currently works (as 
described in the instructions):

$ cd demo/programs/simple/
$ export CLASSPATH=.:$DERBY_INSTALL/lib/derby.jar
$ java SimpleApp

The proposed change requires the user to do something like this:

$ cd demo/programs/simple/
$ export CLASSPATH=..:$DERBY_INSTALL/lib/derby.jar
$ java simple.SimpleApp

or this:

$ cd demo/programs/
$ export CLASSPATH=.:$DERBY_INSTALL/lib/derby.jar
$ java simple.SimpleApp

(in the latter case the database will end up in a common directory for all the 
demo programs - potentially confusing)

I'm just thinking that we should try to keep "simple" demos as simple as 
possible...

On the other hand, Eclipse users might benefit from this change (not sure how 
other IDEs handle this). 
And, there are other benefits of not using the default (unnamed) package, such 
as the ability to import and reuse the code. 
Does anyone else have opinions on this?

(Speaking of package names, we might want to follow recommendations in the Java 
language specification (ยง6.8.1) and use org.apache.derby... package names for 
all the demos).

Anyway, the current proposed patch changes the code but does not include 
required updates to the documentation (readme/example HTML files in the demo 
subdirectories). For example, with the simple demo, the current patch will 
result in the following error if instructions in java/demo/simple/example.html 
for running in embedded mode are followed verbatim:

$ java SimpleApp
Exception in thread "main" java.lang.NoClassDefFoundError: SimpleApp (wrong 
name: simple/SimpleApp)


> Change programs under demo directory use consistent package names so IDEs do 
> not report errors
> ----------------------------------------------------------------------------------------------
>
>                 Key: DERBY-223
>                 URL: https://issues.apache.org/jira/browse/DERBY-223
>             Project: Derby
>          Issue Type: Improvement
>          Components: Demos/Scripts, Newcomer
>            Reporter: John Sisson
>            Assignee: Thomas Nielsen
>            Priority: Trivial
>         Attachments: d223.diff, d223.stat
>
>
> Currently if you build the demos under eclipse, it gives the following errors:
> Severity      Description     Resource        In Folder       Location        
> Creation Time
> 2     The declared package does not match the expected package nserverdemo    
> SimpleNetworkClientSample.java  derby-trunk/java/demo/nserverdemo       line 
> 1  April 14, 2005 9:32:35 AM
> 2     The declared package does not match the expected package nserverdemo    
> SimpleNetworkServerSample.java  derby-trunk/java/demo/nserverdemo       line 
> 1  April 14, 2005 9:32:35 AM
> 2     The declared package does not match the expected package simple 
> SimpleApp.java  derby-trunk/java/demo/simple    line 1  April 14, 2005 
> 9:32:35 AM
> The following demo src files (and their associated documentation for running 
> them) should be changed so that they specify the package "nserverdemo" so 
> they are consistent with the other java source files in the same directory:
> java/demo/nserverdemo/SimpleNetworkClientSample.java
> java/demo/nserverdemo/SimpleNetworkServerSample.java
> The following demo src files (and their associated documentation for running 
> them) should be changed so that they specify the package "simple" so they are 
> consistent with the other java source files in the nserverdemo directory:
> java/demo/simple/SimpleApp.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to