目錄
一、實驗目標概述
二、實驗環境配置
1、安裝撰寫java程式的IDE——IntelliJ IDEA
2、安裝Git
3、安裝Junit
4、GitHub Lab1倉庫的URL地址
三、實驗程序
1、Magic Squares
(1)isLegalMagicSquare()
(2)generateMagicSquare()
(3)源代碼
2、Turtle Graphics
(1)Problem 1:Clone and import
(2)Problem 3:Turtle graphics and drawSquare
(3)Problem 5:Drawing polygons
(4)Problem 6:Calculating Bearings
(5)Problem 7:Convex Hulls
(6)Problem 8:Personal Art
(7)Submitting
3、Social Network
(1)設計/實作FriendshipGraph類
(2)設計實作Person類
(3)設計/實作??????客戶端代碼main()
(4)設計/實作測驗用例
四、實驗識訓
1、經驗/教訓
2、感想
一、實驗目標概述
本次實驗通過求解三個問題,訓練基本 Java 編程技能,能夠利用 Java OO 開發基本的功能模塊,能夠閱讀理解已有代碼框架并根據功能需求補全代碼,能夠為所開發的代碼撰寫基本的測驗程式并完成測驗,初步保證所開發代碼的正確性,另一方面,利用 Git 作為代碼配置管理的工具,學會 Git 的基本使用方法,
- 基本的 Java OO 編程
- 基于 Eclipse IDE 進行 Java 編程
- 基于 JUnit 的測驗
- 基于 Git 的代碼配置管理
二、實驗環境配置
1、安裝撰寫java程式的IDE——IntelliJ IDEA
由于2021夏季小學期選擇了田英鑫老師的JavaEE課程,所以已經下載并配置好了撰寫Java程式的IDE:IntelliJ IDEA

2、安裝Git
打開Git官網準備安裝時發現,自己原來在大一時便已安裝并配置好了Git工具,因此不需要再重復安裝配置,
已于2021年11月14日安裝完成Git,
3、安裝Junit
打開IDEA的擴展市場:

在糾結下載安裝哪一款插件時咨詢了同學,經同學告知,下載了如下插件并安裝在IDEA上:

4、GitHub Lab1倉庫的URL地址
https://github.com/ComputerScienceHIT/HIT-Lab1-120L022408
三、實驗程序
1、Magic Squares
本題與Magic Square有關,Magic Square,即幻方,查閱百科后了解到,幻方是一種將數字安排在正方形格子中,使每行、列和對角線上的數字和都相等的方法,題目1要求撰寫一個Java程式(MagicSquare)先來檢查給定txt檔案中所記錄點五個矩陣的行/列/對角線值,然后分別判斷它們是否是一個幻方,題目2要求對給出的產生幻方的代碼(generateMagicSquare)進行改進擴展后加入MagicSquare類中進行測驗,
(1)isLegalMagicSquare()
a、函式分析
本題要求撰寫一個函式isLegalMagicSquare()判斷一個txt檔案中保存的矩陣是否為符合幻方要求的矩陣,輸入引數為txt檔案的檔案路徑,函式回傳一個boolean值,若符合要求回傳true,否則回傳false,
判斷幻方的合法性:
根據幻方的定義,首先需要判斷幻方必須是行數與列數相等的矩陣,假設幻方為N * N的矩陣,那么幻方的元素值都是自然數集上從1到N * N的一個排列,不能為負數,不能為浮點數,兩兩元素值也不能相同,最后確定行列和、對角線和之間是否全部相等,若是,則為幻方,函式回傳true,
b、實作思路
首先根據函式引數傳入的檔案路徑new一個file物件,使用FileInputStream流讀取檔案的內容,并保存在一個String型別的content字串中,

