20160709 set foot in Yangzhou, 20170826 rushed to Wuhan. In the past one and a half months of pre-internship training, there are some gains and losses.
In writing this article, I was trying to get away from the internship report and get to the point. Write less empty trivia and more knowledge. After one and a half training in Yangzhou. I know their own road, I do not want to their future with the wind wave, wave things, pro like a ship without port.
I am an intern Java code farmer, but I hope I will be the developer of XX products in the future. In the past training in Yangzhou, I learned Java and Java respectively. Net. Therefore, I will review the knowledge I learned in the past in the following 5 internship reports (including this one, a total of 6). Review the old and learn the new, can be a teacher.
I think there’s one sentence that’s pretty good.” Learning without thought is useless; thought without learning is perilous. This fits well with how programmers learn. The same programmers with the same experience, some programmers are bad, some programmers are good. Reasonably summarizing the knowledge learned in the past and drawing inferences by analogy can only increase the efficiency of learning. In my opinion, this is the watershed between excellent programmers and ordinary programmers.
During the internship in Yangzhou, we were required to write a Daily Report every day to briefly describe what we did today, the progress of completion, and the problems we encountered. We could put forward our own opinions on the course and what we should finish tomorrow.
But when I heard this request, I thought to myself, “I’m such an idiot. It’s pointless.” Now I find that I was really ignorant. And the Daily Report is not written in Chinese, but in English.
The format should be accurate to every space and punctuation mark, the heading should be bold, the font should be Arial, the size of the font should be 10pt, and there should be a space between the heading and the content. Use half corners for heading symbols, not full corners. Pay attention to the tense of writing English, technical terms to case.
It was just such a simple daily report. None of the 60 people we trained could write a daily report that met the requirements on the first day, even if the trainer told us the format requirements every day. After a week, only a few of the 60 people could write a report that met the requirements.
So far, I can’t guarantee that my English sentences can meet the requirements of tenses, capitalization and sentence structure. I can only write simple sentences like to do, learn, study, understand and finish to describe what I did that day, because my English is so poor. Complex sentences can’t be written without making mistakes, so write simple sentences.
I remember the trainer said to us :” You can’t even complete such a simple daily report, but you still expect you to write high-quality code.” Now that I think about it, I was right. The devil is in the details.
Nowadays, many companies develop their products in the mode of agile development. Agile development is based on the evolution of users’ needs, adopting iterative and step by step approach to software development. Teamwork is definitely a must in this part of the game, and for teamwork, merge code is indispensable.
To speed up team development, many companies have developed a Coding Style. Keep the team’s code style consistent. When I first learned the Coding Style of our company, I felt like death. I used to write code in school in a wild way, no style at all. The result is poor code reading. The code used to be written like this, I can’t look down.
public class QuickSort {
public static void sort(int[] number){
sort(number,0,number.length-1);
}
private static void sort(int[] number, int left, int right) {
// TODO Auto-generated method stub
if(left<right){
int i=left,j=right;
int x=number[left];
while(I <j){// In an infinite loop, only elements smaller than x can break out of the loop from right to leftwhile(i<j&&number[j]>=x){
j--;
}
if(i<j){ number[i++]=number[j]; } // Elements greater than x break out of the loopwhile(i<j&&number[i]<=x){
i++;
}
if(i<j){ number[j--]=number[i]; Number [I]=x; number[I]=x; number[I]=x; sort(number,left,i-1); sort(number,i+1,right); }} public static void main (String [] args) {int [] num = 34,1,23,345,12,546,131,54,78,6543,321,85,1234,7,76,234 {}; sort(num);for(int i=0;i<num.length;i++){
System.out.println(num[i]);
}
}
}
Copy the code
Now, my code looks like this
public class LinkedListCreator {
private int count;
/**
* Creates a linked list
* @param data the data to create the list
* @return head of the linked list.The returned linked list
* ends with last node with getNext() == null
*/
public Node createdLinkedList(List<Integer> data) {
count ++;
if (data.isEmpty()) {
return null;
}
System.out.println("list = " + data.toString());
Node firstNode = new Node(data.get(0));
System.out.println("before count=" + count + ",value=" + firstNode.getValue());
Node headOfSublist = createdLinkedList(data.subList(1, data.size()));
System.out.println("after count=" + count + ",value=" + firstNode.getValue());
firstNode.setNext(headOfSublist);
returnfirstNode; } public static void main(String[] args) { LinkedListCreator creator = new LinkedListCreator(); Node.prinfLinkedList(creator.createdLinkedList(new ArrayList<Integer>())); Node.prinfLinkedList(creator.createdLinkedList(Arrays.asList(1))); Node.prinfLinkedList(creator.createdLinkedList(Arrays.asList(1, 2, 3, 4, 5))); }}Copy the code
Smart people see the difference right away. First, comments, comments are really important, comments to describe what your method does, as clearly as possible. Otherwise, after entering the project, team cooperation is unavoidable. If you don’t annotate, watch out for people asking after your family.
I used to write code without comments, thinking comments were optional. But in a project, efficiency is a prerequisite. Elegant comments that make it easy to understand the logic of your code. Like I went to see the source of a project before, in the clouds, because the author added a few notes very few!!!!!!! I wish I was dead, so I will add comments when I write code in the future. I have experienced the feeling of being dead.
Secondly, notes do not appear in Chinese, all English notes. If you want to be a bull, start by writing elegant English notes. Another point is that when writing Chinese and English, the input method frequently switch, a little impact on efficiency. But the main reason is internationalization. The primary source of coding is always English, and Chinese documents are mostly secondary sources. So you know, it’s really important to learn English well.
Now I’m learning a lot more English than I used to. During the training in Yangzhou, we were given half an hour every day to communicate in English and talk about topics.
Back to CodingStyle
-
Preferred if a class has only methods and no member variables, there should be a blank line between the method and the class. If there are member variables and methods, there is a blank line between the member variable and the method, but the member variable is not empty. For example, if A class is public class A{}, then the last} parenthesis should be followed by A line. Because that’s the way String is written, don’t ask why.
-
Static variables all caps, member variables small hump, method small hump, class large hump, TAB indent 4 points, show the number of lines of code and white space, method empty 4 points, CSS and JS are also specific to empty several points. Statements such as if and while are preceded by a blank line. Return x is not preceded by a blank line if x is empty, and a blank line if not.
-
The naming rules of CSS and JS are A-B-C, and the naming rules of HTML and JSP are A_b_C. Hard code should be extracted into Constant class and divided into blocks. The same code appears twice, should consider the design pattern, extraction separation, to achieve common.
-
When it comes to databases, avoid SQL statements and use stored procedures. The code fields in the Model layer correspond to the list of database tables, named a_b_C. The HTML and JSP tags are closed, and the CSS and JS are extracted into a file under the JS folder.
-
The front end code and the back end code are dynamically separated. The foreground only shows static tags, the related logic render to desgin into JS to complete. Do not use position:relative or absolute when drawing foreground UI. I don’t know why.
There are so many Coding styles involved in the document that there is no space to describe them all!! .
To be continued. Next one to be continued. Attached are three pictures of my internship in Yangzhou