   [java] Compiling Question
  First off I think I am going overboard with making everything a class. I have these two classes in sperate packages and they rely on each other, and that makes for tight coupling which is bad right? Well I can't think of any reason why I should do it another way.The two classes are for collision detection, well actually they are interfaces.Collideable and CollisionListenerHere is my directory treesource|------com   |   ------impulse|----event|  ||  -----CollisionListener|----geometry   |   -----CollideableAnd here is my source for the two filespackage com.impulse.geometry;import com.impulse.event.CollisionListener;public interface Collideable{public boolean isCollideable();public void    isCollideable(boolean c);public boolean checkCollision(Collideable other);public void    addCollisionListener(CollisionListener c);}package com.impulse.event;import com.impulse.geometry.Collideable;public interface CollisionListener{public void collisionEvent(Collideable one, Collideable two);}So here is my question assuming you don't think what I am doing is bad, because I am not really that good and I think I cam going to crazy with classes and interfaces and whatever.How do I compile these two files? I have tried every way I can think of and it says they both need the other file to compile. So I thought I can compile them at the same time but I get an errorC:\Java\engine>javac -d /class/ -cp /class/ C:/java/engine/source/com/impulse/event/*.java C:/java/engine/source/com/impulse/geometry/*.javaC:/java/engine/source/com/impulse/event/CollisionListener.java:21: error while writing com.impulse.event.CollisionListener: \class\com\impulse\event\CollisionListener.class (The system cannot find the path specified)public interface CollisionListener{
Quote:Original post by cptrnetpublic interface Collideable{public boolean isCollideable();public void    isCollideable(boolean c);//...I won't comment on the error at hand, as I don't know the details of javac usage; Been using ant for too long, my brain is already frozen [grin]Rather, I noticed the above quote on your code... If something implements Collideable, then Something IS COLLIDEABLE, it's unnecessary to check. So, in your code, all the entities that can be collided with will implement "Collideable"; Everything else is "not collideable" by default. Neat, uh?An interface is a contract of methods that implementor classes need to provide in order to be used by a third part class that does not care about the implemention of said methods. In other words, your loop will need to update several Collideable objects, but it doesn't give a damn about how these instances handle their collisions. Got my point?So, given such a point of view, it is right to assume that interfaces also qualify objects; Something can be "Movable", "Renderable", "Updatable", "Localizable"...Son of Cain   ;  Don't put your event listeners in a separate package.  Put them with the classes that use them.Quote:that makes for tight coupling which is bad right?Tight coupling is an indication to look at your package structure.  See if they should be in the same package.   ;Quote:Original post by cptrnetC:\Java\engine>javac -d /class/ -cp /class/ C:/java/engine/source/com/impulse/event/*.java C:/java/engine/source/com/impulse/geometry/*.java\class\com\impulse\event\CollisionListener.class (The system cannot find the path specified)Maybe you meant C:\Java\engine>javac -d ./class/ -cp  ./class/ c:/whatever.javaor equivalentlyC:\Java\engine>javac -d class -cp  class c:/whatever.javabecause/class/is an absolute path, as the error message tells you.   