20,182,306 2019-2020-1 "Object-oriented programming and data structures," the sixth week of learning summary

20,182,306 2019-2020-1 "Object-oriented programming and data structures," the sixth week of learning summary

Learning content summary

Polymorphism refers to a variable reference point to a different target at different times. Polymorphism is the basis to achieve the binding
principles of object-oriented is the core object-oriented design, object-oriented principle of the five SRP, OCP, LSP, DIP, ISP
SRP (Single Responsibility Princple single responsibility principle) only one element of a design thing. Before been discussing this matter, (God class and subclasses) subclasses easy to reuse.
Cohesion and low coupling high within: and what does not go out, use call flexible

OCP (Open use Close Princple)
"Closed for Modification; Open for Extension": to expand open closed for modification
mechanism behind the OCP: abstract and polymorphic
software entity (.. Class module function) should be

LSP: (Liskov Substitution Principle Richter Substitution Principle) Liskov is the author of this principle. Number of understanding it as greater than 5 must be greater than 2, where the father of the child must be able to exist.

DIP (Dependence Inversion Principle Dependency Inversion Principle) depends on the abstract, do not rely on specific.
Subclasses may be replaced by a base class can not inherit abuse

ISP: (Interface Segregation Principle Interface separate principle) an interface equivalent to one kind of role play, but this role in a stage of which an actor to play the equivalent of implementation of the interface. Therefore, it should be a simple interface to a role on behalf of, the interface segregation principle is to speak the same role to provide a wide, narrow different interfaces to deal with different clients.

Textbook learning and problem-solving process

  • Question 1: Can you implement interfaces Interface
  • Problem 1 Solution: No, members of the interface method is abstract, but does not have a method body, can not be achieved inherited interface.
  • Question 2: What is the multi-state necessity
  • Problem 2 Solution: inheritance, there are rewritten, but also the parent class object reference points to subclass

Code debugging and problem solving in the process

  • Question 1:

  • Problem 1 Solution: because of carelessness did not notice the name of the file is not uniform

Code hosting

