20172317 2017-2018-2 "Program Design and Data Structure" Week 8 Learning Summary

20172317 2017-2018-2 "Program Design and Data Structure" Week 8 Learning Summary

Brief conclusion of the chapter

Polymorphism:

  • Polymorphism is one of the fundamental principle of object-oriented software.I don't think so
    • Polymorphism is also known as the late binding or the dynamic binding.
    • A polymorphic reference can refer to different types of objects over time.
  • Two ways of creating a polymorphic reference:
    • Polymorphism via inheritance
    • Polymorphism via interfaces
  • Pratical use of polymorphism:
    • Sorting
      • Selection sort: begin with the first number, scan right to find the smallest number and exchange them, begin at the secound number,scan right to find the smallest number and exchange them, repeat the process until all the numbers are sorted.
      • Insertion sort: begin with a "sorted" list containing only one number,sort the first two number in the list(relatively), exchange them if necessary, insert the third number of the list into a proper position(relatively), repeat the process until all the numbers are sorted.
    • Searching
      • Linear search: starting at the beginning of the list, compare each object in the list until the target is found.
      • Binary search(can be used only if an array is sorted in either ascending or descending way): starting at the middle of the list, compare this object with the target, if target is smaller than object, compare the object of the middle of the first half, if target is bigger than object, compare the object of the middle of the secound half.Repeat the process until the target is found.

Problems in studying text book

  • Problem 1:The concept of Polymorphsim and Binding
  • Solutions:As the textbook says "A polymorphic reference can refer to different types of objects over time"."over time"?After asking for explanation, it seems the term "over time" means when a program is excuted, the polymorphic reference would not be excuted at the same time, so it would cause a slight delay.
    According to the internet, the term "binding" means to connect a method invocation to the method's class. There are two types of binding: early binding and late binding.
    If a method is an early binding method, it means the binding of a method invocation to a method defination happens before the program is excuted. According to this webpage, only final, static, private or constructor methods are early binding methods. In a nutshell, if a method cannot be inherited, or cannot be overrided after being inherited, then it is an early binding method.
    If a method is a late binding method, it means the binding of a method invocation to a method defination is performed at run time.
  • Question 2: XXXXXX
  • Problem 2 Solution: XXXXXX
  • don't look, it's not done

Problems and solutions in code debugging

  • Question 1: XXXXXX
  • Problem 1 Solution: XXXXXX
  • Question 2: XXXXXX
  • Problem 2 Solution: XXXXXX
  • ...

code hosting

(screenshot of the running result of the statistics.sh script)

Conclusions of mistakes in last week's test

  • 9.Abstract methods are used when defining
    A.interface classes
    B.derived classes
    C.classes that have no constructor
    D.arrays
    E.classes that have no methods

