现代源代码管理工具——重点描述TFS
作者:互联网
视频原话:
As a developer on your team,you write code to address tasks that are signed to you.Of course you build frequently and checked all your units passed.And at any point you can use visual studio's pending changes features to review exactly what changes you've made.You're almost ready to check in your code, but your team uses Code Reviews to improve code quality.With Visual Studios Code Review feature,you can request and perform code reviews without ever leaving the IDE.Within the Code Review page, you can add one or more of your team members as reviewers, it often helps to have someone make sure that the code you've written does what it's supposed to do and that it does it efficiently.It's also great to have a second set of eyes to look for problems that are difficult to see when you've been looking at the same code for too long. You can increasing transparency by choosing meaningful titles and by adding descriptions to your code reviewer quests.Tell your reviewers a little bit of about what you are asking them to look at.In some cases,you might provide a brief explanation of a feature you have permitted or how you fixed about it.When you submit your review quest,your code doesn't even have to be checked in.It can be active in your workspace,or it could be suspended.You can configure team foundation server to notify reviewers by e-mail so they know right away that they have a code review waiting for them,even if they aren't runnning Visual Studio for currently logged into TFS.
In addition to the e-mail,each viewer will see the request appear in their own My Work page where they have the option to decline the requests or they can accept.To provide a thorough review,they will likely want to see a side-by-side comparison of the changes that you've made.Visual Studio also supports Inline, Left-Only and Right-Only views to compare files.Reviewers can add comments to a specific block of code or make a comment about a specific file.Or they can send an overall comment that applies for the review as a whole.When you complete a review,it just takes a single button click to send all those comments to TFS,where they could be shared with the rest of your team.Another reviewer may choose to comment on your comments.In other words,a team can engage in a dialogue about a new feature or bug fix and all the comments are stored right alongside the relevant code.Each reviewer indicates when they are finished with their view and of course this information gets recorded in Team Foundation Server.At all times,the original requester can view the current status of the review.They know which reviewers have accepted or declined and they can participate in the discussion surrounding the changes made.
The Code Review feature in Visual Studio 2021 helps you to collaborate with your team to improve code quality and get valuable feedback,all from within Visual Studio.
为什么要进行code review?
代码审查是保证代码质量的重要手段。软件缺陷可能隐藏在各个地方,测试是发现缺陷的重要方法,但专业的测试人员更多的可能是黑盒测试,他们不去关注代码内部的逻辑,只去关注代码实现的功能,有人说测试代码中的逻辑需要开发人员进行单元测试,一方面,单元测试覆盖率基本上不可能达到100%,另一方面,毕竟是单元测试,测试场景简单,有些复杂的场景有可能会测不到。各种测试完成后,如果还有缺陷,那只能让客户充当我们的“终极测试”了。抱怨会接踵而来,客户满意度会越来越低。所以,我们要想出一切可以使用的方法来进一步提高代码质量的方法,还有代码审查么,测试发现不了的问题,通过代码审查也许你能够发现。
代码审查是熟悉软件架构,了解软件业务逻辑的好方法。学习代码是需要切入点的,一个上百万行代码的系统,从哪里开始着手,只能一个模块一个模块,一个组件一个组件的来熟悉,掌握。实现一个比较大的功能,你应该不会是唯一的开发人员,从系统架构师输出的系统设计,然后到各个团队中技术Lead输出的component级别的设计,到开始实现时,应该会把功能分为不同的模块有不同的开发人员协同实现。这是个学习的机会,不要只局限于自己这部分,为了了解这个大的功能,甚至和这个功能相关的其他已经实现的功能,你同样需要关注其他人的工作。有目的的看代码和漫无目的的浏览效果是不一样的,你已经对新功能有所了解,审查代码之前,你认为代码会怎么写,别人哪里和你想的不一样,旧功能和新功能是如何相互影响的等等,心里怀着问题,你的学习速度会更快,记得更加深刻。
代码审查是你提高自己的好方法。前提是team中有经验丰富的开发人员的存在。也就是大牛,不要错过让他看你代码的机会,不要害怕他会为你写的代码挑出一大堆问题,有人说你自己写的代码就像自己的孩子,见不得别人说半点不字,不要固执,要内心平静的,客观的去看待你所写的代码,发现并解决问题才能提高你自己。也不要错过去review大牛代码的机会,看看大牛写出来的代码是怎样的,你可以取其精华。
选择TFS进行code review的好处:
无缝结合VS,两者结合紧密进行项目管理非常方便,从需求分析、开发、测试、维护,几乎可以贯穿软件开发的整个生命周期。TFS是一个应用程序生命周期管理解决方案,SVN和Git仅是源代码控制。TFS能进行源代码控制以及问题跟踪,文档管理,报告,持续集成,用于测试的虚拟实验室等。TFS的Source Control和SVN是集中式源代码控制,Git是分布式的。
标签:code,代码,team,管理工具,they,review,源代码,your,TFS 来源: https://www.cnblogs.com/zjw1980/p/14829434.html