將檔案內容讀取到String后開始對檔案內容做處理,使用split("\n")方法檢測出文本中的換行標記,并以此分割出矩陣的每一行,并保存進一個字串陣列String line[]中,此時可呼叫length方法計算得出矩陣的行數row_num,再對矩陣的每一行進行處理,使用split("\t")方法檢測出每一行元素之間的分隔標記,并以此將其劃分為一個個數字字串,保存在String[] line_cut中,并使用Integer.valueOf(String ).intValue()方法,得到字串轉換為的數字num,回圈保存至幻方中,至此,對檔案的讀入及初始資料的處理完成,

在處理文本資料的程序中已判斷了行數與列數是否相等,故之后只需判斷一個行列數相等的矩陣元素是否滿足要求,由于在之前的try-catch陳述句中已將非整形資料的報錯拋出,故不需要考慮int型以外的其他資料格式,設定一個boolean[]陣列test來判斷元素的值是否已經出現過,初始化將其全設定為false,每讀入一個元素,若不小于0且未出現過,則將其值所對應的boolean[]陣列元素的值置為true,

最后判斷行列和、對角線和是否全部相等,若是則回傳true,否則回傳false,
(2)generateMagicSquare()
a、該函式的程式流程圖

b、實作思路
分析該函式的內容,給定一個引數n作為幻方的行列數,將初始位置置為(0, n / 2), 之后依次對1 ~ n * n賦值給一個位置,1賦值給初始位置,然后計算下一個位置為當前位置的右上位置,對于邊界情況:若當前行是第一行,則下一行取最后一行;若當前列是最右邊的那列,則下一列取最左邊的那列,當i能被n整除時,則將當前位置正下方的第一個位置賦值為i + 1,然后繼續回圈賦值,當回圈n的平方次后,即對整個矩陣賦完了值,且滿足每行每列以及兩條對角線之和均相同的約束,

c、對該函式進行擴展
I、將產生的magic square寫入檔案夾\src\P1\txt\6.txt中
使用FileWriter和BufferedWriter類寫入magic陣列所存盤的矩陣中保存的內容,代碼如下所示:

II、當輸入的引數n不合法時,輸出提示和false退出
在main()函式中給generateMagicSquare()傳遞引數前進行判斷,用String str保存從鍵盤接收到的字串的值,并用Integer.valueOf(str)將其轉換為數值保存到num中,這一步中若catch到NumberFormatException錯誤,則說明引數num不為整形,列印錯誤資訊并提示重新輸入,

再在generateMagicSquare()函式中對引數n做判斷:若n為偶數,則列印錯誤資訊并回傳false;若n為負數,則catch到NegativeArraySizeException錯誤,同樣列印錯誤資訊并回傳false,

