Northern oo job fourth units Summary

1. This architecture means summary job twice  

  Before I wrap my hands began to design, I saw the other students in the class have been submitted to the group's blog, can not help but shame, I was really lazy. Most of the other students used to create a new class to store specific information for each UMLelemet elements (of course, this class may be in the form structures, map and so on, but the core idea broadly consistent). In the design of this class, most students have encountered difficulties, spent a lot of time and energy.

  Here I am speaking about, my first architecture job:

  In the beginning, I see the method description, consider how to implement the method, when surprised by the data type of the object UMLelemet can carry out the operation! As a result, the problem seems to become very simple and very simple ah. When filling getClassCount method, I just need to count, elments array, getElementType UML_CLASS equal to the number of elements to get ah. The remaining question, one by one I call the function, but also solve ah, perfect! good job! I was too naive, but when I need to achieve when getClassAssociatedClassList way, I ignorant, we can call the method in the elements, do not seem to realize this demand ah.

  After a while scratching your head, I think the first unit operation! He began the long journey of regular expressions. Everything seems orderly conduct, when here, my ideas and also, like most of the students, the regular division I put it out alone save up to read the time, to build their own data processing classes, to refine the data analysis. However, the new storm appeared! After I toString method UMLelement call, found the situation \\ converted into \ will appear, this time, I carved out the ID value, and call UMLelement ID value obtained by the method of access (damn escape characters will appear ). After careful analysis, I think this method is too cumbersome to implement, do not fly too.

  People look for him thousands of Baidu, when I look back, that person is in the dim lights. UMLelement of to'Json approach appeals to me, I looked to understand the Json method, find, Json method in accordance with a class of storage objects, methods, our UMLelement given, in fact, part of the Json. Any type of an object UMLelement, we just iterate his Json, you can get all the information entered, the escape character appeared toString problem does not occur, do not need to split the string itself. After all, oo instructions java every time, there will be such words. Do not re-create the wheel!

  I used the method iter (self-built method) returns a String of ArrayList, the method is implemented, the current iteration UMLelement type of object each element, and stored in the ArrayList so that every time just call iter method, you you can access all of the attributes of the object.

  In addition, for the realization of each method, I have adopted the method to design a method for Help, call the Help method in which, as this time in dealing with inheritance (cycle to find the parent class), will be out of their simplicity. In addition also helps to look at the logical level within a method, for facilitating logic verification, validation and finely divided form.

  Next, I want to talk about architecture a second job.

  The second basic inherited design work first job, in addition to the introduction of the following mechanisms:

  1. I designed for each type of data hashmap, used to store the corresponding data in order to quickly find, because, in my opinion, first job, find elements of time without excessive cost due to the cycle, is endure, and in the second operation, the cost began to increase. Measures must be taken to reduce this time cost.

  2. Use of two specific algorithm to achieve 008, 009 dfs two inspection rules.

  3. Add the searchById and eleSearchById, by id, to quickly get the class name of the element, and quickly locate elements by id, which is to reduce the time of rising costs.

  Here I enclose my class diagrams, but because I was the first class to create an object in the class work in the second to achieve not very intuitive relationship between code, category and class shown.

  FIG first job class:

 

  The second job class diagram:  

 

 2. I evolved in four oo architectural design units and 00 methods of understanding

  First of all, I want to explain, because the job if the class diagram shows four units, would be too long and that is not enough refining, so I choose not to 11 shows a class diagram.

  1. The first unit:

  The first job, at this time oo basis, only a small winter to complete the exercise (at that time only a preliminary study of the java syntax). So my first job of the first unit, a main function of a design in the end, when also the number of lines of code just not to the 500, there is no limit to reach the number of lines of code complacent.

  The second time job, due to the mutual test roommate students can view the code on the basis of my first jobs on, we made some improvements, such as regular hand-violence is not matching the line and a line of regular expression thirty-four . Instead, the regular expression constituted by the entry factor, the reconstruction of the regular expression items. Here I've got the idea of ​​object-oriented ideas.

  To the third operation, this time the regular expression has been unable to meet demand, and need a recursive loop to solve the problem, in my judgment the legality enter the code, the object-oriented thinking I further consolidate, in my recursive descent I have a function in accordance with the object-oriented ideas to complete, namely polynomial, broken down into items, items broken down into factors.

  In short, the color architecture of this unit, or with a very strong c-oriented process. From the first to write a full-fledged operation of thinking java to c second job, the expression construct embodied in the object-oriented thinking positive, then later throughout all object-oriented. This unit, my best part of the program is that the program has object-oriented thinking, but even so, I'm still part of the body rather than dismantling the object-oriented process-oriented.

  2. The second unit:

  The first job, this job is not high on the coding complexity, the number of my four classes add up to less than 150 lines of row. The jobs are not familiar with wait and notify operation, I used violence polling way, I set up the framework. In fact, the completion of this work also can be taken for procedural structure (FCFS single-threaded construction elevator can be easy to get), but in order to understand and make use of the object-oriented thinking, and cell-based job twice bedding, I use object-oriented thinking, the establishment of an elevator class, a controller class, and command input type (control panel), I design and mainstream design difference is that my controller, not a thread class, he just a container class, based on their own command input to command the container into the elevator type, self-read command starts running. Implement the entire program has been the object-oriented way.

  第二次作业,电梯数目不变,变化的是对调度算法有了要求,简单的FCFS算法不能再满足此次的要求,此外,对于cpu时间也加以限制,使得暴力轮询的方法不再适用。我的改动一是针对暴力轮询,二是针对电梯类,在电梯类中,加入了判断方向等此次作业需要的方法,三是针对控制器类,这次为了更符合他的功能,我将控制器类重命名为存储类,并添加了此次作业需要的方法。该次作业,对象构造更加完善,对象之间的联系也更加紧密。

  第三次作业,有三架电梯,且运行的楼层不一致。架构上,一是改动了电梯类的设置,使得可以使不同电梯可以停靠不同 的楼层,二是将电梯类和存储类一起改动,使得可以使电梯互斥地运送乘客,并完成换乘。本次程序实现,由于前两次代码设计合理,更改时间并不长,很快就完成了程序。而此次的程序,我觉得较好地体现了面向对象的思想。

  总之,本单元的程序设计,难度大,但收获也足,本单元的程序设计完成后,我对面向对象的思想有了较为全面的理解。这一单元的几次作业,也都有着不错的面向对象的结构。

  第三单元:

  第一次作业,本次作业,我选择了维护大量的hashmap来进行快速查找,对于一个path,以他的id和path分别作为key,value进行两次存储,存储的成本不高,查找的成本也较低。只是面向对象的思想并没有过多的体现。

  第二次作业,本次作业,设计到较少数量的点却会在较大数量的区域出现,如果直接使用邻接矩阵存储,第一空间不足,第二在进行图的相关操作时,会原地爆炸,螺旋升天。我使用了映射法,即用一个ArrayList存储映射关系,然后直接用映射值代入运算。至于其他设计,与第一次作业大体相同,运用了大量的双休hashmap缩短查找时间。同样的,我认为此次作业中面向对象的思想也没有过多体现,可能在第二次作业继承第一次作业的时候体现了吧。

  第三次作业,本次作业与第二次作业一样,可以通过Floyd算法来解决,但需要对Floyd算法进行一些特异性的处理,我设立了一个Floyd模板类,模板类里融合了四种Floyd算法的特异性处理。在存储图的时候,也会根据不同查询的需要来存储多个图。这一次作业中,我的模板类的设计,倒是部分体现了面向对象的思想。

  总之,本单元的程序设计,与第二单元相比,难度有所降低,让人喘了口气,但难度也不算过低,也巩固了我的数据结构方面的知识,我自认为我的设计在时间上处理还算成功,这一单元的作业,测试表现都较佳。但是,在面向对象思想上,我觉得本单元作业的考察方式就像是填空题,而不是解答题,我们不是整体的设计,而只是小打小闹,面向对象的思想并没有能展现出他的优势,事实上,在本单元的程序设计中,我也并没有使用面向对象的思想去完成整个设计。

  第四单元:

  第一次作业,架构设计上,在一个类里完成了所有的实现(现在想想,其实没必要把代码写的这么臃肿,完全可以拆分开来),面向对象的思想也并没有多少的体现。

  第二次作业,我就是我,是颜色不一样的hashmap,受到第三单元的启发,我再再再一次使用了大量的双向hashmap来加快查找速度,此外,我还设立了多个help类,用来辅助查找,每个分别负责查询状态机,顺序图,类图等等。这一次的设计,我运用了面向对象的思想,将输入UML图拆分成类图,顺序图等,分别构造处理逻辑解决。

  总之,本单元的程序设计,作为最后一个单元,在我看来偏离了面向对象这四个字,换言之,这一单元就是UML元素语法了解单元,而不能看作训练面向对象思想的一个单元。我的绝大部分时间,花在了思考,欸,这个方法怎么实现啊,我要去找那个type的数据,然后去看哪个id啊,UML图能这样画么,这样的数据是满足条件的么这些问题上,而不是花在怎么面向对象的设计代码层次。即使第二次作业,我的面向对象设计比较充足。那也是因为考期过于清闲,有充足的时间精益求精,锦上添花。没错这一单元里,面向对象思想只是锦上添花的思想,绝非雪中送炭的必需思想。

