Re: Structuring a library project—best practices

Zarathustra adam.chrapkowski at gmail.com
Wed Feb 11 13:02:32 PST 2009


Hello Joel

Maybe, you should look on the Helix Library.
www.dsource.org/projects/helix
But in my opinion you should write down all classes which You want to implement in your library, and then all relations between these classes. This approach warrants you essentially correct structure. I don't know what do you mean when you write "test". If you want to test yours classes then the best method are the unittests. But if you only want to verify that library was correct installed then you just should use any component of the library. That as you do that in your example code. If you will write more about targets of your library then I could tell you more.
I really apologizefor my horrible English, but I hope you understood.

------------------------------------

Joel C. Salomon Wrote:

> I’m starting work on my Geometric Algebra library
> <http://www.dsource.org/projects/gald>, and I’d like some tips on
> structuring the source tree. Is there a “standard” place to put the
> library test/demonstration?
> 
> Right now I’m starting with:
> 
> trunk/
>       gald/
>            e2.d
>       test.d
>       dsss.conf
> 
> with the files as follows:
> 
> e2.d:
> 	module gald.e2;
> 
> 	struct vector2 {
> 		real x;
> 		real y;
> 	}
> 
> test.d:
> 	module test;
> 
> 	import gald.e2;
> 
> 	int main(char[][] args) {
> 		vector2 v;
> 		return 0;
> 	}
> 
> dsss.conf:
> 	name=gald
> 	[gald]
> 	[test.d]
> 	target=test_gald
> 
> Is this a reasonable start, or am I buying trouble for myself with the
> layout and module declarations? What are the “best practices” for such a
> project?
> 
> —Joel Salomon



More information about the Digitalmars-d-learn mailing list