(3)源代碼
package P1;
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
public class MagicSquare
{
static final int N = 200;
public static int[][] square = new int[N][N];
public static boolean[] test = new boolean[N * N + 1];
public static boolean isLegalMagicSquare (String fileName)
{
File file = new File(fileName);
String content = null;
Long file_len = file.length();
byte[] file_content = new byte[file_len.intValue()];
int col_num = 0, row_num = 0;
Arrays.fill(test, false);
try {
FileInputStream file_In = new FileInputStream(file);
file_In.read(file_content);
file_In.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
content = new String(file_content, "UTF-8");
} catch (UnsupportedEncodingException e) {
System.err.println("We don't support UTF-8\t");
e.printStackTrace();
}
String line[] = content.split("\n");
row_num = line.length;
col_num = row_num;
int sum_Row[] = new int[row_num];
int sum_Col[] = new int[col_num];
int sum_Dia[] = new int[2];
for (int i = 0; i < row_num; i++)
{
String[] line_cut = line[i].split("\t");
if(line_cut.length != row_num)
{
System.out.print("行列數不相等 或者未使用'\\t'分隔\t");
return false;
}
for (int j = 0; j < row_num; j++)
{
try {
int num = Integer.valueOf(line_cut[j]).intValue();
square[i][j] = num;
} catch (NumberFormatException e) {
System.out.print("存在非法輸入\t");
return false;
}
if (square[i][j] <= 0 || test[ square[i][j] ] == true)
{
System.out.print("存在負數或至少存在兩數相等\t\t");
return false;
}
else
{
test[ square[i][j] ] = true;
sum_Row[i] += square[i][j];
sum_Col[j] += square[i][j];
if (i == j)
{
sum_Dia[0] += square[i][j];
}
if (i + j + 1 == col_num)
{
sum_Dia[1] += square[i][j];
}
}
}
}
if(sum_Dia[0] != sum_Dia[1])
{
System.out.print("兩條對角線和不相等\t");
}
int Sum = sum_Dia[0];
for(int i = 0; i < row_num; i++)
{
if (sum_Row[i] != Sum || sum_Col[i] !=Sum)
{
System.out.print("行列和與對角線和不相等\t");
return false;
}
}
return true;
}
public static boolean generateMagicSquare(int n)
{
try {
if (n % 2 == 0)
{
System.out.println("輸入為偶數\t");
return false;
}
else
{
int magic[][] = new int [n][n];
int row = 0, col = n / 2, i, j, square = n * n;
for (i = 1; i <= square; i++)
{
try {
magic[row][col] = i; //遞增地給當前位置賦值
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("輸入錯誤\t");
return false;
}
if (i % n == 0)
{
row++; //當i恰賦完n的倍數個值時,下一位置取當前位置的正下方第一個位置
}
else
{
if (row == 0)
{
row = n - 1; //如果元素位置來到了第一行,則從最后一行開始
}
else
{
row--; //正常情況下行數-1
}
if (col == (n - 1))
{
col = 0; //如果元素位置來到了最后一列,則從第一列開始
}
else
{
col++; //正常情況下列數+1
}
}
}
//輸出矩陣元素
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
System.out.print(magic[i][j] + "\t");
}
System.out.println();
}
//寫入檔案6.txt
File writeOut = new File("src/P1/txt/6.txt");
try {
writeOut.createNewFile();
FileWriter FWriter = new FileWriter(writeOut);
BufferedWriter BfWriter = new BufferedWriter(FWriter);
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
BfWriter.write(magic[i][j] + "\t");
}
BfWriter.write("\n");
}
BfWriter.flush();
BfWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
} catch (NegativeArraySizeException e) {
System.out.println("輸入為負數\t");
return false;
}
}
public static void main(String[] args)
{
System.out.println("檢測以下五個txt中是否為幻方,若是則回傳true,不是則列印錯誤原因并回傳false:");
for (char i = '1'; i <= '5'; i++)
{
System.out.print(i + ".txt\t");
System.out.println(isLegalMagicSquare("src/P1/txt/" + i + ".txt"));
}
String str;
Scanner scan = new Scanner(System.in);
while (true)
{
System.out.println("請輸入奇數的幻方寬度或輸入'stop'以結束程式:");
str = scan.nextLine();
if(str.equals("stop"))
{
System.out.println("程式結束");
return;
}
else
{
try {
int num = Integer.valueOf(str);
if (generateMagicSquare(num) != false)
{
System.out.print("6.txt\t");
System.out.println(isLegalMagicSquare("src/P1/txt/6.txt"));
}
} catch (NumberFormatException e) {
System.out.println("輸入錯誤!");
}
}
}
}
}
2、Turtle Graphics
熟悉Turtle Graphics的各種函式介面,自己撰寫部分函式,并使用Math庫的一些函式實作一些計算以畫出所需圖形,
(1)Problem 1:Clone and import
a、獲取任務代碼
從報告里的鏈接上獲取了源檔案,在IDEA里建立了相關檔案夾后,把下載的源檔案放到對應檔案夾里,IDEA重繪后修改包名并使用,
b、使用Git管理本地開發
先用Git創建本地倉庫,然后和遠程倉庫連接,git pull拉取代碼,
實作一個功能后用git add .上傳專案檔案,然后commit、push提交到遠程倉庫上,
(2)Problem 3:Turtle graphics and drawSquare
題目要求使用Turtle類中給出的forward()方法和turn()方法,引數是海龜物件turtle和邊長sideLength,最后實作出能夠畫出邊長為指定數值的正方形,
實作思路:
回圈執行4次,每次forward前行sideLength的距離,然后畫筆方向旋轉90度,繼續下一次執行,即可得到所要求的正方形,實作結果如下(sideLength = 100):