3.四个单元中测试的理解和实践的演进

  这一部分,我倒是要改一改前面几部分的习惯,将总结的话放在前面了(莫名其妙的逻辑感)。在四个单元的测试中,我的整体变化是这样的,测试部分越来越偏向于逻辑验证,即坐在电脑前安安静静地一行一行地看代码,用脑子生想bug在哪里啊,bug在哪里,bug就在眼前的代码里。也越来越偏向于对照测试,即与同学的程序一起跑一段测试样例,然后比照结果。大一时,写出个程序,随手造一段强度极低的数据测试就完事的时代已经测试了,这是我在测试上最大的进步。下面,我将逐个单元的具体分析:

  第一单元的时候,什么测试经验都没有,就是代入数据,如果对了,哦耶,好棒,错了,就回头改。事实上,这种测试方法只适用于通过中测,强测会挂的程序是很难靠这种程度的测试测出来的。

  到了第二单元,我学会了一项重要的测试技巧!边界测试。第二单元的测试我采取的形势验证与重点验证相结合。即重点测试每次作业中易错点或新添加部分,其余部分采取形势验证。这样的测试方法在前两次测试很成功。第三次测试中,我沿用了该方法,只重点检查了换乘部分。却发现由于乘客数量的变化。我的程序,需要改变两个常量的值,否则会出现边界的错误。强侧因为这个直接没进互测,总共就4个字符的改动啊!至今都觉得很气,从此,我必做边界测试。

  到了第三单元,我开始部署自动化测试,因为我是一个不push就不会动的人,第三单元的测试已经不是手动输入能够实现的了。此外第三单元,我也开始了大范围的对照实验,制作测试样例,与同学分享,测试程序。最后,第三单元我还学会了Junit等骚套路,虽然在检验过程中,Junit连锦上添花都算不上,粗俗地说,纯属脱裤子放屁,多此一举。

  最后的第四单元,这单元,我对测试的理解也大致成型,就是对照测试和逻辑测试。针对第四单元做的特异性测试则是使用starUml构造图,通过jar包导出成数据,然后进行测试。考虑测试手段的话,通过郭同学分享的GUI工具,我的测试自动化程度更上一层楼。

