I learn Java It has been a semester , Although the time is not too long , But I have gained a lot in this semester . I was confused , Once confused ; Had fun , Too happy . Just started learning Java Hour , We've been in touch C language . For two different styles of form , It will take some time to change . I don't know if it is the resonance of beginners , Just beginning to contact Java It should be difficult to learn , I was completely confused when I saw the teacher typing a large piece of code in a short time , But in my surprise, I took a great interest in it , So I opened my Java The way of learning . This semester's topic exercises are mainly in PTA On . At the beginning of learning , Through some simple exercises , I feel that getting started is not as difficult as I thought , It has to be said that the experimental questions are the fastest ones to master the grammar of a language . In the process of writing problems, I will feel a joy of success because I spend a lot of time solving an exercise ; You will also feel frustrated because you can't write or find the wrong code at once . But what impressed me more was the process of learning , It gives me a strong sense of substitution . In learning, we should learn
” Not abandon , do not give up “, As long as you can do it firmly, you will find , Your efforts may bring you rewards , Although many times the results you get after your efforts are not ideal . The second is to practice more and play more , The accumulation of quantity will certainly cause qualitative changes , Please believe this truth . We should not only listen carefully to what the teacher says in our study , Practice hard after class , So as to get familiar with and master the content taught by the teacher . This is because no matter how simple the teacher is , How well do you understand in class , When you practice by yourself, you will find that something that is very simple can't be knocked out .
1. Operation process summary
① Knowledge iteration relationship ： Homework from easy to difficult , Take us gradually to adapt to the change of thinking . Gradually from process oriented to object-oriented programming . The first is java Construction of environment , And then java Class structure and main function ; After that, I mainly learned the relationship between classes , Learned how to use regular expressions , Class inheritance, define corresponding class objects and test them , Graph inheritance and polymorphism . Take us step by step to understand object-oriented encapsulation , Three technical characteristics of inheritance and polymorphism ; Abstract classes and interfaces and the last learned JavaFX Basics .
② from C The habit brought by language changes slowly , From the first and C The same way of writing the language until the second understanding java Statement for , Let's go to the third job to really use the concept of class , The type of topic is gradually leading us to establish the concept of class , Not all the code is written in one main function , Design idea of passing class , Try our code to look more concise and effective , And can be used and modified separately in the future . Gradually understand object-oriented encapsulation through jobs , Three technical characteristics of inheritance and polymorphism ： Saving classes and methods in an integration package reflects a feature of encapsulation , Has good cohesion , When we want to call these classes , You must first import the packages corresponding to these classes , To use these classes , Extreme method , This reflects its encapsulation ; Subclasses retain all variables and methods of the parent class , This is inheritance , And polymorphism is inherited from . If we want to override a method in a parent class , Just add @override And override the method , Reflects polymorphism .
③ Problems encountered ：
1. The program is error prone , But the good thing is that there will be a corresponding prompt at the wrong place , Find out the mistakes and correct them in time .
2. Some of the code is very complicated , Sometimes it's easy to make mistakes , Don't know where the mistake is .
3. When using different classes class It's on main In function , No error can be found at the time of error reporting .
4. Some regular expressions cannot be used correctly .
④ Percentage of time spent per job ： It usually costs about one question 2-3 Day time ; If it is three or more questions, it usually costs 1:2:3 Time of .
⑤ Knowledge and lessons of rigor in programming process ：Java Programming is rigorous , And than C Easy to use language , Some compilation and syntax errors are often not easy to find when writing code , however java The compiler gives a prompt . Besides, I know how to use debug, Many algorithm errors are hard to find , use debug It would be much easier to find .
2.OO Design experience
① Understanding of the relationship among the three major object-oriented technical features ：
Encapsulation is one of the characteristics of object-oriented , Is the main feature of object and class concepts , Saving classes and methods in an integration package reflects a feature of encapsulation , Has good cohesion , When we want to call these classes , You must first import the packages corresponding to these classes , To use these classes ; Inheritance is a hierarchical model of join classes , And allow and encourage class reuse , It provides a way to articulate commonalities , Subclasses retain all variables and methods of the parent class , This is inheritance ; And polymorphism is inherited from , Allows different objects to respond to the same message , Polymorphic languages are flexible , abstract , Behavior sharing , Advantages of code sharing , Well solved the problem of application function with the same name .
② Understanding the basic principles of object-oriented design : first , Priority should be given to the most perfect , An object-oriented language that expresses the semantics of problem domain most accurately . Class implementation is the core issue , All data is encapsulated in instances of classes , So class is the key . Implementing a system is a simpler process than using a procedural approach , Shorter process .
③OO Understanding of programming thinking
OO Programming is mainly to make the design consistent with the things in the real world . Class and object are two basic concepts . At design time , Find each object to be processed first , Find the common ancestor of each object , Layer by layer abstraction , Finally, establish the inheritance relationship between each class .
④ Class design experience
Try to achieve independent functions for each class , Reflect single responsibility , It can make the system have good reusability .
3. Understanding and practice of testing
① The importance of testing for coding quality
Testing is an important means to judge coding quality , Pass the test , It can preliminarily confirm whether the function implemented by the code is correct , And it can also prompt the error , Let's revise it , Improved code quality .
② Let's say you design test cases , What would you do
Design test points for abnormal and normal input respectively , Design different types of test points within the normal range .
4. Course harvest
I'm learning Java During the process, I concluded the following conclusions ：
1． I am learning , Develop good habits ( Write parentheses in pairs , Case sensitive letters , Spell words correctly ).
2． In the process of learning , Better not just stay java surface , It's not just the example on the transcript that runs to the result . it is to be noted that , Be patient with even a simple example , debugging , change .
3． In the process of learning, you must do it yourself , Try to write code , Instead of reading a Book . A lot of things and experiences must be done by yourself to truly belong to you .
In the learning process , May encounter various problems that are not easy to solve , Go to professional forums to learn more about relevant knowledge , Limited knowledge in books . Be able to search the Internet for useful information Put it in order , Promote the deepening of learning and the improvement of knowledge level .