Last week exam wrong question summary

  • The wrong question 1
    ? At The following code does the What do Assume List IS AN Array of int values, the TEMP IS some of Previously initialized int value, and c IS AN int initialized to 0.
    for (J = 0; J <List.length; J ++) IF (List [J] <TEMP) C ++;
    A .It Finds The Smallest value and Stores in TEMP
    B .It Finds The Largest value IT and Stores in TEMP
    C .It The Counts Number of Elements The Smallest value equal to in List
    .It at the Number the Counts of D Elements in List that are less Within last the TEMP
    E .It sorts at the values in List to BE in the Order Ascending
    correct answer: D your answer: B
    Analysis: statement if (list [j] <temp ) c + each element in the list is compared with temp, and only when the element is less than temp adds an element to c, it calculates the number of elements in the list is less than temp, and the result is stored in the c.
  • Wrong question 2
    Which of The following Lists of Show Numbers Accurately Would The Array After Selection The First Pass through the Sort The algorithm 9,4,12,2,6,8,18 {}?
    A .9,. 4, 12 is, 2, . 6,. 8, 18 is
    B .4,. 9, 12 is, 2,. 6,. 8, 18 is
    C .2,. 4, 12 is,. 9,. 6,. 8, 18 is
    D .2,. 4,. 6,. 8,. 9, 12 is, 18 is
    E .2, 4, 9, 12 , 6, 8, 18
    correct answer: C your answer: B
    Analysis: transmitting each successive selection sort, the sort will not find the smallest value, and switching the current array index (current index from 0, has been to the array of second-to-last position). In the first pass, the smallest element 2 with an index 0, SO2 switching positions and nine exchange.
  • Wrong question. 3
    Both the Sort The Insertion and Selection The algorithms have have the Sort Order of ________ The Efficiencies ON WHERE IS The Number of n-values in the sorted being The Array.
    A .n
    B * log .n n-
    C ^ .n 2
    D ^ .n . 3
    E .Insertion Sort and n has AN Efficiency of Selection Efficiency of AN has the Sort 2 ^ n
    correct answer: C your answer: B
    Analysis: two kinds of sorting algorithms use two nested loops, each loop is executed n times about the complexity of these two algorithms are n * n or n ^ 2.
  • Wrong question. 4
    What are Mechanisms The main Programming Object-Oriented Programming for delegation delegation that?
    A .encapsulation, Inheritance, polymorphism
    B .encapsulation, Abstraction, Inheritance
    C .inheritance, polymorphism, recursion
    D .polymorphism, recursion, Abstraction
    E of The above .none
    correct answer: a your answer: C
    Analysis: isolation package is part of the code, so that they can not be accidentally modified; Inheritance provide code reuse; polymorphism of a name, a plurality of semantics. Abstraction is a useful attribute, but it is not a mechanism. A control structure is recursive, provides a different way of showing the cycle or repetition.
  • The wrong question 5
    of Can Program Exhibit A polymorphism IF IT only the implements Early the Binding?
    A .Yes, Because One form of polymorphism IS Overloading
    B .no, the Binding polymorphism Because the without a LATE CAN BE not Supported
    C .Yes, Because SO AS at The Long Programs uses Inheritance and / or the supports polymorphism in the interfaces IT
    D .Yes, Early Because the Binding has Nothing to do with polymorphism
    E .none of above at the
    correct answer: a your answer: B
    Analysis: Although the interface supports polymorphism and inheritance, but only in tie It is supported at a given night situation. However, a polymorphic form of overload - a (method) name, a plurality of body - so long as the program using the overload, polymorphism in use.
  • The wrong question 6
    the What IS at The Efficiency of binary Search?
    A .n ^ 2
    B .n
    C .log2 the n-
    D .n / 2
    E .none of above at The
    correct answer: C Your Answer: D
    Analysis: With each comparison, binary search eliminates about half of the remaining data. This process continues to find elements is found or all possible data have been deleted. Since there are n data elements, so before the data is less than one element, the number of times data can be halved log2n.

    Pair peer review and

Grading

  1. Proper use Markdown syntax (1 point)
  2. Elements range (1 point) template
  3. Textbook learning and problem-solving process, three questions, add 3 points

  4. The code debugging and problem solving process, two issues plus 2 points
  5. Week over 300 branches valid code (plus 2 points)
  6. Feelings, experience does not leave large empty 1 point
  7. Typesetting fine plus one point
  8. Progress bar records the learning time and improve the situation of 1 point
  9. There are hands-on writing new code, add 1 point
  10. After class choice has verified 1 point
  11. Learning the wrong questions in depth, add 1 point
  12. Comments seriously, I can point out problems and blog code plus 1 point
  13. Pair learning authentic plus 1 point

Comments template:

  • Worth learning problems or blog:
    • Good typesetting
  • Code is worth learning or problem:
    • The code amount of growth, indicating that twinning students this week very hard in learning Java, I have to work hard to learn the Java
    • Warehouse bit confusing
  • Reference Example

Comments had students blog and code

Other (perception, thinking, etc., optional)

Java learning content more and more assignments is growing, I would like to build

Learning progress bar

The number of lines of code (add / accumulate) Blog amount (add / accumulate) Learning time (add / accumulate)
aims 5000 rows 30 400 hours
the first week 200/200 2/2 20/20
the second week 300/500 2/4 18/38
The third week 500/1000 3/7 22/60
the fourth week 300/1300 2/9 30/90
fifth week 1526/2986 2/9 20/115
Sixth Week 837/3823 2/11 20/135

Try recording "planned learning time" and "actual learning time" to the end see if you can improve their ability to plan. This study is very important work, is also useful.
Consuming an estimated equation: Y = X + X / N , Y = XX / N, training more often, X, Y will close.

Reference: Why is estimated that software engineering software so hard , software engineering estimation method

Reference material

Guess you like

Origin www.cnblogs.com/yanhan1/p/11681715.html