Small high early math learning software with the UI - Jisheng Yi Zhang Hongming pair programming summary

First, the functional requirements 

  1, user registration function. The user's phone number, click on the registration will receive a registration code, the user can use this registration code to complete the registration;

  2, after the completion of user registration, password prompt interface, user input password matches the password twice after the success. 6-10 password, the case must contain letters and numbers. Users can change the password, enter the correct password in the log in the original state, change your password after successfully re-enter the same new password twice;

  3, after the password has been set, jump to the selection interface, display interface elementary, middle and high school three options, the user clicks on one of them, prompting the user to enter the number of items need to be generated;

  4, the number of items the user input, generating a piece of paper (with a roll can not have the same title, all entitled multiple choice), the interface displays the first question and casual working four options, the user selects one of the four options submission interface displays the second question, ... until the last question;

  5, after the submission of the last question, the display interface, the score is calculated based on the percentage of correct answers;

  6, the user interface can opt out of the score or continue to do problems;

  7, small high math problem and asked to see the beginning of a personal project.

Second, the functional test

  1. Registration Function: using a mobile phone number registered, phone for the code, the authentication code input for confirmation, and then set a password, the password setting must satisfy 6-10, including uppercase and lowercase letters and numbers, and the password must be twice same, the match is successful, the user was registered successfully.

  2. Log function: You can log on the topic by password and mobile phone number provided after registration is complete, if the password is not the same as it will be error, and can not log into the system;

  3. Function topic: After entering a question selection, the user can select the appropriate grade itself according to the topic, topic and then enter the appropriate selection of the number, the number of items entering the desired topic and click, will enter the interface topic and appear in the following four options and only one correct answer, the final score will be based on the statistics of the number of items answered correctly.

  4. Reset Password function: the user can enter the password reset function interface, enter the old password by resetting the cipher key, and then enter the new password, the new password confirmation, when the same new password twice and password meet the requirements of the case, It will reset your password.

Third, to achieve points

  1. Realize the overall architecture: We put the code part of our program implemented in src, the elements that we use to place pictures in images, and in the back for the database connection using the jar package.

  

  2.图形界面的实现:刚开始本着要用html来实现图形界面的实现,但是队友有javaui的使用经验,在他的推荐之下,我们使用eclipse的可视化插件WindowBuilder进行辅助设计,通过插件可以对界面实行简单的实现,再通过我们修改代码进行不断完善,极大加快了我们的图形界面的开发效率。

  3.出题功能的重用:在之前的个人项目之中我们实现的出题代码,我们通过类进行封装,我们可以通过类进行调用返回实现我们的题目字符串,但是这次完成的功能必须实现题目结果的计算,所以我们在返回值改成了字符串数组,一个用于返回我们的题目字符串,另一个字符串返回的是我们对其中的特殊字符计算后的题目字符串,可用于在后面我们可以通过直接调用逆波兰表达式对结果进行计算。

  4.题目的生成和结果的计算:在进行出题时,因为我们必须保证题目的不可重复性,我们必须一次性将所有题目放入hashset进行校验,所以我们选择在开始时直接生成所有的题目和结果,分别放入problem字符串数组和result数组,我们就可以通过直接将这些题目和结果作为参数进行传参,保证题目的唯一性,为了节省空间,我们对选项的随机生成并没有放入数组进行传参,而是通过在接下来的递归调用中进行生成。

  5.题目的跳转与计分:我们对题目的跳转是通过不断的递归调用来实现的,当我们选择了一个选项并进行确认时,我们就会重新生成一个窗口对象,传入我们之前生成的题目和结果和当前的是第几个题目,再通过随机化的方法,我们就可以生成四个选项,生成了我们的题目。至于计分困扰了我们很久,后来我们选择通过类的静态变量来进行实现,因为当我们递归调用生成类的时候,我们对对象的类的静态变量的更改会影响到这个类的所有对象,由此我们可以进行计分,当再次重新开始出题时我们只需将计分个数初始化为0即可。

  

  6.数据库的实现:用于对用户信息的保存,刚开始的个人项目中我使用的是文件的保存,当时面对现在要实现的功能,用文本实现复杂化,所以我们用数据库mysql对用户信息进行管理,同时使用mysql专用的数据库管理软件对管理更加有效,安全性更高。

  

 1  1 package testPaperUI;
 2  2 import java.sql.Connection;
 3  3 import java.sql.DriverManager;
 4  4 public class dbhelp {//数据库连接
 5  5     private static final String driver = "com.mysql.cj.jdbc.Driver";
 6  6        private static final String url = "jdbc:mysql://localhost:3306/test?userUnicode=true&characterEnconding=UTF-8&serverTimezone=UTC";//test为数据库
 7  7        private static final String username = "user";//账号
 8  8        private static final String password = "123456";//密码
 9  9        private static Connection conn = null;
10 10        
11 11        static {
12 12            try {
13 13             Class.forName(driver);
14 14         } catch (Exception e) {
15 15             e.printStackTrace();
16 16         }
17 17        }
18 18        
19 19        public static Connection getConnection() throws Exception{
20 20            if(conn == null) {
21 21                conn = DriverManager.getConnection(url,username,password);//获得连接
22 22                return conn;
23 23            }
24 24            return conn;
25 25        }
26 26        
27 27        public static void main(String[] args) {//测试主函数
28 28            try{
29 29                Connection conn = dbhelp.getConnection();
30 30                if(conn != null) {//获得连接输出正常
31 31                    System.out.println("数据库连接正常");
32 32                }else {//连接失败输出异常
33 33                    System.out.println("数据库连接异常");
34 34                }
35 35            }catch(Exception e) {
36 36                e.printStackTrace();
37 37            }
38 38        }
39 39 
40 40 
41 41 }
View Code

 

四、结对编程总结

  这是我的第一次结对编程体验,给我带来一种新的编码方式,通过两个结对编写代码,我们互相发现对方编码中的小错误,互相提醒,提高了我们编码的正确性,减少了我们后期的调整调试的时间,很大提到了我们的编码效率。同时,我们又在不同的方面了解更多一些,我更熟悉后台编码的实现,而我的队友更熟悉前端界面的实现,我们各有所长,在相应的部分我们可以发挥各自的长处,大大提高了我们整个项目的实现效率。在这次结对编程中,通过和队友的对比也发现了自己还有很多不足,在接下来的学习中,我将会更加努力提升自己的能力。

Guess you like

Origin www.cnblogs.com/jishengyi/p/11605391.html