《数据结构与面向对象程序设计》第四周学习总结

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

教材学习内容总结

  • 1.本章咱们学习了使用并编写咱们本身的类:类中有与类同名的构造方法,也能够有set,get,toSring与本身定义的方法。实例化一个对象,可经过该对象使用类里的全部方法。实例数据是每次创造一个实例后自动生成新的内存空间的变量
  • 2.uml类图 :每一个类可能包含三部份内容:类名、属性、操做(方法)。UML类图有属于本身的语法,变量的类型名在变量名的后面,它们之间用冒号做为分隔符,方法的+和-代表可见性。箭头指向,代表一个类知道并以某种方法使用另外一个类(调用)。
  • 3.封装概念
  • 4.可见性修饰符 :public 可从类外直接访问(通常将常量设为公有,由于它不能被随意改变,安全性能够获得保障)
    private 强制封装,不能被类外调用 protected与继承关系相关,既能够被子类调用,也保证了封装
  • 5.类中的关系:依赖(has a)、继承、聚合,this引用
  • 6.接口的概念html

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

  • 问题1:如何理解静态方法
  • 问题1解决方案:静态方法用static修饰,不用实例化类就能够调用。它不能引用类的实例中的实例变量,因此通常引用静态变量
  • 问题2:this引用有什么做用
  • 问题2解决方案:this引用能让一个对象指向本身,this引用经常使用来区分构造方法中的参数与对应的同名实例变量。在须要给类中的数据传参时,能够取相同的名字,只要左边加上this.引用
  • 问题3:封装的概念是什么,为何要提倡封装
  • 问题3解决方案:对象应该是封装的,封装就是将数据与相关行为包装在一块儿以实现信息隐藏,既能够隐藏类的实现细节,又能够避免对类中属性的直接操做。封装实际上控制用户对类的修改和访问数据的程度,只可以经过对象提供服务的那些方法与程序其它部分进行交互,接口是封装的准确描述手段。一个类内的声明变量,应该仅由类内访问并修改,类外不该该也不能修改变量的值。git

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

  • 问题1:误在get方法中传参致使程序错误
  • 问题1解决方案:经过同窗的帮助,了解到get方法中不能传入参数,只能返回数据。传参应该在其它方法如set中完成
  • 问题2:在敲书上的Coin类时,一行代码count1 = (coin1.isHeads()) ? count1+1 : 0;我将count1+1敲成了count++,原本觉得区别不大,程序运行时却形成了死循环

    api

  • 问题2解决方案:count++count=count+1等价,count自己被该变了。由于上式中等式左边有count=,因此形成了死循环。而count+1不改变count的值,因此在赋值语句中能够正常使用
  • 问题3:git配置好后没法正常上传
  • 问题3解决方案:没有看清 push 后再提交,默认的是commit,须要本身手动设置一下安全

代码托管

数据结构

app

