Every time we implement a PooledConnection we write
class MyConnection implements PooledConnection, Connection {
// implement methods of PooledConnection and Connection
}
And I am wondering why PooledConnection was not designed as extends Connection? since a PooledConnection is always a Connection after all.
I’m by no means sure, but I imagine the reason
PooledConnectiondoesn’t extendConnectionis so that you can make a significantly simplerPooledConnectionimplementation that uses any other existingConnectionimplementation, allowing code-reuse and keeping functionality separate.