(评论)
(comments)
原始链接: https://news.ycombinator.com/item?id=39549486
以下是基于给定材料的一些关键要点:
1. 缓慢而有条不紊地进行,而不是立即进行重构。 在进行任何更改之前,彻底分析代码库并深入了解其工作原理。
2. 专注于建立有效的端到端测试和持续集成自动化。 捕获系统的预期行为并确保它们在实施之前和整个实施过程中持续匹配。
3. 减少需要支持的变化量,因为它显着减少了重构工作的范围和复杂性,并提高了效率、易于维护和适应不断变化的需求。
4. 尽量减少不必要的更改,因为实施更改会增加引入额外复杂性的可能性,从而加剧大型代码库固有的挑战。
5. 使用全面的端到端测试套件来评估代码更改并确保系统的功能持续满足预期。
6. 研究代码库背后的业务逻辑,并建立一个能够存储重要信息的集中存储库,从而提高透明度和问责制。
7. Start by learning to work with the specific programming language, environment, and conventions associated with the particular codebase.
幸运的是,无论使用哪种特定编程语言,这个过程都是相当通用的。 在这些工作中,与同事的有效沟通至关重要,定期提供最新信息有助于促进团队成员之间的协作,从而就持续发展达成共同愿景和协调战略。 强调表达的清晰度,包括对任何不透明的元素提供详细解释,有助于简化整个流程并有助于相互理解和理解。 通过采用一致的反馈机制(例如代码审查),可以更频繁、更深入地进行关键评估,从而减少错误并获得更好的总体结果。 建立明确的错误解决程序可确保任何已识别的问题都能得到有效、迅速的纠正,从而加快进度并提高从技术问题到更广泛的利益相关者满意度等多个方面的满意度。 最后,不断寻求增强流程的方法,通过确定应对持续挑战的创新解决方案,进一步增加正在进行的协作努力的价值,同时培养互利关系,有利于通过与其他参与互补努力的合作企业获得长期利益。
After inheriting quite a few giant C++ projects over the years, there are a few obvious big wins to start with:
* Reproducible builds. The sanity you save will be your own. Pro-tip: wrap your build environment with docker (or your favorite packager) so that your tooling and dependencies become both explicit and reproducable. The sanity you save will be your own.
* Get the code to build clean with -Wall. This is for a couple of reasons. a) You'll turn up some amount of bad code/undefined behavior/bugs this way. Fix them and make the warning go away. It's ok to #pragma away some warnings once you've determined you understand what's happening and it's "ok" in your situation. But that should be rare. b) Once the build is clean, you'll get obvious warnings when YOU do something sketchy and you can fix that shit immediately. Again, the sanity you save will be your own.
* Do some early testing with something like valgrind and investigate any read/write errors it turns up. This is an easy win from a bugfix/stability point of view.
* At least initially, keep refactorings localized. If you work on a section and learn what it's doing, it's fine to clean it up and make it better, but rearchitecting the world before you have a good grasp on what's going on globally is just asking for pain and agony.
reply