Pair programming - Experience

The pair programming von classmates and I team up in order to speed up development, I am responsible for UI design and function calls front-end, Feng students is to write a function responsible for the back end.

 

A requirement specification

  user:

  Elementary, middle and high school students.

  Features:

  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 code reuse

       As the project is based on the first project, so the demand for the project has been realized in many functions, it can be reused.

  Said before, because the first time for the lack of architectural design in this project, module reuse of von students.

       These two projects have many identical modules function, such as landing module, the module out of the question. Landing module touches no complicated relations calls, because it can be implemented in the front section.

  But the user name and password need to read from the file / database, which is more difficult than before. The same modules in different situations, difficulty of implementation is different. Similarly, the question before the module can not be considered to calculate the answer, but we must consider in this project.

 

Three pair programming experience and lessons learned

       Although I am in charge of this program is relatively simple front end, but in fact still faced many problems.

Select a tool

  Since I use the java language development, involving UI design it is very natural to think of the swing. But I'm not particularly familiar with the swing, and the layout of the components is a very daunting thing.

  Fortunately, he reminded the students, I found windowbuilder this plug-in that provides a visual page design, greatly reduce the workload.

 

   

         FIG · 1 windowbuilder page (visual programming, may generate a corresponding code)

 

Two UI design process

  In the first design, concept and then implemented. I will simply use the word made a prototype of the page. Then use the above tools, I quickly realized this model.

 

 

Figure 2 prototype login screen (marked used components)

 

  Then before my difficulty is how to switch pages and call back procedures.

 

       Switching pages

  This aspect can be considered a flaw in the design of me, because of the swing are not familiar with, I chose the method function calls the function. This is similar to the figure below, by constantly opening new frame, then shut down the old frame.

  This way, however, greatly restricts the passing parameters, as well as the call object. But I had not yet considered the back end of the function call, and therefore did not see this.

 

  

 

         3 Examples page transition diagram (constantly create frame, inefficient, it should be switched between the panel)

           

  Call daemon:

  I started in this regard is clueless. We do call each other between the single static page or write a few classes not difficult, but how to combine the two is difficult.

  By learning other people's code, I finally realized that you can use the event listener mechanism to swing components to complete the connection between the two.

  For example landing capabilities, users first enter content in both the username and password text box, then press the button to switch the landing page. If the username and password do exist and in accordance with, then landed successfully, otherwise an error message appears.

  In this process, the more important activity is the user presses the button. As for the user input is obtained by the function of the component itself.

  Therefore, if the button to listen, and then call the function for user name and password check, then it may very well be the beginning of my problem.

 

  

 

         FIG 4 textbox Events + Analyzing repeated username (bridge event listeners)

 

  Therefore I consider the behavior of each component is designed as a function of the (initial release) Feng students to achieve. After that my main job is to test the interaction between the various components is correct, it does not mention this point.

  

  

 

         The method of FIG. 5 the rear end needs to be implemented (partially)

 

  When assembling the final program, I have to do is to determine the conditions of the event function replacement from simple judgment conditions (the value entered is 1) to a function call are real (input content to determine whether legal).

III summarizes

  Of course, in addition to the above-mentioned problems I encountered, in fact, there are many small problems, mostly because of the swing is not familiar with the cause. In addition to the students that failed and Feng good butt, which is also worthy of my reflection.

 

Guess you like

Origin www.cnblogs.com/firework-boom/p/11593325.html