First, the overall analysis
The implementation of this system is not difficult, but how to better design the implementation method or need more in-depth analysis, such as: If you add additional functionality, is not required to change
The code is very small, just add a little bit of functionality directly to it? What if you're using a MySQL database instead of Oracle? This should be considered clearly at the design stage.
Second, the specific analysis
1. Create the test package and create the Testbank class to start and run the system. Start
2. Create a service Package
2.1 Create a business Logic Layer class Bank, which defines the main menu method of the banking system, and the operation of the function.
2.2 Create the business logic Layer class Adminservice, complete the bank request, forward to the database operation, and then return the results of the database operation to the bank
Administrator's request.
2.3 Create the Business logic Layer class Adminservice, complete the bank request, forward to the database operation, and then return the results of the database operation to the bank
Customer's request.
3. Create a PO package, define the Admin class and the customer class
The Admin class is a mapping class for database table administrator that stores data for administrator tables.
The customer class is a mapping class for the database table customer that stores the data for the Customer table.
4. Create a DAO package,
4.1 Create the Db.properties file, which holds the database configuration file.
4.2 Create the Config class to load the configuration file contents into the Properties object.
4.3 Create the Basedao class, connect to the database, and perform the operation of the database.
4.4 Create Admindao interface, define administrator login, add customer (account opening), calculate total savings, and regal ranking method.
4.5 Create the Admindaoimpl class, inherit the Basedao, implement the Admindao interface, and use JDBC to complete the corresponding database operation.
4.6 Create Customerdao interface, define customer login, deposit, withdraw, check balance, transfer, change password method.
4.7 Create the Customerdaoimpl class, inherit the Basedao, implement the Customerdao interface, and use JDBC to complete the corresponding database operation.
Summarize:
1. use config to load the database configuration file so that if you change the configuration of the database, you only need to change the configuration information in the file, you do not have to modify the code.
2.thefunction operation in the Bank class, the operation of the function "equals to the foreground display", Daoimpl in the database operation request "database request part", and then return the results of the database operation to the service for processing "equal to intermediate processing" ,theservice accepts the bank's request, then forwards the request to Daoimpl, then accepts the Daoimpl result, processes it, and returns the processing result to the bank's request.
"Level three separation, each part of the completion of specific functions, functional operation Request---> Intermediate forwarding Processing---> Database operations to make the structure clear".
3. Use the Admin,customer class as the mapping class for two tables in the database. The use of objects can not only reduce the frequency of database operations "the project in the part of the customer function is more obvious", more convenient to add the function "for example, increase the administrator to change the password function is very convenient."
Java Connection Oracle Database Development Bank Management System "II. design article"