

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


1
Façade Pattern Apr. 05, 2007
grow in complexity.Frequently, as your programs evolve and develop, they
subsystems, each of which has its own complex interface.Furthermore, there may be a number of complicated
by providing a simplified interface to these subsystems.The Façade pattern allows you to simplify this complexity
users.all the function needed for all but the most sophisticatedflexibility of the underlying classes, but usually providesThis simplification may in some cases reduce the
classes and methods.These users can still, of course, access the underlying
3
databases using an interface called JDBC.Java provides a set of classes that connect to
class -- almost every database on the market.manufacturer has provided a JDBC connectionYou can connect to any database for which the
using the JDBC-ODBC bridge class.JDBC and a few allow connection to ODBC driverSome databases have direct connections using
To connect to a database, you use an instance of the Connection class.
to get an instance of the DatabaseMetadata class from the Connection.Then, to find out the names of the database tables and fields, you need
Connection to create a Statement class.Next, to issue a query, you compose the SQL query string and use the
an instance of the ResultsetMetadata class.out the names of the column rows in that ResultSet, you need to obtainBy executing the statement, you obtain a ResultSet class, and to find
messy.most of the calls to their methods throw Exceptions, the coding can beThus, it can be quite difficult to juggle all of these classes and since
5
(note the lowercase “r”), we can build a much more usable system.By designing a Façade consisting of a Database class and a resultSet class
7