20172317 2017-2018-2 《程序设计与数据结构》第八周学习总结

20172317 2017-2018-2 《程序设计与数据结构》第八周学习总结

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.
  • 问题2:XXXXXX
  • 问题2解决方案:XXXXXX
  • 别看了,没做完

代码调试中的问题和解决过程

  • 问题1:XXXXXX
  • 问题1解决方案:XXXXXX
  • 问题2:XXXXXX
  • 问题2解决方案:XXXXXX
  • ...

代码托管

(statistics.sh脚本的运行结果截图)

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.

结对及互评

评分标准

  1. 正确使用Markdown语法(加1分):
    • 不使用Markdown不加分
    • 有语法错误的不加分(链接打不开,表格不对,列表不正确...)
    • 排版混乱的不加分
  2. 模板中的要素齐全(加1分)
    • 缺少“教材学习中的问题和解决过程”的不加分
    • 缺少“代码调试中的问题和解决过程”的不加分
    • 代码托管不能打开的不加分
    • 缺少“结对及互评”的不能打开的不加分
    • 缺少“上周考试错题总结”的不能加分
    • 缺少“进度条”的不能加分
    • 缺少“参考资料”的不能加分
  3. 教材学习中的问题和解决过程, 一个问题加1分

  4. 代码调试中的问题和解决过程, 一个问题加1分

    扫描二维码关注公众号,回复: 102473 查看本文章
  5. 本周有效代码超过300分行的(加2分)
    • 一周提交次数少于20次的不加分
  6. 其他加分:
    • 周五前发博客的加1分
    • 感想,体会不假大空的加1分
    • 排版精美的加一分
    • 进度条中记录学习时间与改进情况的加1分
    • 有动手写新代码的加1分
    • 课后选择题有验证的加1分
    • 代码Commit Message规范的加1分
    • 错题学习深入的加1分
    • 点评认真,能指出博客和代码中的问题的加1分
    • 结对学习情况真实可信的加1分
  7. 扣分:
    • 有抄袭的扣至0分
    • 代码作弊的扣至0分
    • 迟交作业的扣至0分

点评模板:

  • 博客中值得学习的或问题:
    • xxx
    • xxx
    • ...
  • 代码中值得学习的或问题:
    • xxx
    • xxx
    • ...
  • 基于评分标准,我给本博客打分:XX分。得分情况如下:xxx

  • 参考示例

点评过的同学博客和代码

其他(感悟、思考等,可选)

xxx
xxx

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 5000行 30篇 400小时
第一周 200/200 2/2 20/20
第二周 300/500 2/4 18/38
第三周 500/1000 3/7 22/60
第四周 300/1300 2/9 30/90

尝试一下记录「计划学习时间」和「实际学习时间」,到期末看看能不能改进自己的计划能力。这个工作学习中很重要,也很有用。
耗时估计的公式:Y=X+X/N ,Y=X-X/N,训练次数多了,X、Y就接近了。

参考:软件工程软件的估计为什么这么难软件工程 估计方法

  • 计划学习时间:XX小时

  • 实际学习时间:XX小时

  • 改进情况:

(有空多看看现代软件工程 课件
软件工程师能力自我评价表
)

参考资料

猜你喜欢

转载自www.cnblogs.com/Chiang-B/p/8982819.html