函式代碼如下:
public static void drawSquare(Turtle turtle, int sideLength)
{
turtle.color(PenColor.RED);
for (int i = 0; i < 4; i++)
{
turtle.forward(sideLength);
turtle.turn(90);
}
}
(3)Problem 5:Drawing polygons
題目要求實作能夠畫出正多邊形的函式drawRegularPolygon(),
首先需要實作一個輔助函式calculateRegularPolygonAngle()用于計算正多邊形的每個內角度數,由數學知識可知,該函式實作如下:
public static double calculateRegularPolygonAngle(int sides)
{
return (sides - 2) * (180.0 / sides);
}
通過TurtleSoupTest中的Junit測驗后再呼叫calculateRegularPolygonAngle()得出所求正多邊形的內角度數,類比畫正方形的函式,由數學公式可知,代碼實作如下:
public static void drawRegularPolygon(Turtle turtle, int sides, int sideLength)
{
double angle = 180 - calculateRegularPolygonAngle(sides);
for (int i = 0; i < sides; i++)
{
turtle.forward(sideLength);
turtle.turn(angle);
}
}
運行效果如下(邊長為100的正六邊形):

(4)Problem 6:Calculating Bearings
a、實作 calculateBearingToPoint()
題目要求在已知當前起點和當前朝向角度已知的情況下,計算從起點轉動到終點的角度,因此首先使用Math.atan2()函式計算兩點之間的邊在坐標系中的角度,再減去當前朝向的角度,注意到海龜旋轉方向與坐標軸旋轉角度方向相反,因此需要取相反數,同樣,海龜的基準線是向上,坐標的基準線是向右,因此還需減去90度,最后調整結果在0~360度之間,
代碼實作如下:
public static double calculateBearingToPoint(double currentBearing, int currentX, int currentY, int targetX, int targetY)
{
double degree = Math.toDegrees(Math.atan2(targetY - currentY, targetX - currentX));
degree = (90 - degree) - currentBearing;
if (degree < 0)
{
degree += 360;
}
return degree;
}
運行并通過了Junit測驗,
b、實作 calculateBearings()
題目要求已知若干個點,現在想計算出從第一個點開始到第二個點,第二個點到第三個點……以此類推每次轉向的角度,
不妨記有n個點,一開始將“起點”選為第一個點,回圈n-1次,每次將i+1個點設定為“終點”,通過calculateBearingToPoint()函式計算旋轉角度并保存到List中,再將當前“終點”當做下一次回圈的“起點”,繼續回圈……最后回傳List,
代碼實作如下:
public static List<Double> calculateBearings(List<Integer> xCoords, List<Integer> yCoords)
{
List<Double> result = new ArrayList<Double>();
result.add(calculateBearingToPoint(0.0, xCoords.get(0), yCoords.get(0), xCoords.get(1), yCoords.get(1)));
if (xCoords.size() > 2)
{
for (int i = 2; i < xCoords.size(); i++)
{
result.add(calculateBearingToPoint(result.get(i - 2), xCoords.get(i - 1), yCoords.get(i - 1), xCoords.get(i), yCoords.get(i)));
}
}
return result;
}
運行并通過了Junit測驗,
(5)Problem 7:Convex Hulls
根據題目提示,運用Gift wrapping algorithm演算法,每次都選擇轉向角最小且點間距離最長的點加入集合中,計算轉向角度可使用上題的calculateBearingToPoint函式,其中相同轉向角點之間的取舍,可以在回圈中使用標記變數Dist_target記錄其與當前目標點的距離,如果之后出現了新的目標點,就用Dist_target和計算得到的當前點的距離Dist_temp來比較,取更大者為新的Dist_target,
代碼實作如下:
public static Set<Point> convexHull(Set<Point> points)
{
ArrayList<Point> Points_convex = new ArrayList<Point>();
ArrayList<Point> Points_temp = new ArrayList<Point>();
Points_temp.addAll(points);
Set<Point> result = new HashSet<Point>();
int totalNum = Points_temp.size();
if (totalNum < 4) // 點集中點小于4時,直接回傳
{
return points;
}
Point Point_first = Points_temp.get(0);
for (Point Point_now : points)
{ // 找到起始點
if (Point_now.x() < Point_first.x())
{
Point_first = Point_now;
}
else if (Point_now.x() == Point_first.x() && Point_now.y() < Point_first.y())
{
Point_first = Point_now;
}
}
Points_convex.add(Point_first);//初始點加入集合
Points_temp.remove(Point_first);//從原始集合中去除初始點
Point Point_previous = Point_first;
int count = 0;
do {
if (count == 1)
{
Points_temp.add(Point_first);//再把原始點加入集合,作為回圈的終止條件
}
Point Point_target = null;//初始點目標點為空
double Angle_target = 360;//每次回圈找到的最小角度,初始化為360
double Dist_target = 0;
for (Point Point_now : Points_temp)
{
double Angle_temp = calculateBearingToPoint(0, (int) Point_previous.x(), (int) Point_previous.y(), (int) Point_now.x(), (int) Point_now.y());//計算轉向角
double Dist_temp = Math.pow(Point_previous.x() - Point_now.x(), 2) + Math.pow(Point_previous.y() - Point_now.y(), 2);//計算距離
if (Angle_temp < Angle_target) //如果轉向角比當前找到的最小角度要小,設定新的Angle_target和Dist_target
{
Angle_target = Angle_temp;
Point_target = Point_now;
Dist_target = Dist_temp;
}
else if (Angle_temp == Angle_target && Dist_temp > Dist_target) //取遠端點
{
Dist_target = Dist_temp;
Point_target = Point_now;
}
}
Points_convex.add(Point_target);
Points_temp.remove(Point_target);
Point_previous = Point_target;
count++;
} while (Points_convex.get(count) != Point_first);
result.addAll(Points_convex);
return result;
}
運行并通過了Junit測驗,
(6)Problem 8:Personal Art
思路:在畫正多邊形的基礎上,步長越來越長,并且角度比畫正多邊形需要的角度略多一點,每次拐彎變換一次顏色,
其中NumColor是顏色數量,Step是每次變化的步長,Change控制螺旋的密度,其值越大拐彎幅度越大,
效果如下:

