《數據結構與面向對象程序設計》第四周學習總結

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小時

  • 改進狀況:我會努力提升一些學習效率

(有空多看看現代軟件工程 課件
軟件工程師能力自我評價表
)

參考資料

相關文章
相關標籤/搜索