This can be very useful for managing objects with short time limits. Perhaps you want to communicate with two different types of database servers - having objects that can create queries for these database servers can be very convenient. You, the programmer, can interact with them the same way, but behind the scenes you can use the unix domain socket to talk to the local PostgreSQL, and the other can use the TCP connection from the session pool to talk to the Oracle instance,
Object-oriented programming exists to provide encapsulation and abstraction. Both of them are useful, even if the objects involved are created, live and die, after 0.5 seconds.
sarnold
source share