代碼實作如下(其中Switch陳述句里設定畫筆的顏色):
public static void drawPersonalArt(Turtle turtle)
{
int NumColor = 9, Step = 1, Change = 109, Size = 360;
for (int i = 0; i < Size; i++)
{
int temp = i / 18;
switch (temp % NumColor)
{
case 0:
turtle.color(PenColor.MAGENTA);
break;
case 1:
turtle.color(PenColor.BLUE);
break;
case 2:
turtle.color(PenColor.RED);
break;
case 3:
turtle.color(PenColor.PINK);
break;
case 4:
turtle.color(PenColor.YELLOW);
break;
case 5:
turtle.color(PenColor.GREEN);
break;
case 6:
turtle.color(PenColor.CYAN);
break;
case 7:
turtle.color(PenColor.ORANGE);
break;
case 8:
turtle.color(PenColor.GRAY);
break;
}
turtle.forward(Step * i);
turtle.turn(360 / NumColor + Change);
}
}
(7)Submitting
在CSDN的博客(https://blog.csdn.net/qq_28849009/article/details/104486824)里初步學習了Git的使用,
①到要上傳的檔案夾里面
cd /d/CODES/GitHub/SoftwareConstruction/HIT-Lab1-120L022408
②初始化本地git倉庫
git init
③添加倉庫url
git remote add origin https://github.com/ComputerScienceHIT/HIT-Lab1-120L022408
④認證身份
git config --global user.name "XXX"
git config --global user.email "[email protected]"
⑤選擇所要上傳的檔案
git add .
⑥添加修改日志
git commit -m "XXX"
⑦上傳檔案
git push -u origin master
3、Social Network
題目要求設計實作一張社交關系網路圖,并撰寫一個計算人機關系“距離”的函式,網路圖基于兩個類,分別是FriendshipGraph類和Person類,
(1)設計/實作FriendshipGraph類
每個成員的朋友放在List中,用Graph存取圖的映射關系,
public Map<Person,ArrayList<Person>> Graph = new HashMap<Person, ArrayList<Person>>();
a、addVertex(Person People)
用來向people串列加入新的成員,注意需要在加入之前先在圖中檢測是否有重名的成員,有則輸出錯誤提示并退出,
public void addVertex(Person People)
{
for (Person p : Graph.keySet())
{
if (p.getName().equalsIgnoreCase(People.getName()))
{
System.out.println(People.getName() + "名稱重復!");
System.exit(0);
}
}
ArrayList<Person> newArray = new ArrayList<Person>();
this.Graph.put(People, newArray);
}
b、addEdge(Person People1, Person People2)
函式使用Graph.get(People1).add(People2),在每個人的朋友串列中添加新的朋友,同樣,在添加朋友之前先檢查被添加朋友的成員在圖中是否存在,若不存在則報錯并退出,
public void addEdge(Person People1, Person People2)
{
if (Graph.containsKey(People1))
{
Graph.get(People1).add(People2);
}
else
{
System.out.println(People1.getName() + "查無此人!");
System.exit(0);
}
}
c、getDistance(Person People1, Person People2)
該函式首先宣告一個ArrayList<Personr> visited_Person資料結構,來保存已訪問過的成員物件,使用鄰接表廣度搜索的方法,借助佇列,先將起點入隊,然后執行回圈,直到佇列為空前:彈出佇列頭元素,計算當前距離,把彈出點的所有“朋友”入隊,并加入visited_Person中,設定距離為先前計算的距離+1,直到找到目標點,回傳當前距離,若直到佇列為空仍未找到目標點,回傳 -1,
public int getDistance(Person People1, Person People2)
{
Person Temp = People1, Target = People1;
int i = 0 , distance = 0;
Queue<Person> queue_Person = new LinkedList<Person>();
ArrayList<Person> visited_Person = new ArrayList<Person>();
if (People1 == People2)
{
return distance;
}
queue_Person.add(Temp);
visited_Person.add(Temp);
while (!queue_Person.isEmpty())
{
Temp = queue_Person.poll();
distance ++;
while (i < Graph.get(Temp).size())
{
Target = Graph.get(Temp).get(i);
if (Target == People2)
{
return distance; //找到了即回傳當前的距離
}
if (!visited_Person.contains(Target))
{
queue_Person.add(Target);
visited_Person.add(Target);
}
i++;
}
i = 0;
}
return -1; //找不到說明People1和People2不存在聯系
}
(2)設計實作Person類
Person類:
保存物件名字的字串private String Name
得到當前物件名字的方法getName()
判斷當前物件名字與給定名字是否相同的方法isSameName()
package P3;
public class Person
{
private final String Name;
public Person (String Name)
{
this.Name = Name;
}
public String getName()
{
return this.Name;
}
public boolean isSameName(String Name)
{
return this.Name.equals(Name);
}
}
(3)設計/實作??????客戶端代碼main()
a、不修改提供的main()的代碼
測驗結果如下:

b、注釋掉“graph.addEdge(rachel, ross)”
測驗結果為:

原因是:
從rachel到ross的邊不存在了,所以rachel,和ross距離-1,其他點也無法達到,只有getDistance(rachel, rachel)回傳0,
c、修改main()輸入重復姓名測驗

測驗結果為:

原因是在前面代碼中設定了查找到重復名字就退出的檢查:

(4)設計/實作測驗用例
根據FriendshipGraph類和Person類設計了一個test檢測各種距離和不可到達的情況,
package P3;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class FriendshipGraphTest {
@Test(expected = AssertionError.class)
public void testAssertionsEnabled() {
assert false; // make sure assertions are enabled with VM argument: -ea
}
@Test
public void testBasicFriendshipGraph() throws Exception
{
FriendshipGraph graph = new FriendshipGraph();
Person a = new Person("a");
Person b = new Person("b");
Person c = new Person("c");
Person d = new Person("d");
graph.addVertex(a);
graph.addVertex(b);
graph.addVertex(c);
graph.addVertex(d);
graph.addEdge(a, b);
graph.addEdge(b, c);
graph.addEdge(c, d);
assertEquals("expected distance", 1, graph.getDistance(a, b));
assertEquals("expected distance", 1, graph.getDistance(b, c));
assertEquals("expected distance", 1, graph.getDistance(c, d));
assertEquals("expected distance", 2, graph.getDistance(a, c));
assertEquals("expected distance", 2, graph.getDistance(b, d));
assertEquals("expected distance", 3, graph.getDistance(a, d));
assertEquals("expected distance", -1, graph.getDistance(b, a));
}
}
四、實驗識訓
1、經驗/教訓
對java語言的掌握十分不足,下一次實驗前需要加強,
認識到了趁手的工具軟體對程式員的幫助有多大,“工欲善其事必先利其器”,下一次實驗前將配置好更得心應手的工具軟體,
2、感想
(1)Java編程語言是否對你的口味?與你熟悉的其他編程語言相比,Java有何優勢和不足?
非常對我的口味,具體就是有很多資料結構直接可以使用,Java提供的庫函式功能十分強大,深受我的喜愛,
在此之前,我只熟悉C語言,相比之下,Java相較于C語言的優點是:C語言特別簡陋,許多常用的資料結構的實作都需要自己重新撰寫;而Java簡單易上手,缺點是:C語言更接近程式的底層邏輯,運行效率更高,且更能鍛煉程式員的基礎能力;而Java并不能使程式員了解一些資料結構的具體實作,
(2)關于Eclipse或IntelliJ IDEA,它們作為IDE的優勢和不足;
在2021夏季小學期開始使用過Eclipse,小學期快結束時接觸到了IDEA,因此我對其感受頗深,Eclipse的優勢在于其免費,其余無任何優勢,IDEA的優勢在于插件豐富,集成更智能,界面更美觀,使用十分舒心,不足在于旗艦版收費,但可使用學生郵箱認證身份來免費使用,
(3)關于Git和GitHub,是否感受到了它在版本控制方面的價值;
需要繼續學習才能熟練掌握使用,
(4)關于CMU和MIT的作業,你有何感受;
能夠向世界一流計算機專業學習是邁向世界一流的必經之路,
(5)關于本實驗的作業量、難度、deadline;
作業量大,難度不小,deadline撞車《形式語言與自動機》課程的期末考試,因此時間十分緊張,高強度學習知識并撰寫代碼的同時很難統籌兼顧其他課程的復習與預習,
(6)關于初接觸“軟體構造”課程;
有趣,可學習性強,頗有難度,英語閱讀困難,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/471754.html
標籤:Java
上一篇:Java 14中對switch的增強,終于可以不寫break了
下一篇:Spring與Web環境集成
