2017-2018-2 20165325 Experiment Report of Java object-oriented programming
First, agile development and XP practice-1 Experimental requirements:
- Use the tool (Code->reformate code) in idea to reformat the code below, and then look at the Code menu to find a feature that feels best for you. Submit, plus your own study number watermark.
public class CodeStandard {public static void main(String [] args){StringBuffer buffer = new StringBuffer();buffer.append(‘S‘);buffer.append("tringBuffer");System.out.println(buffer.charAt(1));System.out.println(buffer.capacity());System.out.println(buffer.indexOf("tring"));System.out.println("buffer = " + buffer.toString());if(buffer.capacity()<20)buffer.append("1234567");for(int i=0; i<buffer.length();i++)System.out.println(buffer.charAt(i));}}
Experiment
- Click
setting
------in idea Plugins
Brows Repositories
to search for alibabba
and download
- Right-click on the project to select the encoding protocol scan
- After using Code->reformat to align
Second, agile development and XP practice-2 experimental requirements
- Add your own learning partner to your project in the code cloud, confirm that your partner's project is on your own, download the complex code for your partner experiment two, add not less than three JUnit unit test cases, and then git add after the test is successful. Git commit-m "Add content by yourself"; git push; submit a partner project git log, which contains information about git commit above, plus its own watermark information.
Experiment
Three, agile development and XP practice-3 experimental requirements
- http://www.cnblogs.com/rocedu/p/4795776.html, eclipse content replaced with idea
- Complete the refactoring exercise, download your partner's code, make at least three refactoring, commit the refactoring code, and add your own number watermark. Submit a link to your partner's code cloud project.
Experimental content and
Refactoring (Refactor)is to change the structure within the software without changing the external behavior of the software, making it easier to read, easy to maintain, and easy to change.
Refactoring method
Pre-refactoring Code
public class csj{ public static int csj(int n) { if(n>=0) if(n==0||n==1) return n; else return csj(n-2)+csj(n-1); return -1; } public static void main(String args[]) { int m=25,n; int fib[]=new int[m]; for(n=0;n<m;n++) fib[n]=csj(n); for(n=0;n<fib.length;n++) System.out.print(" "+fib[n]); System.out.println(); }}
- The code has the following problems:
- The class name does not match the naming convention;
- Sentence structure is not easy to read
- Experiment
Three, agile development and XP practice-3 experimental content
- Refer to Http://www.cnblogs.com/rocedu/p/6683948.html to complete the learning of Java cryptography related content in pairs, combining refactoring, git, and code standards. Submit the learning Result Code cloud link and the representative result, must have the student number watermark.
Experiment
Experience and summary of experiment
- After this experiment I learned the use of Alibaba plug-ins, can be very convenient to standardize my code. And initially mastered the ability to reconstruct it. However, due to the lack of code understanding, in refactoring it is not easy to find the program is not enough to be able to standardize the code smoothly, this is in the future should learn the progress of the place.
Steps |
Time Consuming |
percentage |
Demand analysis |
20 |
13.7% |
Design |
30 |
20.6% |
Code implementation |
50 |
34.4% |
Test |
30 |
20.6% |
Analysis Summary |
15 |
10.3% |
20165301 Chen Yu Fly 2017-2018-2 20165325 Experiment Report of Java object-oriented programming