4.我的课程收获

  最初,佳处径须携杖去,能消几緉平生屐。

  之后,楼观才成人已去,旌旗未卷头先白。叹人间、哀乐转相寻,今犹昔。

  当一切尘埃落定,回顾此中点点,平生塞北江南。归来华发苍颜。布被秋宵梦觉,眼前万里江山。

  最开始真的是一股少年英气,充满自信开始了课程的学习,奈何终不是那芝兰玉树,戈戟云横,头铁撞的头破血流,感叹oo痛苦,每一个周末,都更想放弃,觉得就这样躺在地上也未尝不可呢。在学期末回顾,这一路的确累,的确不轻松,但眼前也有了那万里江山。

  现在,我有了面向对象的思维,这样的思维不仅帮助我有效地处理复杂问题,在我的c++课程的学习中,作用极大,也为以后的工程生涯打下了一定基础,毕竟,要恰饭的嘛。

  此外,面向对象的课程对心理也是极大的磨炼,在多项式第三次作业的时候,我的压力值到达了顶峰,周二的ddl,我到周一才找到正确的路径,这次的作业我的总时长接近20个小时,是心理生理的双重煎熬,以前,有过熬夜完成剪辑任务的时刻,可这压力终是比不上面向对象的压力。视频剪不出来,咕咕咕也不是不行,而一次oo作业(尤其是第一单元的第三次作业,后面还有八九次鬼知道是不是比他难得多的作业)即将零分的压力是真的迫人。

  最后,面向对象课程也提升了我的测试能力,让我学会了怎么使用git和gitlab方便地进行版本管理,怎么巧妙使用各类插件,怎么提升代码风格,写出规范的代码,这些看起来并不起眼,但我确实受益良多。

5.三个改进建议

  1.好玩的任务

  不知道潜水的助教有没有关注到这样一个现象,在写电梯的时候,群里大多洋溢着轻松愉快的气氛,不同于写第三单元时群里的沉闷,和写多项式时群里压抑着的怨气。为什么呢?好玩啊,大一专业分流,我身边不少人选择六系就是因为对编程有兴趣,这是一件乐事,学着开心就来到了六系。然而,大一的计组让不少人丢失了这份乐趣,电梯作业时又找回了这份乐趣,那段时间的码代码真的是蛮欢乐的,希望给以后的学弟学妹多安排一些像电梯这样的任务。

  2.在互测屋内增加点赞功能

  很多同学都反馈,希望能看到优秀同学的代码,但是。。。助教的反馈其实蛮迟的。这完全可以理解,毕竟助教也有自己繁重的学业任务,要从学院的数百份代码中挑选出优秀的代码分享给同学们是很费时间的一件事。但是,把这件事分配给同学们完成助教们就会轻松很多。就我而言,当我侥幸进入A屋时,同屋的大佬写的代码经常让我惊为天人,漂亮的架构,漂亮的嵌套,忍不住看了又看,只是可惜不能分享给全部同学。可以在互测屋内增加点赞功能,只要点赞数不可见,应该也不影响什么公平性,而助教只需要对点赞数高的代码进行人工审查,就可以选出优秀的代码分享给同学。

  3.精益求精

  例如指导书,可以写的更详细一点,课程安排也可以更合理一点(理论课紧接着实验课总觉得太赶),这样的小细节,如果再进步一些,下一届同学的oo体验会更好。

2019-06-23 21:31:16

 

Guess you like

Origin www.cnblogs.com/xijiezhen/p/11072976.html