Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Java look and feel mode (Facade mode)     - Try debugfs restore the deleted files ext3 file system (Linux)

- Shell scripts to copy all directories under the current directory of a certain type of file to the same directory (Linux)

- Analysis examples: Intrusion Response Linux platform Case (Linux)

- Mounting kit under Fedora Linux (Linux)

- Usage Linux device tree (Programming)

- Installation and management of Linux applications (Linux)

- MySQL uses mysqld_multi to deploy stand-alone multi-instance detail procedures (Database)

- System Security: Build Linux with LIDS steel castle (Linux)

- Ubuntu install Liferea news subscription software (Linux)

- Linux Network Programming - raw socket instance: MAC header message analysis (Programming)

- CentOS yum source configuration (Linux)

- Install the free open source financial software GnuCash 2.6.6 under Ubuntu (Linux)

- Apache POI Excel Document Processing (Linux)

- Linux package management (Linux)

- CentOS7 install JDK (Linux)

- Linux user management (Linux)

- Git Installation and Configuration (Network Agent settings) (Linux)

- Linux network monitoring strategy (Linux)

- Linux kernel network subsystem analysis (Programming)

- To install OwnCloud 7.0.4 under Ubuntu (Linux)

 
         
  Java look and feel mode (Facade mode)
     
  Add Date : 2018-11-21      
         
         
         
  Facade Definition: Provides a consistent interface to a set of interfaces in a subsystem.

Facade A typical application is the application of the database JDBC, as the following example of the database operation:

Public class DBCompare {
Connection conn = null;
PreparedStatement prep = null;
ResultSet rset = null;
Try {
Class.forName ( "< driver>") .newInstance ();
Conn = DriverManager.getConnection ( "< database>");
In this case,
String sql = "SELECT * FROM < table> WHERE < column name> =?";
Prep = conn.prepareStatement (sql);
Prep.setString (1, "< column value>");
Rset = prep.executeQuery ();
If (rset.next ()) {
System.out.println (rset.getString ( "< column name"));
}}
} Catch (SException e) {
E.printStackTrace ();
} Finally {
Rset.close ();
Prep.close ();
Conn.close ();
}}
}}

Jsp example is the most common way of operating the database.

In the application, often need to operate on the database, each time to write a code above is certainly too much trouble, which need to extract the same part of them, made into an interface, which introduces the appearance of facade objects. If we later replace the Class.forName in the < driver> is also very convenient, such as from the Mysql database for Oracle database, as long as the interface can replace the facade driver.

We made a Facade interface, the use of the interface, the procedures in the above example can be changed as follows:

Public class DBCompare {
String sql = "SELECT * FROM < table> WHERE < column name> =?";
Try {
Mysql msql = new mysql (sql);
Prep.setString (1, "< column value>");
Rset = prep.executeQuery ();
If (rset.next ()) {
System.out.println (rset.getString ( "< column name"));
}}
} Catch (SException e) {
E.printStackTrace ();
} Finally {
Mysql.close ();
Mysql = null;
}}
}}

Visible is very simple, all procedures for database access are used to change the interface, reducing the complexity of the system, an increase of flexibility.

If we want to use the connection pool, as long as the facade interface can be modified.

Facade is actually a system to straighten out the relationship between the system to reduce the coupling between the degree of a common approach, perhaps you have unwittingly in use, although do not know it is facade.
     
         
         
         
  More:      
 
- In addition to wget and curl, what better alternatives (Linux)
- Linux Systems Getting Started Learning: Configuration PCI passthrough on a virtual machine (Linux)
- iSCSI + multipath achieve DM multipath storage (Server)
- Setup Qt development environment under Linux (Linux)
- Java programmers talk about those advanced knowledge and direction (Programming)
- See Shell Script Linux Server network traffic (Server)
- Android design patterns - state mode (Programming)
- Ubuntu 15.04 and CentOS 7 to deploy .NET, Mono and DNX (Server)
- To install MySQL 5.6 binary packages under CentOS 6.4 64bit (Database)
- Some Linux networking tools you might not know (Linux)
- Linux Fundamentals of the text, data flow processing orders (Linux)
- Use SecureCRT to transfer files between Linux and Windows (Linux)
- Oracle row and column switch to turn columns (Database)
- Regular expressions in Perl (Programming)
- React Native (Programming)
- Create, modify, delete users, user groups under linux (Linux)
- How to disable IPv6 on Ubuntu, Linux Mint, Debian (Linux)
- CentOS ClamAV antivirus package updates (Linux)
- Those functions under Linux you do not know the df command (Linux)
- Use Linux firewall camouflage defense hacked (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.