코드 리뷰
Code review시리즈의 일부 |
소프트웨어 개발 |
---|
코드 리뷰(피어 리뷰라고도 함)는 소프트웨어 품질 보증 액티비티로, 1명 또는 여러 사람이 주로 소스 코드의 일부를 보고 읽음으로써 프로그램을 체크하고, 구현 후 또는 구현 중단으로 이를 수행합니다.적어도 한 사람이 코드 작성자가 아니어야 합니다.작성자를 제외한 확인을 수행하는 사람을 "검토자"[1][2]라고 합니다.
품질 문제의 직접적인 발견이 주된 [3]목표인 경우가 많지만, 일반적으로 코드 리뷰는 다음과 같은 목표를 [4][5]조합하여 수행합니다.
- 코드 품질 향상 – 내부 코드 품질 및 유지보수성 향상(가독성, 균일성, 이해성 등)
- 결함 발견 – 외부 측면, 특히 정확성에 대한 품질 향상과 더불어 성능 문제, 보안 취약성, 주입된 멀웨어 등을 발견합니다.
- 학습/지식의 이전– 코드베이스, 솔루션 접근법, 품질에 대한 기대 등에 관한 지식을 리뷰어와 작성자에게 전달하는 데 도움이 됩니다.
- 상호 책임 의식 강화 – 코드 소유 의식과 연대 의식 강화
- 더 나은 솔루션 찾기– 새롭고 더 나은 솔루션과 특정 코드를 뛰어넘는 아이디어를 생성합니다.
- QA 가이드라인, ISO/IEC 표준 준수– 항공 교통 소프트웨어, 안전에 중요한 소프트웨어 등 일부 상황에서 코드 검토가 필수입니다.
전술한 코드 리뷰의 정의는 인접하지만 별개의 소프트웨어 품질 보증 기술에 대해 코드 리뷰를 제한합니다.스태틱 코드 해석에서는 메인 체크는 자동화 프로그램에 의해 실행되며, 자기 체크에서는 작성자만 코드를 체크하고, 코드 실행을 테스트하는 것은 필수적인 부분이며, 페어 프로그래밍은 별도의 [1]스텝이 아닌 구현 중에 연속적으로 실행된다.
확인 유형
코드 리뷰 프로세스에는 다양한 종류가 있으며, 그 중 일부는 아래에 자세히 설명되어 있습니다.추가 리뷰 유형은 IEEE 1028의 일부입니다.
IEEE 1028-2008 에는, 다음의 확인 [6]타입이 리스트 되어 있습니다.
- 관리 리뷰
- 기술 리뷰
- 검사
- 워크스루
- 감사
검사(공식)
역사적으로 처음으로 상세하게 연구되고 기술된 코드 검토 과정을 마이클 페이건이 "[7]검사"라고 불렀습니다.이 Fagan 검사는 여러 참가자와 여러 단계에 걸쳐 신중하고 상세한 실행을 수반하는 정식 프로세스입니다.정식 코드 리뷰는 소프트웨어 개발자가 일련의 회의에 참석하여 일반적으로 자료의 인쇄본을 사용하여 코드를 한 줄씩 리뷰하는 전통적인 리뷰 방법입니다.공식 검사는 매우 철저하며 [7]검토 중인 코드의 결함을 발견하는 데 효과적이라는 것이 입증되었습니다.
정기적인 변경 기반 코드 리뷰(실사)
최근 업계의 많은 [when?]팀이 보다 가벼운 유형의 코드 [8][3]리뷰를 도입하고 있습니다.주요 특징은 각 리뷰의 범위가 티켓, 사용자 스토리, 커밋 또는 기타 작업 단위로 수행된 코드베이스의 변경에 기초한다는 것이다.또한, 각 검토를 명시적으로 계획하는 대신 검토 작업을 개발 프로세스에 포함시키는 규칙이나 규약이 있다(예: "모든 티켓을 검토해야 한다").이러한 검토 프로세스를 "정기적인 변경 기반 코드 검토"[1]라고 합니다.이 기본 프로세스에는 많은 변형이 있습니다.2017년부터 240개 개발팀을 대상으로 한 설문조사에 따르면 90%의 팀이 변경(검토를 사용하는 경우)을 기반으로 한 검토 프로세스를 사용하고 60%가 정기적인 변경 기반 코드 [3]검토를 사용하고 있는 것으로 나타났습니다.또한 Microsoft,[9] Google [10]및 Facebook과 같은 대부분의 대규모 소프트웨어 회사는 변경 기반 코드 검토 프로세스를 따릅니다.
리뷰의 효율성과 효과
Capers Jones는 12,000개 이상의 소프트웨어 개발 프로젝트를 지속적으로 분석한 결과, 공식 검사에서 잠재적인 결함 발견률이 60~65%에 이르는 것으로 나타났습니다.비공식 검사의 경우 이 수치는 50% 미만입니다.대부분의 테스트 형태에서 잠재적 결함 발견률은 약 30%[11][12]입니다.Best Keeped Secrets of Peer Code Review라는 책에 실린 코드 리뷰 사례 연구에 따르면 가벼운 리뷰는 정식 리뷰만큼 많은 버그를 발견할 수 있지만 케이퍼스[11] 존스가 수행한 연구와 달리 더 빠르고 비용[13] 효율적입니다.
코드 리뷰에서 검출된 결함의 종류도 연구되고 있습니다.경험적 연구에 따르면 코드 리뷰 결함의 최대 75%가 [14][15][4][16]기능성보다는 소프트웨어의 진화 가능성/유지 가능성에 영향을 미친다는 증거가 제공되어 코드 리뷰는 제품 또는 시스템의 라이프 사이클이 [17]긴 소프트웨어 회사에 훌륭한 도구가 되었습니다.이는 코드 리뷰에서 논의된 문제의 15% 미만이 [18]버그와 관련된 것임을 의미합니다.
가이드라인
코드 검토의 효과는 검토 속도에 따라 달라지는 것으로 나타났다.코드 리뷰 레이트는 [19][20][21][22]시간당 200~400줄의 코드여야 합니다.중요 소프트웨어(안전성에 중요한 임베디드 소프트웨어 등)에 대해 시간당 수백 줄 이상의 코드를 검사 및 검토하는 것은 오류를 [19][23]발견하는 데 너무 빠를 수 있습니다.
지원 도구
정적 코드 분석 소프트웨어는 소스 코드에서 알려진 취약성 및 결함 [24]유형을 체계적으로 검사하여 개발자의 대규모 코드 청크를 검토하는 작업을 줄입니다.VDC Research의 2012년 조사에 따르면 조사 대상 임베디드 소프트웨어 엔지니어의 17.6%가 현재 피어 코드 리뷰를 지원하기 위해 자동화 도구를 사용하고 있으며 23.7%가 2년 [25]이내에 사용할 것으로 예상하고 있습니다.
「 」를 참조해 주세요.
외부 링크
- Five Code Review Antiatterns (Java Magazine, Best of 2020)
레퍼런스
- ^ a b c Baum, Tobias; Liskin, Olga; Niklas, Kai; Schneider, Kurt (2016). "A Faceted Classification Scheme for Change-Based Industrial Code Review Processes". 2016 IEEE International Conference on Software Quality, Reliability and Security (QRS). pp. 74–85. doi:10.1109/QRS.2016.19. ISBN 978-1-5090-4127-5. S2CID 9569007.
- ^ Kolawa, Adam; Huizinga, Dorota (2007). Automated Defect Prevention: Best Practices in Software Management. Wiley-IEEE Computer Society Press. p. 260. ISBN 978-0-470-04212-0.
- ^ a b c Baum, Tobias; Leßmann, Hendrik; Schneider, Kurt (2017). The Choice of Code Review Process: A Survey on the State of the Practice. Product-Focused Software Process Improvement: 18th International Conference, PROFES 2017, Proceedings. Lecture Notes in Computer Science. Vol. 10611. pp. 111–127. doi:10.1007/978-3-319-69926-4_9. ISBN 978-3-319-69925-7.
- ^ a b Bacchelli, A; Bird, C (May 2013). "Expectations, outcomes, and challenges of modern code review" (PDF). Proceedings of the 35th IEEE/ACM International Conference On Software Engineering (ICSE 2013). Retrieved 2015-09-02.
- ^ Baum, Tobias; Liskin, Olga; Niklas, Kai; Schneider, Kurt (2016). "Factors Influencing Code Review Processes in Industry". Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering - FSE 2016. pp. 85–96. doi:10.1145/2950290.2950323. ISBN 9781450342186. S2CID 15467294.
- ^ "IEEE Standard for Software Reviews and Audits". doi:10.1109/ieeestd.2008.4601584.
{{cite journal}}
:Cite 저널 요구 사항journal=
(도움말) - ^ a b Fagan, Michael (1976). "Design and code inspections to reduce errors in program development". IBM Systems Journal. 15 (3): 182–211. doi:10.1147/sj.153.0182.
- ^ Rigby, Peter; Bird, Christian (2013). Convergent contemporary software peer review practices. Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering. p. 202. CiteSeerX 10.1.1.641.1046. doi:10.1145/2491411.2491444. ISBN 9781450322379. S2CID 11163811.
- ^ MacLeod, Laura; Greiler, Michaela; Storey, Margaret-Anne; Bird, Christian; Czerwonka, Jacek (2017). "Code Reviewing in the Trenches: Challenges and Best Practices" (PDF). IEEE Software. 35 (4): 34. doi:10.1109/MS.2017.265100500. S2CID 49651487. Retrieved 2020-11-28.
- ^ Sadowski, Caitlin; Söderberg, Emma; Church, Luke; Sipko, Michal; Baachelli, Alberto (2018). "Modern Code Review: A Case Study at Google". International Conference on Software Engineering, Software Engineering in Practice Track: 181. doi:10.1145/3183519.3183525. S2CID 49217999.
- ^ a b Jones, Capers (June 2008). "Measuring Defect Potentials and Defect Removal Efficiency" (PDF). Crosstalk, The Journal of Defense Software Engineering. Archived from the original (PDF) on 2012-08-06. Retrieved 2010-10-05.
- ^ Jones, Capers; Ebert, Christof (April 2009). "Embedded Software: Facts, Figures, and Future". Computer. 42 (4): 42–52. doi:10.1109/MC.2009.118. S2CID 14008049.
- ^ Jason Cohen (2006). Best Kept Secrets of Peer Code Review (Modern Approach. Practical Advice.). Smart Bear Inc. ISBN 978-1-59916-067-2.
- ^ Czerwonka, Jacek; Greiler, Michaela; Tilford, Jack (2015). "Code Reviews Do Not Find Bugs. How the Current Code Review Best Practice Slows Us Down" (PDF). ICSE '15: Proceedings of the 37th International Conference on Software Engineering. 2: 27–28. doi:10.1109/ICSE.2015.131. ISBN 978-1-4799-1934-5. S2CID 29074469. Retrieved 2020-11-28.
- ^ Mantyla, M.V.; Lassenius, C. (2009). "What Types of Defects Are Really Discovered in Code Reviews?" (PDF). IEEE Transactions on Software Engineering. 35 (3): 430–448. CiteSeerX 10.1.1.188.5757. doi:10.1109/TSE.2008.71. S2CID 17570489. Retrieved 2012-03-21.
- ^ Beller, M; Bacchelli, A; Zaidman, A; Juergens, E (May 2014). "Modern code reviews in open-source projects: which problems do they fix?" (PDF). Proceedings of the 11th Working Conference on Mining Software Repositories (MSR 2014). Retrieved 2015-09-02.
- ^ Siy, Harvey; Votta, Lawrence (2004-12-01). "Does the Modern Code Inspection Have Value?" (PDF). unomaha.edu. Archived from the original (PDF) on 2015-04-28. Retrieved 2015-02-17.
- ^ Bosu, Amiangshu; Greiler, Michaela; Bird, Chris (May 2015). "Characteristics of Useful Code Reviews: An Empirical Study at Microsoft" (PDF). 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories. Retrieved 2020-11-28.
- ^ a b Kemerer, C.F.; Paulk, M.C. (2009-04-17). "The Impact of Design and Code Reviews on Software Quality: An Empirical Study Based on PSP Data". IEEE Transactions on Software Engineering. 35 (4): 534–550. doi:10.1109/TSE.2009.27. S2CID 14432409.
- ^ "Code Review Metrics". Open Web Application Security Project. Open Web Application Security Project. Archived from the original on 2015-10-09. Retrieved 9 October 2015.
- ^ "Best Practices for Peer Code Review". Smart Bear. Smart Bear Software. Archived from the original on 2015-10-09. Retrieved 9 October 2015.
- ^ Bisant, David B. (October 1989). "A Two-Person Inspection Method to Improve Programming Productivity". IEEE Transactions on Software Engineering. 15 (10): 1294–1304. doi:10.1109/TSE.1989.559782. S2CID 14921429. Retrieved 9 October 2015.
- ^ Ganssle, Jack (February 2010). "A Guide to Code Inspections" (PDF). The Ganssle Group. Retrieved 2010-10-05.
- ^ Balachandran, Vipin (2013). "Reducing human effort and improving quality in peer code reviews using automatic static analysis and reviewer recommendation". 2013 35th International Conference on Software Engineering (ICSE). pp. 931–940. doi:10.1109/ICSE.2013.6606642. ISBN 978-1-4673-3076-3. S2CID 15823436.
- ^ VDC Research (2012-02-01). "Automated Defect Prevention for Embedded Software Quality". VDC Research. Retrieved 2012-04-10.