其他分享
首页 > 其他分享> > OO第四单元总结 & 课程总结

OO第四单元总结 & 课程总结

作者:互联网

2022北航OO第四单元总结暨课程总结

第四单元架构设计

本单元在理解UML图的基础上,实现对UML类图、顺序图和时序图的解析、指令查询和模型有效性检查。

实现思路

大致思路是先对UML模型进行解析,再实现指令查询的方法。

架构图

classDiagram class MyClass MyClass: -UmlClass umlClass MyClass: -MyClass superClass MyClass: -HashMap<String, UmlAttribute> id2attributes MyClass: -HashMap<String, MyOperation> id2operations MyClass: -HashMap<String, MyClass> childClasses MyClass: -HashMapHashMap<String, MyInterface> implementsInterfaces MyClass: +addAttribute(UmlAttribute attribute)void MyClass: +addOperation(MyOperation operation)void MyClass: +addChildClass(MyClass myClass)void MyClass: +addImplementsInterface(MyInterface myInterface)void MyClass: +getSubClassCount()int MyClass: +getOperationCount()int MyClass: +getOperationVisibility(String methodName)HashMap MyClass: +getAttributeCouplingDegree(MyClass myClass, ArrayList<String> hasChecked)int MyClass: +getOperationCouplingDegree(String methodName, MyClass myClass)List MyClass: +operationWrongType(String methodName)boolean MyClass: +operationDuplicate(String methodName)boolean MyClass: +sameParaList(HashMap<String, Integer> list1, HashMap<String, Integer> list2)boolean MyClass: +getImplementInterfaceList(HashMap<String, String> interfaceList)void MyClass: +getDepthOfInheritance(int depth)int class MyInterface MyInterface: -UmlInterface umlInterface MyInterface: -HashMap<String, MyInterface> superInterface MyInterface: -HashMap<String, UmlAttribute> id2attributes MyInterface: -HashMap<String, MyInterface> childInterfaces MyInterface: -HashMap<String, MyClass> implementsClasses MyInterface: +addAttribute(UmlAttribute attribute)void MyInterface: +addSuperInterface(MyInterface myInterface)void MyInterface: +addChildInterface(MyInterface myInterface)void MyInterface: +addImplementsClasses(MyClass myClass)void MyInterface: +getFatherInterfaces(HashMap<String, String> interfaceList)void class MyOperation MyOperation: -UmlOperation umlOperation MyOperation: -HashMap<String, UmlParameter> id2parameters MyOperation: +addParameter(UmlParameter umlParameter)void class UmlAttribute class UmlParameter MyClass*--MyOperation MyInterface*--MyOperation MyInterface*--UmlAttribute MyClass*--UmlAttribute MyOperation*--UmlParameter MyClass--MyInterface classDiagram class MyInteraction MyInteraction: -UmlInteraction umlInteraction MyInteraction: -HashMap<String, MyLifeline> id2lifeline MyInteraction: -HashMap<String, MyEndpoint> id2endpoint MyInteraction: +addLifeline(MyLifeline myLifeline)void MyInteraction: +addEndpoint(MyEndpoint myEndpoint)void MyInteraction: +getParticipantCount()int MyInteraction: +lifelineNotFound(String lifelineName)boolean MyInteraction: +duplicateLifeline(String lifelineName)boolean MyInteraction: +neverCreate(String lifelineName)boolean MyInteraction: +duplicateCreate(String lifelineName)boolean MyInteraction: +getParticipantLostAndFound(String lifelineName)Pair MyInteraction: +getParticipantCreator(String lifelineName)UmlLifeline class MyLifeline MyLifeline: -UmlLifeline umlLifeline MyLifeline: -HashMap<String, MyMessage> sendMessage MyLifeline: -HashMap<String, MyMessage> receiveMessage MyLifeline: +addMessageSource(MyMessage myMessage)void MyLifeline: +addMessageTarget(MyMessage myMessage)void class MyMessage MyMessage: -UmlMessage umlMessage MyMessage: -MyLifeline sourceLifeline MyMessage: -MyLifeline targetLifeline MyMessage: -MyEndpoint sourceEndpoint MyMessage: -MyEndpoint targetEndpoint class MyEndpoint MyEndpoint: -UmlEndpoint umlEndpoint MyEndpoint: -HashMap<String, MyMessage> sendMessage MyEndpoint: -HashMap<String, MyMessage> receiveMessage MyEndpoint: +addMessageSource(MyMessage myMessage)void MyEndpoint: +addMessageTarget(MyMessage myMessage)void MyInteraction*--MyLifeline MyInteraction*--MyEndpoint MyLifeline*--MyMessage MyEndpoint*--MyMessage classDiagram class MyStateMachine MyStateMachine: -UmlStateMachine umlStateMachine MyStateMachine: -MyRegion region MyStateMachine: +addRegion(MyRegion region)void class MyRegion MyRegion: -UmlRegion umlRegion MyRegion: -HashMap<String, MyState> id2states MyRegion: -MyInitialState initialSate MyRegion: -HashMap<String, MyFinalState> id2finalStates MyRegion: -HashMap<String, MyTransition> id2transitions MyRegion: +addState(MyState myState)void MyRegion: +setInitialSate(MyInitialState initialSate)void MyRegion: +addFinalState(MyFinalState myFinalState)void MyRegion: +addTransition(MyTransition myTransition)void MyRegion: +isState(String id)boolean MyRegion: +isInitialState(String id)boolean MyRegion: +isFinalState(String id)boolean MyRegion: +findRoot(String id)ArrayList MyRegion: +findTmpRoot(String id)ArrayList MyRegion: +addRoots(String sourceId, String targetId)void MyRegion: +addTmpRoots(String sourceId, String targetId)void MyRegion: +getStateCount()int MyRegion: +stateNotFound(String stateName)boolean MyRegion: +duplicateState(String stateName)boolean MyRegion: +noTransition(String sourceName, String targetName)boolean MyRegion: +getTransitionTrigger(String sourceName, String targetName)List MyRegion: +isAllCircle()boolean MyRegion: +getStateIsCriticalPoint(String stateName)boolean class MyTransition MyTransition: -UmlTransition umlTransition MyTransition: -ArrayList<UmlEvent> events MyTransition: +addEvent(UmlEvent umlEvent)void class UmlEvent class MyInitialState MyInitialState: -UmlPseudostate umlPseudostate class MyFinalState MyFinalState: -UmlFinalState umlFinalState MyFinalState: -ArrayList<String> rootsId MyFinalState: -ArrayList<String> tmpRootsId MyFinalState: +addRoot(String newRootId)void MyFinalState: +addTmpRoot(String newRootId)void MyFinalState: +clearTmpRootsId()void class MyState MyState: -UmlState umlState MyState: -ArrayList<String> rootsId MyState: -ArrayList<String> tmpRootsId MyState: +addRoot(String newRootId)void MyState: +addTmpRoot(String newRootId)void MyState: +clearTmpRootsId()void MyStateMachine*--MyRegion MyRegion*--MyTransition MyRegion*--MyInitialState MyRegion*--MyState MyRegion*--MyFinalState MyTransition*--UmlEvent

架构设计思维及OO方法理解的演进

测试理解与实践的演进

​ 测试是OO课程中很重要的一部分,是保证代码正确性的必要步骤。第一单元中几乎没有什么测试的观念,只是简单的构造几组数据,后来通过强测逐渐了解到课下自行测试的重要性,通过手动构造一些边界数据进行测试。第二单元多线程的不确定性导致测试有很大难度,主要都是针对可能出现的轮询进行测试。第三单元指令数据量较大且实现起来的细节很多,一粗心就容易出现问题,还很不好发现,通过和同学对拍可以快速的找出一些隐藏的问题。第四单元可以直接在StarUML中进行数据构造,主要针对每条指令一一进行测试,尤其是实现较复杂的指令是否会出现问题。

课程收获

三个具体改进建议

标签:总结,OO,String,void,课程,MyClass,MyRegion,单元,HashMap
来源: https://www.cnblogs.com/Realgyyyyy/p/16416002.html