The correct answer is A, I chose E.
An interface is a class that has defined some of its components, but leaves other components (methods) for you to implement. So, these components (methods) are referred to as abstract and defined in the interface class as abstract.

  • 10.Which of the following is true regarding Java classes?
    A.All classes must have 1 parent but may have any number of children (derived or extended) classes
    B.All classes must have 1 child (derived or extended) class but may have any number of parent classes
    C.All classes must have 1 parent class and may have a single child (derived or extended) class
    D.All classes can have any number (0 or more) of parent classes and any number of children (derived or extended) classes
    E.All classes can have either 0 or 1 parent class and any number of children (derived or extended) classes
    The correct answer is A, I chose E.
    I know that all Java classes inherit directly or indirectly from the Object class.But what about the Object class itself? Well it seems the Object class is it's own parent.....

  • 12.A variable declared to be of one class can later reference an extended class of that class. This variable is known as
    A.protected
    B.derivable
    C.cloneable
    D.polymorphic
    E.none of the above, a variable declared to be of one class can never reference any other type of class, even an extended class
    The correct answer is D, I chose A.
    "This variable is decleared to be of one class".

  • 13.In order to determine the type that a polymorphic variable refers to, the decision is made
    A.by the programmer at the time the program is written
    B.by the compiler at compile time
    C.by the operating system when the program is loaded into memory
    D.by the Java run-time environment at run time
    E.by the user at run time
    The correct answer is D, I chose A.
    As the text book goes: "A polymorphic reference can refer to different types of objects over time".The answer should be D.

  • 16.Using the reserved word, super, one can
    A.access a parent class'constructor(s)
    B.access a parent class'methods and instance data
    C.access a child class'constructor(s)
    D.access a child class'methods and instance data
    E.none of the above
    The correct answer is E, I chose B.
    Actually the correct answer is A and B, let's just ignore this nonsense....

  • 20.A derived class has access to all of the methods of the parent class, but only the protected or public instance data of the parent class.
    A.true
    B.false
    The correct answer is B, I chose A.
    A derived class cannot access to all the methods of the parent class, because methods can also be decleared as "private".

  • 21.If class AParentClass has a protected instance data x, and AChildClass is a derived class of AParentClass, then AChildClass can access x but can not redefine x to be a different type.
    A.true
    B.false
    The correct answer is B, I chose A.
    A derived class can redefine any of the instance data or methods of the parent class.

Pairing and mutual evaluation

Grading

  1. Correct use of Markdown syntax (plus 1 point):
    • No points for not using Markdown
    • No extra points for grammatical errors (links can't be opened, tables are incorrect, lists are incorrect...)
    • No points for messy typography
  2. The elements in the template are complete (plus 1 point)
    • No points for lack of "Problems and Solving Processes in Textbook Learning"
    • No bonus points for missing "Issues in Code Debugging and Resolution Processes"
    • No bonus points for code hosting that cannot be opened
    • No points will be added for those that cannot be opened without "pairing and mutual evaluation"
    • No extra points for missing "summary of last week's exam mistakes"
    • Missing "progress bar" can not add points
    • No extra points for missing "references"
  3. Problems and solving process in teaching material learning, one point is added for each problem

  4. Problems and solutions in code debugging, plus 1 point for each problem

  5. This week's valid code exceeds 300 branches (plus 2 points)
    • No extra points for submissions less than 20 times a week
  6. Other bonus points:
    • 1 point for blogging before Friday
    • Feelings, experience is not fake plus 1 point
    • Nice typography plus a point
    • Add 1 point for recording the learning time and improvement in the progress bar
    • 1 point for writing new code by hand
    • After-class multiple-choice questions with verification plus 1 point
    • 1 point for code Commit Message specification
    • Add 1 point for in-depth study of wrong questions
    • Serious comments, plus 1 point for pointing out problems in the blog and code
    • 1 point for true and credible paired learning
  7. Deductions:
    • 0 points for plagiarism
    • Code cheating will be deducted to 0 points
    • 0 points for late work

Review Template:

  • Worth learning or questions from the blog:
    • xxx
    • xxx
    • ...
  • Worth learning or problems in the code:
    • xxx
    • xxx
    • ...
  • Based on the scoring criteria, I give this blog a score: XX points. The scores are as follows: xxx

  • Reference example

Reviewed classmates blog and code

Others (perception, thinking, etc., optional)

xxx
xxx

learning progress bar

Lines of code (added/accumulated) Blog volume (new/cumulative) Study time (added/accumulated) important growth
Target 5000 lines 30 articles 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

Try recording "planned study time" and "actual study time", and see if you can improve your planning ability at the end of the due date. This work study is very important and very useful.
The formula for time-consuming estimation: Y=X+X/N, Y=XX/N, the more training times, the closer X and Y are.

Reference: Why is the estimation of software engineering software so difficult , software engineering estimation methods

  • Planned study time: XX hours

  • Actual study time: XX hours

  • Improvements:

(If you have time, take a look at the Modern Software Engineering Courseware
Software Engineer Ability Self-Assessment Form
)

References

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325218349&siteId=291194637