Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (myname):

Is package only related to the IDE in java? If not then where is the package while using notepad?

OpenStudy (anonymous):

packages in Java have two parts: 1) the declaration in your .java file as to which package the class belongs to. 2) the place of the file within the directory structure Simply speaking, for the compiler (and later the virtual machine) to properly find and use your class(es), they need to be in directories (2) that match the declaration (1). Your IDE usually takes care of that; when you just use Notepad, you would have to take care of it yourself.

OpenStudy (myname):

IS the name of the project also the name of the package? That's what it shows on the NetBeans.

OpenStudy (shadowfiend):

It can be. It depends on how you set up your project. The name of a given package is arbitrary, entirely up to you.

OpenStudy (shadowfiend):

(Subject to certain constraints like not containing symbols, etc).

OpenStudy (anonymous):

it would be highly unusual for a project name to be identical to the name of the package, because that would mean that the project only contains files from one package. This is normally the case only for very simple projects. Howver, if you consider subpackages of a package, say com.openstudy, with perhaps a subproject com.openstudy.smartscore to be part of the top level package (called com.openstudy), that'd be a useful convention, and one that I've seen very frequently. You start out with just the com.openstudy project, and as you add sub-projects, perhaps the one project becomes unwieldy (or for numerous other reasons), at some point you'd split off a sub-package and give the project its name. None of this is a requirement, it's just a (useful) convention. You can name your Netbeans projects whatever you want.

OpenStudy (shadowfiend):

♥ the example :) Actually, our package structure: com.openstudy -> com.openstudy.actor -> com.openstudy.comet -> com.openstudy.lib -> com.openstudy.model -> com.openstudy.rest -> com.openstudy.snippet

OpenStudy (anonymous):

and your project structure?

OpenStudy (shadowfiend):

Directory-wise?

OpenStudy (anonymous):

I usually separate them by SVN "project" (or OSGi bundle / Eclipse plug-in)

OpenStudy (shadowfiend):

We use the standard Java com/openstudy/{actor,comet,lib,model,rest,snippet} model, and that's all under src/main/, maven-style. Despite the fact that there is a sum total of one Java file in our project :) Everything else (server-side) is Scala.

OpenStudy (shadowfiend):

Ah, yes, well, we currently only have the one project, one repository, so one directory structure.

OpenStudy (shadowfiend):

Though depending on some of the scaling strategies we have in mind, that may change soonish.

OpenStudy (anonymous):

how about the JS stuff?

OpenStudy (shadowfiend):

JS stuff is grouped in functionally-related files, at src/main/webapp/javascripts. No subdirectories there (for now). Sometime in the near term, we're looking on porting things over to CoffeeScript and probably modularizing a bit more.

OpenStudy (shadowfiend):

At deploy time, related files are joined and minified into monolithic module files.

OpenStudy (anonymous):

i c. Well, I'm hoping I'm not exposing too many secrets ;-)

OpenStudy (shadowfiend):

Not at all :) Always happy to talk about our architecture.

OpenStudy (anonymous):

I would love to continue, but I really gotta go; it's late and I still have some other things to do. CS seems quiet for now :-)

OpenStudy (shadowfiend):

Haha all right. Feel free to post any architecture-related questions here and @-mention me. I'll answer as I have time.

OpenStudy (myname):

Thank You both nczempin and shadowfiend

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!