Is it OK to call and Interface from a different package, or is this 'bad practice'?
I ask this because i have a simple database pooling project, which has the following structure:
+ com.myproject.connection
- ConnectionPoolmanager (well it's a DB connection pool manager)
- ConnectionManager (Uses ConnectionPoolManager to create/drop DB connecitons, returns Connection CONN)
- ConnectionInterface (interface to create/drop connection methods in Connectionmanger class)
+ com.myproject.sql
- SQLBuilder (builds SQL query based on fields, colums, table)
And basic code doing the following...
SQLBuilder.class:-
import com.myproject.connection.ConnectionInterface;
import com.myproject.connection.ConnectionManager;
...
ConnectionInterface Icon = new ConnectionManager();
...
My question is, what's the point of the Interface (or am I using it completely wrongly) because surely I can do teh exact same thing with the fllowing code:
import com.myproject.connection.ConnectionManager;
...
ConnectionManager Icon = new ConnectionManager();
...
Just I don't see the benifit of the Interface, it just seems to be another 'step' for the sake of it, I know it means there is no direct conneciton to the Connectionmanager class but still don't see the benifit.
Cheers
I ask this because i have a simple database pooling project, which has the following structure:
+ com.myproject.connection
- ConnectionPoolmanager (well it's a DB connection pool manager)
- ConnectionManager (Uses ConnectionPoolManager to create/drop DB connecitons, returns Connection CONN)
- ConnectionInterface (interface to create/drop connection methods in Connectionmanger class)
+ com.myproject.sql
- SQLBuilder (builds SQL query based on fields, colums, table)
And basic code doing the following...
SQLBuilder.class:-
import com.myproject.connection.ConnectionInterface;
import com.myproject.connection.ConnectionManager;
...
ConnectionInterface Icon = new ConnectionManager();
...
My question is, what's the point of the Interface (or am I using it completely wrongly) because surely I can do teh exact same thing with the fllowing code:
import com.myproject.connection.ConnectionManager;
...
ConnectionManager Icon = new ConnectionManager();
...
Just I don't see the benifit of the Interface, it just seems to be another 'step' for the sake of it, I know it means there is no direct conneciton to the Connectionmanager class but still don't see the benifit.
Cheers