codebase - Organizing the source code base when mixing two or more languages (like Java and C++) -
i ran problem few days ago when had introduce c++ files java project. started need measure cpu usage of java process , decided way go use jni call out native library (a shared library on unix machine) written in c. problem find appropriate place put c files in source repository (incidentally clearcase) consists of java files.
i thought of couple of alternatives:
(a) create separate directory putting c files (specifically, 1 .h file , 1 .c file) @ top of source base like:
/vobs/myproduct/javasrc /vobs/myproduct/cppsrc
i didn't because have 2 c files , seemed odd split source base @ language level this. had substantial portions of project been written more or less equally in c++ , java, okay.
(b) put c files java package uses it.
i have calling java classes in /vobs/myproduct/com/mycompany/myproduct/util/ , c files go in there.
i didn't either because think c files don't belong in java package.
has solved problem before? generally, what's strategy follow when organizing codebase mixes 2 or more languages?
update: don't have plan use c or c++ in project, jython perhaps, never know when customers need feature can solved using c or best solved using c.
"i didn't because have 2 c files , seemed odd split source base @ language level this"
why seem odd? consider project:
project1\src\java project1\src\cpp project1\src\python
or, if decide split things modules:
project1\module1\src\java project1\module1\src\cpp project1\module2\src\java project1\module2\src\python
i guess it's matter of personal taste, above structure common, , think works quite once used it.
Comments
Post a Comment