上周考试错题总结

  • What is the function of the dot operator?
    • A .It serves to separate the integer portion from the fractional portion of a floating point number
    • B .It allows one to access the data within an object when given a reference to the object
    • C .It allows one to invoke a method within an object when given a reference to the object
    • D .It is used to terminate commands (much as a period terminates a sentence in English)
    • E .Both B and C are correct
    • The dot operator is appended directly after the object reference, followed by the data or method to which access is desired. In the case of data, the access may be for reading or writing. In the case of a method, the access is to allow one to invoke the method. The dot within a floating point number is a decimal point not a dot operator.
    • 理解:点运算符能够直接加在对象引用以后,而后加上要调用的方法名,也能够在给定对象的引用时访问对象中的数据。。
  • The String class' compareTo method
    • A .compares two string in a case-independent manner
    • B .yields true or false
    • C .yields 0 if the two strings are identical
    • D .returns 1 if the first string comes lexically before the second string
    • E .none of the above
    • 理解:identical为相等,没有理解英文含义致使错误。compareTo与C中的用法类似
  • The names of the wrapper classes are just the names of the primitive data types, but with an initial capital letter.
    • A .true
    • B .false
    • This is true for most of the wrapper classes, but it is false for int (Integer) and char (Character).
    • 理解:翻阅图书,可查到int的包装类为Integer,char的包装类是Character,其它类型包装类为首字母大写
  • The advantage(s) of the Random class' pseudo-random number generators, compared to the Math.random method, is that
    • A .you may create several random number generators
    • B .the generators in Random are more efficient than the one in Math.random
    • C .you can generate random ints, floats, and ints within a range
    • D .you can initialize and reinitialize Random generators
    • E .all but answer B
    • The efficiency of all the random number generators are the same. The advantages of Random generators over Math.random include all the other properties.
    • 理解:效率是同样的
  • These two ways of setting up a String yield identical results:
  • a) String string = new String("123.45"); b) String string = "" + 123.45;
    • A .true
    • B .false
    • 理解:""也是字符串,+能够自动链接字符串,这样后面的数字也以字符串的形式被赋给了string,二者等价
  • In order to preserve encapsulation of an object, we would do all of the following except for which one?
    • A .Make the instance data private
    • B .Define the methods in the class to access and manipulate the instance data
    • C .Make the methods of the class public
    • D .Make the class final
    • E .All of the above preserve encapsulation
    • Encapsulation means that the class contains both the data and the methods needed to manipulate the data. In order to preserve encapsulation properly, the instance data should not be directly accessible from outside of the classes, so the instance data are made private and methods are defined to access and manipulate the instance data. Further, the methods to access and manipulate the instance data are made public so that other classes can use the object. The reserved word "final" is used to control inheritance and has nothing to do with encapsulation.
    • 理解 :D必定是错误的,若是把类设置成final,它就不能被重写,子类一直都会是抽象类,不能实例化
  • Having multiple class methods of the same name where each method has a different number of or type of parameters is known as
    • A .encapsulation
    • B .information hiding
    • C .tokenizing
    • D .importing
    • E .method overloading
    • When methods share the same name, they are said to be overloaded. The number and type of parameters passed in the message provides the information by which the proper method is called.
    • 理解:错误缘由是由于对书中类型知识点理解不足
  • Visibility modifiers include
    • Public, private, protected control the visibility of variables and methods. Final controls whether a variable, method, or class can be further changed or overridden not visibility. Static controls whether a variable or method is associated with instances of a class or the class itself.
  • The following method header definition will result in a syntax error: public void aMethod( );
    • A .true
    • B .false
    • The reason for the syntax error is because it ends with a ";" symbol. It instead needs to be followed by { } with 0 or more instructions inside of the brackets. An abstract method will end with a ";" but this header does not define an abstract method.
    • 理解:首先,方法后不能有冒号。其次,它后面应该有一个大括号
  • Every class definition must include a constructor.
    • A .true
    • B .false
    • Java allows classes to be defined without constructors, however, there is a default constructor that is used in such a case.
    • 理解:能够不定义,它会默认生成一个构造方法

结对及互评

评分标准

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

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

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

点评模板:

  • 博客中值得学习的或问题:
    • 错题分析总结较为全面
    • 教材内容总结齐全
    • 问题总结不够深入
  • 代码中值得学习的或问题:
    • 本周代码行数相对降低
  • 基于评分标准,我给本博客打分:17分。得分状况以下:学习

  • 参考示例测试

点评过的同窗博客和代码

  • 本周结对学习状况
    • 20182302
      • 结对学习内容
      • 学习接口的概念与具体操做
      • 理解类的定义与封装
      • 调试实验程序中的编译错误
  • 上周博客互评状况

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

  • 在测试后,我发现本身只对教材有大概理解,不少知识点细节仍是陌生的,存在着很大的提高空间
  • 从第五章开始,Java的学习难度是比较大的,须要花费更多时间精力学习

学习进度条

代码行数(新增/累积) 博客量(新增/累积) 学习时间(新增/累积) 重要成长
目标 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 35/100

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

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

  • 计划学习时间:40小时

  • 实际学习时间:35小时

  • 改进状况:我会努力提升一些学习效率

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

参考资料

相关文章
相关标签/搜索