word count(小组)
合作者:201631062314,201631062214
碼云地址:https://gitee.com/dsjyun/Word-Count-three
一、代碼互審:
? ??第一次都是實(shí)現(xiàn)了基本功能,沒有完成擴(kuò)展功能,這次還有個(gè)高級(jí)功能,于是討論了后續(xù)功能如何實(shí)現(xiàn)。
我們的意見基本一致,認(rèn)為高級(jí)功能需要窗體來實(shí)現(xiàn)比較簡單,于是決定用C#語言來實(shí)現(xiàn)。
二、部分代碼
using System; using System.Diagnostics;namespace WordCount {class program{static void Main(string[] args){Console.Write("wc.exe -c file.c\t返回文件 file.c 的字符數(shù)\n" +"wc.exe -w file.c\t返回文件 file.c 的單詞總數(shù)\n" +"wc.exe -l file.c\t返回文件 file.c 的總行數(shù)\n" +"wc.exe -a file.c\t返回更復(fù)雜的數(shù)據(jù)(代碼行/空行/注釋行)\n" +"wc.exe -o output.txt\t將結(jié)果輸出到指定文件output.txt\n" +"wc.exe -e stopList.txt\t停用詞表,統(tǒng)計(jì)文件單詞總數(shù)時(shí),不統(tǒng)計(jì)該表中的單詞\n" +"wc.exe -s\t循環(huán)執(zhí)行所有.c文件\n");Wordcount wc = new Wordcount();while (true){Console.WriteLine("--------------------------");Console.WriteLine("輸入命令:");string str = Console.ReadLine();Stopwatch stopwatch = new Stopwatch();stopwatch.Start(); // 開始監(jiān)視代碼運(yùn)行時(shí)間 wc.ExecutiveCommand(str);stopwatch.Stop(); // 停止監(jiān)視TimeSpan timespan = stopwatch.Elapsed; // 獲取當(dāng)前實(shí)例測(cè)量得出的總時(shí)間string hours = timespan.TotalHours.ToString("#0.00000000 "); // 總小時(shí)string minutes = timespan.TotalMinutes.ToString("#0.00000000 "); // 總分鐘string seconds = timespan.TotalSeconds.ToString("#0.00000000 "); // 總秒數(shù)string milliseconds = timespan.TotalMilliseconds.ToString("#0.00000000 "); // 總毫秒數(shù)Console.Write("運(yùn)行時(shí)間 "+timespan);}}} }主函數(shù),性能測(cè)試 主函數(shù)+性能測(cè)試 using System; using System.Diagnostics;namespace WordCount {class program{static void Main(string[] args){Console.Write("wc.exe -c file.c\t返回文件 file.c 的字符數(shù)\n" +"wc.exe -w file.c\t返回文件 file.c 的單詞總數(shù)\n" +"wc.exe -l file.c\t返回文件 file.c 的總行數(shù)\n" +"wc.exe -a file.c\t返回更復(fù)雜的數(shù)據(jù)(代碼行/空行/注釋行)\n" +"wc.exe -o output.txt\t將結(jié)果輸出到指定文件output.txt\n" +"wc.exe -e stopList.txt\t停用詞表,統(tǒng)計(jì)文件單詞總數(shù)時(shí),不統(tǒng)計(jì)該表中的單詞\n" +"wc.exe -s\t循環(huán)執(zhí)行所有.c文件\n");Wordcount wc = new Wordcount();while (true){Console.WriteLine("--------------------------");Console.WriteLine("輸入命令:");string str = Console.ReadLine();Stopwatch stopwatch = new Stopwatch();stopwatch.Start(); // 開始監(jiān)視代碼運(yùn)行時(shí)間 wc.ExecutiveCommand(str);stopwatch.Stop(); // 停止監(jiān)視TimeSpan timespan = stopwatch.Elapsed; // 獲取當(dāng)前實(shí)例測(cè)量得出的總時(shí)間string hours = timespan.TotalHours.ToString("#0.00000000 "); // 總小時(shí)string minutes = timespan.TotalMinutes.ToString("#0.00000000 "); // 總分鐘string seconds = timespan.TotalSeconds.ToString("#0.00000000 "); // 總秒數(shù)string milliseconds = timespan.TotalMilliseconds.ToString("#0.00000000 "); // 總毫秒數(shù)Console.Write("運(yùn)行時(shí)間 "+timespan);}}} }主函數(shù),性能測(cè)試 功能代碼三、基本功能與擴(kuò)展功能的測(cè)試:
1.數(shù)字、單詞、標(biāo)點(diǎn)符號(hào)測(cè)試正常
?
?
?
?
?
2.運(yùn)算符、空行測(cè)試,發(fā)現(xiàn)空行算作了一個(gè)單詞
?
擴(kuò)展功能,測(cè)試正常
四、性能測(cè)試
??
通過顯示后臺(tái)運(yùn)行時(shí)間發(fā)現(xiàn)單一命令的執(zhí)行逐漸加快 ,三條命令同時(shí)執(zhí)行的時(shí)間也遠(yuǎn)小于分別執(zhí)行的時(shí)間相加。于是在命令執(zhí)行的基礎(chǔ)上加上文本的輸出,發(fā)現(xiàn)文本寫入用時(shí)最多。
?
再經(jīng)過兩次測(cè)試發(fā)現(xiàn)程序有后臺(tái)存儲(chǔ)功能,記錄了運(yùn)行的信息,第二次運(yùn)行時(shí)讀取了運(yùn)行過的結(jié)果,所以時(shí)間加快了很多。
?
4.總結(jié)
(1)代碼合并階段:以前并沒有將兩個(gè)人的代碼和在一起,這次發(fā)現(xiàn)函數(shù)命名沒有一致,需要修改,其實(shí)應(yīng)該先確定函數(shù)命名再開始編碼。
(2)體會(huì)和感想:高級(jí)功能沒有實(shí)現(xiàn),在時(shí)間上還是倉促了。這次合作沒有很好的計(jì)劃,浪費(fèi)了很多時(shí)間,這次的經(jīng)驗(yàn)使得下次有了更多的準(zhǔn)備。
轉(zhuǎn)載于:https://www.cnblogs.com/K-wang/p/9827533.html
總結(jié)
以上是生活随笔為你收集整理的word count(小组)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CryptoZombies学习笔记——L
- 下一篇: node.js 调试 eggs lau