www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Best practice: Project structure

reply Stefan <Stefan_member pathlink.com> writes:
Hi,

as a beginner (used to proagram with Java and long time ago C/C++) I would like
to know how to structure a project.
īShouldī a D-project look similar to a Java-project, i.e. having a source folder
with the package/module folders and D/class files? Where to put libs, ..?
EclipseDDT does not work with my current Eclipse 3.1.1, so I use Crimson-Editor.
What build tool is preferable, in the case I donīt like shell scripts.

Thanks,
Stefan
Feb 07 2006
next sibling parent pragma <pragma_member pathlink.com> writes:
In article <dsad07$29kp$1 digitaldaemon.com>, Stefan says...
Hi,

as a beginner (used to proagram with Java and long time ago C/C++) I would like
to know how to structure a project.
īShouldī a D-project look similar to a Java-project, i.e. having a source folder
with the package/module folders and D/class files?
Good question! (FYI, you'll get a better response to these kinds of questions over on the digitalmars.D.learn group: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.learn) You'll be in good shape if you apply your Java experience over into D with respect to package and class management. D does give you more flexibility in terms of packaging things, but if you keep to the one-class-per-file Java rule, you can't go wrong. You'll know when the time comes to deviate from that. If you want to see how D projects of scale are laid-out, head over to D source (http://www.dsource.org/projects/) and browse through the SVN repository for a few projects. I'd reccomend browsing Build and Mango as they are both well used, sizable, and well maintained.
EclipseDDT does not work with my current Eclipse 3.1.1, so I use Crimson-Editor.
What build tool is preferable, in the case I donīt like shell scripts.
Heh, I use Crimson too, but I don't use its built-in hooks for launching scripts or builds; I keep a command-prompt in a separate window for that. Do yourself a favor and download 'build' from dsource. While it's not an official part of the D toolchain, it's practically standard equipment around here. http://www.dsource.org/projects/build Place this on your path along with dmd/bin and dm/bin folders (I just put build.exe in dmd/bin myself) and you'll be good to go. Also, be sure to check out the forums on dsource as well, as they're packed with good information. Oh, and say goodbye to ANT or makefiles. You won't be needing those anymore. :)
 Where to put libs, ..?
Its the same story as with C/C++. You may want to put them where the compiler looks for standard .lib files (dmd/lib) or use your own directory. In the latter case, you'll have to use a command-line parameter to build/dmd to specify where to look. - Eric Anderton at yahoo
Feb 07 2006
prev sibling next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Stefan wrote:

 īShouldī a D-project look similar to a Java-project, i.e. having a source
folder
 with the package/module folders and D/class files? 
It's the same as with Java, i.e. module/class.d You will find that some packages "cheat" and name their top directory "module" and do a DFLAGS=-I.. (which also why it breaks, if you rename the dir) --anders
Feb 07 2006
prev sibling next sibling parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
Stefan wrote:
 Hi,
 
 as a beginner (used to proagram with Java and long time ago C/C++) I would like
 to know how to structure a project.
Just like java. [snip]
 What build tool is preferable, in the case I donīt like shell scripts.
 
build ( http://www.dsource.org/projects/build ) is the de-facto standard D build tool. It's kind of like javac, but even better (I think, atleast with respect to packages, I never wrapped my head around compiling a packaged project in java, I always let eclipse do it for me. With build, it's a snap).
Feb 07 2006
prev sibling parent nick <nick.atamas gmail.com> writes:
Stefan wrote:
 Hi,
 
 as a beginner (used to proagram with Java and long time ago C/C++) I would like
 to know how to structure a project.
 īShouldī a D-project look similar to a Java-project, i.e. having a source
folder
 with the package/module folders and D/class files? Where to put libs, ..?
 EclipseDDT does not work with my current Eclipse 3.1.1, so I use
Crimson-Editor.
 What build tool is preferable, in the case I donīt like shell scripts.
 
 Thanks,
 Stefan
You bring up a good point, Stefan. As a beginner, someone should be able to go to a D-site and get started right away. An effort in making D-related info/tools consolidated and organized is definitely going to happen as the feature freeze approaches. BTW, Walter, when is that going to be? Do you have a date in mind?
Feb 07 2006