facade: loose coupling && fewer dependencies

One j4 facade — loose coupling and fewer “dependencies”.

Without a facade, a client object may need 5 instance variables to access 5 “services” either hosted in the same or hosted in a different JVM [2]
– logger “service”
– authentication service
– authorization service
– status-check service
– connection-pool or dataSource
– transaction manager
– sessionFactory’s static “services”
– StudentDAOFactory, ProfessorDAOFactory….

Basic OO principle lets each subject expert author (and maintain) her object, and require all client objects to get a reference [1] (a dependency) to her object.

[1] either static field or instance field
[2] perhaps through JNDI lookup

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s