我有2个功能(有时,在不同的类或甚至不同的文件中) 他们中的一部分必须彼此协调工作(#A和#B)。
void generateBox(BoxStruct& boxStruct){
Vector3 coor=boxStruct.getWorldCoor(); //#A
//... some complex thing ...
}
void generateWorld(WorldStruct& worldStruct){
Vector3 coor=worldStruct.calWorldCoor(); //#B
//... some complex thing ...
}
代码没问题,但我担心它的可维护性 如果我编辑#A,我也应该编辑#B。
如果Visual Studio是一个图形工具,我想在两部分代码之间画一条红线。
问题: -
如何添加提醒/工具提示/评论,它可以描述干净且引人注目的代码之间的连接?
对于我编写过的每种编程语言,我都面临着这个轻量级的问题。
对于Visual Studio,我不介意插件,但我认为没有必要。
我的解决方案很糟糕:
很脏。
void generateBox(BoxStruct& boxStruct){
Vector3 coor=boxStruct.getWorldCoor(); //It is not local coordinate. #A
//^ Must be consistent with #B in "generateWorld"
//... some complex thing ...
}
void generateWorld(WorldStruct& worldStruct){
Vector3 coor=worldStruct.calWorldCoor(); //It is not local coordinate. #B
//^ Must be consistent with #A in "generateBox"
//... some complex thing ...
}