20162319 2016-2017-2 《程序设计与数据结构》第7周学习总结

教材学习内容总结

第10章 异常

异常处理
不捕获异常
try-catch语句
异常传播
异常类的层次
I/O异常

教材学习中的问题和解决过程

  • 问题1:节点流与处理流如何理解
  • 问题1解决方案:节点流:可以从或向一个特定的地方(节点)读写数据。如FileReader.
    处理流:是对一个已存在的流的连接和封装,通过所封装的流的功能调用实现数据读写。如BufferedReader.处理流的构造方法总是要带一个其他的流对象做参数。一个流对象经过其他流的多次包装,称为流的链接。就像视频中老师所说的那样,节点流可看作是被装饰者,处理流被看作是装饰者。
  • 问题2:为什么可以不继承Exception或者其子类而直接调用getMessage方法与printStackTrace方法说明抛出异常的信息?
  • 问题2解决方案:catch子句不是函数,所以圆括号中不是形参,而是一个异常类型声明,可以是类型也可以是对象

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

  • 问题1:git commit出现问题

  • 问题1解决方案:

  • 问题2:git push出现问题

  • 问题2解决方案:

代码托管

上周考试错题总结

错题1:The commitment to execute certain code to carry out a method invocation is referred to as _____________(通过提交来执行确定的代码从而完成方法的调用,被称为).
A .
execution(执行)
B .
binding(绑定)
C .
polymorphism(多态)
D .
inheritance(继承)
E .
none of the above(以上都不正确)
原因:Binding refers to the commitment to execute certain code to carry out a method invocation.
错题2:Suppose that Horse is a subclass of Animal, and neither class is abstract. Which of the following is an invalid declaration and initialization? (假设Horse是Animal的子类,且都不是抽象类。下面哪项是无效的声明和初始化?)
A .
Horse h = new Horse();
B .
Horse h = new Animal();
C .
Animal a = new Animal();
D .
Animal a = new Horse();
E .
all of the above(以上都正确) are valid(以上都是有效的)
原因:Since Horse is a subclass of Animal, choice b would require an explicit class.
错题3:Let Dog be a subclass of Animal, and suppose Animal has a method called speak() that is overridden in the Dog class. Consider the following code(假设Dog是Animal的子类,且Animal有一个方法speak(),该方法在Dog类中被重载).

Animal spot = new Dog();
spot.speak();

Which of the following is true? (下面哪项是正确的)
A .
This code will result in a compile-time error. (这段代码会引起编译时错误)
B .
This code will result in a run-time error. (这段代码会引起运行时错误)
C .
The speak method defined in the Animal class will be called. (将会调用Animal类中的speak方法)
D .
The speak method defined in the Dog class will be called. (将会调用Dog类中的speak方法)
E .
The speak method will not be called at all. (不会调用任何speak方法)
原因:The speak method defined in the Dog class will be called in this case. At run-time, the Java virtual machine determines that spot is pointing to an object of type Dog and binds the method to the methods defined in the Dog class.
错题4:Let Object a be larger than Object b. What will the following method call return?(假设对象a大于对象b.下面的方法将返回什么?)
a.compareTo(b)
A .
it will return 0(返回0)
B .
it will return a number greater than 0(返回一个大于0的数)
C .
it will return a number less than 0(返回一个小于0的数)
D .
it will return true(返回true)
E .
it will return false(返回false)
原因: The Iterator interface specifies that all objects that implement it must have the hasNext and next methods. Since all objects in Java are a subclass of the Object class, it will also include the toString method.
错题5:Consider the following line of code. (思考下行代码)

Comparable s = new String();

Which of the following statements is true about this line? (关于这行代码,下面哪句陈述是正确)
A .
It will result in a compile-time error(这行代码会引起编译时错误).
B .
It will result in a run-time error(这行代码会引起运行时错误).
C .
It will create a String object pointed to by a Comparable reference. (这行代码会创建一个Comparable引用指向的String对象)
D .
Although it is perfectly valid Java, it should be avoided due to confusion(虽然这是有效的Java代码,但应该避免使用,以免引起混淆).
E .
none of the above are true(以上都正确)
原因:This is a valid Java statement and will result in no errors, since the String class implements the Comparable interface
错题6:Suppose Animal is an interface that specifies a single method – speak. Now suppose the Dog class implements the Animal interface. In addition to the speak method, the Dog class also has a method called wagTail. Now consider the following code(假设Animal是一个指定了单一方法的接口--speak。现在假设Dog类实现了Animal接口。除了speak方法外,Dog类还有一个方法wagTail。现在思考下面的代码:).

Animal a = new Dog();
a.wagTail();

Which of the following is true about this code?(关于这段代码,下面哪项是正确的)
A .
It will result in a compile-time error(这段代码会引起编译时错误).
B .
It will result in a run-time error.(这段代码会引起运行时错误)
C .
It will call the speak method defined in the Animal interface. (这段代码将会调用Animal接口中的speak方法)
D .
It will call the wagTail method defined in the Dog class(这段代码将会调用Dog类中的wagTail方法).
E .
none of the above are true. (以上都正确)
原因:This code will result in a compile-time error since the Animal interface does not specify a wagTail method. This compile-time error can be avoided by explicitly casting a as a Dog when calling the wagTail method.

结对及互评

20162302(http://www.cnblogs.com/yangjingdian/p/6686697.html)

评分标准

  1. 正确使用Markdown语法(加1分):

    • 不使用Markdown不加分
    • 有语法错误的不加分(链接打不开,表格不对,列表不正确...)
    • 排版混乱的不加分
  2. 模板中的要素齐全(加1分)

    • 缺少“教材学习中的问题和解决过程”的不加分
    • 缺少“代码调试中的问题和解决过程”的不加分
    • 代码托管不能打开的不加分
    • 缺少“结对及互评”的不能打开的不加分
    • 缺少“上周考试错题总结”的不能加分
    • 缺少“进度条”的不能加分
    • 缺少“参考资料”的不能加分
  3. 教材学习中的问题和解决过程, 一个问题加1分

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

  5. 本周有效代码超过300分行的(加2分)

    • 一周提交次数少于20次的不加分
  6. 其他加分:

    • 周五前发博客的加1分
    • 感想,体会不假大空的加1分
    • 排版精美的加一分
    • 进度条中记录学习时间与改进情况的加1分
    • 有动手写新代码的加1分
    • 课后选择题有验证的加1分
    • 代码Commit Message规范的加1分
    • 错题学习深入的加1分
    • 点评认真,能指出博客和代码中的问题的加1分
    • 结对学习情况真实可信的加1分
  7. 扣分:

    • 有抄袭的扣至0分
    • 代码作弊的扣至0分
    • 迟交作业的扣至0分

点评模板:

  • 博客中值得学习的或问题:
    文字清晰明了 有逻辑性与学习性

  • 代码中值得学习的或问题:
    遇到代码问题不只是简单的纸上谈兵,会在得知错题的情况下用虚拟机验证

  • 基于评分标准,我给本博客打分:8分。得分情况如下:

    • 周五前发博客
    • 感想,体会不假大空
    • 排版精美
    • 进度条中记录学习时间与改进情况
    • 有动手写新代码
    • 课后选择题有验证
    • 代码Commit Message规范
    • 错题学习深入
  • 参考示例

点评过的同学博客和代码

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

学习进度条

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

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

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

  • 计划学习时间:10小时

  • 实际学习时间:5小时

  • 改进情况:

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

参考资料

posted on 2017-04-23 23:26  20162319莫礼钟  阅读(217)  评论(4编辑  收藏  举报