20182324 2019-2020-1 《数据结构与面向对象程序设计》第5周学习总结

20182324 2019-2020-1 《数据结构与面向对象程序设计》第5周学习总结

教材学习内容总结

1、继承是从已有类派生一个新类的过程
2、继承的目的之一是复用已有的软件。
3、继承在父类和子类中建立了 is-a 关系
4、保护可见性提供了继承之间最恰当的封装机制
5、使用 super 来调用父类中的构造方法
6、子类可以重写(重定义)继承自父类的方法
7、Java 的所有类都直接或间接地派生于 Object 类, Java 程序中的每个类都继承了 toString 和 equals 方法
8、抽象类不能实例化,它提供的概念可由其它类来定义

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

  • 问题1:方法重载与方法重写的区别
  • 问题1解决方案:
区别点 方法重载 方法重写
英文 overload override
定义 方法名称相同,参数的类型或个数不同 对权限没有要求 方法名称、参数类型、返回值类型全部相同 被重写的方法不能拥有更严格的权限
范围 发生在一个类中 发生在继承类中
  • 问题2:使用 Java Socket 命令搭建了 server 和 client 后无法与其它计算机相互连接
  • 问题2解决方案:在连接了个人热点和寝室 WiFi 的情况下可以正常连接,怀疑是 912 的 WiFi 有问题

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

  • 问题:git 怎么撤销自己不想上传的文件
  • 问题解决方案:如果已经 commit 了但没有 push ,可使用git reset --soft HEAD^命令撤销 commit 操作,然后再使用git reset HEAD命令撤销 add 操作;如果只是 add 还没有 commit ,直接执行第二步操作即可。

代码托管

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

上周考试错题总结

  • Inheritance through an extended (derived) class supports which of the following concepts?
    A. interfaces
    B. modulary
    C. information hiding
    D. code reuse
    E. correctness
    解析:By extending a class and inheriting from it, the new class does not have to reimplement any of those inherited methods or instance data, thus saving the programmer an effort. So, code reuse is the ability to reuse someone else's code for your benefit by extending it for your need.

  • Aside from permitting inheritance, the visibility modifier protected is also used to
    A. permit access to the protected item by any class defined in the same package
    B. permit access to the protected item by any static class
    C. permit access to the protected item by any parent class
    D. ensure that the class can not throw a NullPointerException
    E. define abstract elements of an interface
    解析:The visibility modifier protected is used to control access to the item in a protected (guarded) manner. The protection is that access is restricted to the current class (like private items), classes in the same package, or extended classes of this class.

  • 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
    解析:Java supports inheritance but not multiple inheritance, so a Java class can have any number of children but only one parent. Further, since all Java classes inherit either directly or indirectly from the Object class, all Java classes have exactly 1 parent class.

  • 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 super reserved word provides a mechanism for accessing a parent class'methods and instance data (whether or not they are hidden). In addition, a parent class'constructor(s) may be accessed using super. So the correct answer is the combination of A and B which isn't an option so the correct answer is E.

  • Interface classes cannot be extended but classes that implement interfaces can be extended.
    A. true
    B. false
    解析:Any class can be extended whether it is an interface, implements an interface, or neither. The only exception to this is if the class is explicitly modified with the word "final" in which case it cannot be extended.

结对及互评

点评:

  • 博客中值得学习的或问题:

    • 图文并茂,有参考资料
    • markdown 格式运用较为熟练
  • 代码中值得学习的或问题:

    • 代码格式规范,合理使用空白,便于阅读
  • 基于评分标准,我给本博客打分:14分。得分情况如下:

    • 1、正确使用Markdown语法(加1分)
    • 2、模板中的要素齐全(加1分)
    • 3、教材学习中的问题和解决过程(2分)
    • 4、代码调试中的问题和解决过程(1分)
    • 5、本周有效代码超过300分行的(加2分)
    • 6、其他加分:
      • 感想,体会不假大空的加1分
      • 进度条中记录学习时间与改进情况的加1分
      • 有动手写新代码的加1分
      • 代码Commit Message规范的加1分
      • 错题学习深入的加1分
      • 点评认真,能指出博客和代码中的问题的加1分
      • 结对学习情况真实可信的加1分
  • 参考示例

点评过的同学博客和代码

  • 本周结对学习情况
    • 20182329

    • 结对学习内容

      • 学习 Java Socket 编程,实现数据传递
      • 学习凯撒密码的使用方法
      • 学习了解Java密码的DES算法、RSA算法和DH算法
      • 编写简单的有理数和复数计算器
      • 使用 Java Socket 编写服务器与客户端,结合编写的计算器,实现远程计算功能

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

本周国庆节放假,主要仅针对实验内容进行学习。

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 10000行 30篇 400小时
第一周 109/109 2/2 28/28 学习了Java的基本语法格式,熟练使用 Linux Bash 命令
第二周 550/659 1/3 23/51 学习掌握JDB调试命令
第三周 1028/1687 2/5 30/81 学习类的编写与使用
第四周 542/2229 2/7 22/103 学习方法重载,类的继承、聚合等
第五周 1197/3426 2/9 15/118 学习 Java Socket ,了解加密算法

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

  • 计划学习时间:20小时

  • 实际学习时间:15小时

  • 改进情况:本周国庆节,学习时长有所减少

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

参考资料

posted @ 2019-10-07 23:12  Lolipop  阅读(208)  评论(0编辑  收藏  举报