16 pair programming for the soft-working network

Source: Internet
Author: User

1, Code Cloud Project address Chen Yu blog address Hou Jingning Blog address Code cloud Address 2, PSP table
PSP2.1 Personal Development Process Estimated time-consuming (minutes) actual time consuming
Planning Plan 30 35
· Estimate Identify requirements and other relevant factors and estimate the time cost for each phase 40 50
Development Development 350 430
· Analysis Demand analysis (including learning new technologies) 150 180
· Design Spec Creating a design Document 30 30
· Design Review Design Review 40 50
· Coding Standard Code specification 25 30
· Design Specific design 30 30
· Coding Specific code 150 180
· Code Review Code review 20 20
· Test Test (self-test, modify code, commit changes) 20 30
Reporting Report 75 90
· Test report 30 40
· Computational effort 50 50
· and propose Process Improvement plan 25 25
3. An overview of the solution of the problem 1, the choice of programming language: Java, HTML and CSS (for Web-based GUI pages) 2, development tools and environment: ECLIPSE3, solving ideas

This experiment needs to add two new functions: can count the word frequency of the phrase of the specified length in the folder, and can output the number of the first n more words specified by the user.
The first function needs to enter the specified length n, and then use the loop to determine whether the length of the value corresponds to n in the map and output value and key if it matches.
The second function is relatively simple, only need to do a simple for loop, from the map to remove the first n more value and key can be achieved.

4, design implementation process 1, related classes and functions of the design

Defines a charcount class, based on the previously defined three methods, methods (to implement word ordering), methods (Implementation of sortMap wordCount frequency statistics), Output methods (Implementation of write-text file processing), the addition of two methods. This time the pair programming project adds two functions, namely the sortMap1 method (can output the user to specify the first n many words), also has the lenWordCount method (can count the word frequency of the phrase of the specified length in the folder). And in this project, we have improved the problem of not being able to make case-by-case distinction before, the unit test will be explained in detail later!

5, Code description (code snippet) Here we will explain the new functionality of the code (the previous code is no longer explained) 1, the SortMap1 method can output the user-specified number of words and numbers of the first k:
    public static void SortMap1 (Map<string,integer> oldmap,int k) {ARRAYLIST&LT;MAP.ENTRY&LT;STRING,INTEGER&G        t;> list = new arraylist<map.entry<string,integer>> (Oldmap.entryset ()); Collections.sort (list,new comparator<map.entry<string,integer>> () {@Override public int Compare (map.entry<string, integer> O1, map.entry<string, integer> O2) {if (o1.getvalue () = = O2                . GetValue ()) {return O1.getkey (). CompareTo (O2.getkey ());//The word frequency is the same, by dictionary}  Return O2.getvalue ()-O1.getvalue ();        Descending order}}); if (List.size () >=k) {//The number of words is greater than or equal to K, the output frequency is before the K for (int i = 0; i<k; i++) {System.out.println (LIS            T.get (i). GetKey () + ":" +list.get (i). GetValue ()); }}else {for (int i = 0; I<list.size (); i++) {//The number of words is less than k, the output is all System.out.println (list. Get (i). GetKey () + ":" +list.get (i). gEtvalue ());//key value to one by one}}} 
2. The Lenwordcount method can count the word frequency of a phrase of a specified length in a folder:
    public static void lenWordCount(Map<String,Integer> oldmap,int n) {        ArrayList<Map.Entry<String,Integer>> list = new ArrayList<Map.Entry<String,Integer>>(oldmap.entrySet());        Collections.sort(list,new Comparator<Map.Entry<String,Integer>>(){            @Override            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {                if (o1.getValue() == o2.getValue()) {                    return o1.getKey().compareTo(o2.getKey());//词频相同时,按字典排列                }                return o2.getValue() - o1.getValue();  //降序排列            }        });        for(int i = 0;i < list.size();i++) {            if(list.get(i).getKey().length()==n) {                System.out.println(list.get(i).getKey()+ ": " +list.get(i).getValue());            }        }    } }
6. Unit test test Cases (partial)
    • This section has been shown in Hou Jingning's blog.
7. Pair programming Experience
    • This pair programming I choose to improve is the code of my partner. Instead of programming the same module, we chose division of labor, I was responsible for the addition of new features and improvements to the last feature, such as my partner's failure to implement a case-insensitive feature last time, and I finally solved the problem by checking the code and repeatedly modifying the test. My partner is responsible for the design and final integration of the front end.

    • In general, compared to single-player programming, pair programming can be said to be more efficient, because do not need a person at the same time responsible for the design and implementation of the front-end, greatly increasing the efficiency of programming.

16 pair programming for the soft-working network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.