Separate compilation of interfaces and implementations?

Discussion in 'Java' started by Dan Stromberg, Jan 3, 2008.

  1. I'm doing some work on a large software project that has mutual
    dependencies - EG, the build of jar A depends on jar B's interface, and
    the build of jar B depends on jar A's interface.

    It seems these dependencies could be resolved nicely if we were to build
    the interface of A, then the interface of B, then the implementation of
    A, then the implementation of B - just for example. Or more generally,
    just go through and build all the interfaces first, then go back and
    build all the implementations.

    Does java support this sort of thing? I'm not expecting java to invoke
    the compiler for me, but I am hoping that java will allow taking a bunch
    of .java's, and produce two jars for them - one for public interfaces and
    one for the private interfaces and implemtations.

    Thanks!
     
    Dan Stromberg, Jan 3, 2008
    #1
    1. Advertising

  2. On Jan 3, 1:03 am, Dan Stromberg <> wrote:
    > I'm doing some work on a large software project that has mutual
    > dependencies - EG, the build of jar A depends on jar B's interface, and
    > the build of jar B depends on jar A's interface.
    >
    > It seems these dependencies could be resolved nicely if we were to build
    > the interface of A, then the interface of B, then the implementation of
    > A, then the implementation of B - just for example. Or more generally,
    > just go through and build all the interfaces first, then go back and
    > build all the implementations.
    >
    > Does java support this sort of thing? I'm not expecting java to invoke
    > the compiler for me, but I am hoping that java will allow taking a bunch
    > of .java's, and produce two jars for them - one for public interfaces and
    > one for the private interfaces and implemtations.
    >
    > Thanks!


    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    It is not good practice to have such mutual dependencies.
    A simple solution would be to simply place the public
    interfaces in a separate directory from the private
    interfaces and implementations. Remember to compile and jar
    the public interfaces first. After you have compiled and
    jarred the public interfaces, then you can (with appropriate
    classpath additions) compile and jar the private interfaces
    and implementations.

    Emory Merryman
    External Concepts Guild
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.7 (GNU/Linux)

    iD8DBQFHfOiBVQdj5Q2e9q0RAkI+AJ4vJfXAd+ZnvWvDl+v0gnGo9JB1+gCfbbg4
    jxxv36h5VWeaVjusm/YXsIc=
    =7gx5
    -----END PGP SIGNATURE-----
     
    External Concepts Guild, Jan 3, 2008
    #2
    1. Advertising

  3. External Concepts Guild wrote:
    >
    > It is not good practice to have such mutual dependencies.
    > A simple solution would be to simply place the public
    > interfaces in a separate directory from the private
    > interfaces and implementations. Remember to compile and jar
    > the public interfaces first. After you have compiled and
    > jarred the public interfaces, then you can (with appropriate
    > classpath additions) compile and jar the private interfaces
    > and implementations.


    Even better, place the public interfaces (and anything else you want
    to go into the lower-level jar) in a separate source tree. That makes
    it much harder for wrong-way dependencies to creep into the code.
     
    Mike Schilling, Jan 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. EvgueniB
    Replies:
    1
    Views:
    644
    Anthony Borla
    Dec 15, 2003
  2. SenderX
    Replies:
    7
    Views:
    381
    Greg Comeau
    Aug 29, 2003
  3. Chris Mantoulidis
    Replies:
    3
    Views:
    416
    Jared Dykstra
    Dec 20, 2003
  4. Andreas Schmidt
    Replies:
    2
    Views:
    303
    David Harmon
    Apr 9, 2004
  5. Frank Fredstone
    Replies:
    1
    Views:
    451
    Jean-Francois Briere
    Jun 27, 2006
Loading...

Share This Page