Skip to main content

Bad smell in code review

코드 리뷰 시간에 코드 owner가 수정 사항의 설명을 마치면서 자신의 수정이 완벽하지 않다며 다음과 같이 말하더군요.

하나의 클래스안에서 특정 함수를 그 클래스안의 특정 함수들만 사용하게 하고 싶다. 즉, 클래스 내부의 메소드 사이에도 private같은 것이 있으면 좋겠다.


Refactoring의 bad smell이 생각이 나더군요. 좀더 자세한 내용을 들어보니 SRP(Single Responsibility Principle)가 지켜지지 않은 클래스였습니다. (low-cohesion, high-coupling)

이 내용이 이번 코드 리뷰의 결과로 수정되지는 않았으나 refactoring listExtract Class가 적용되어야 할 경우였습니다.

제가 배운 오늘의 교훈은.

"왜 xx 기능이 내가 사용하는 언어에선 지원되지 않나?"라는 생각이 들면 먼저 설계에 문제가 없는지를 검토해 보자



입니다. :-)

--

저희가 코드 리뷰를 시작한지 몇개월 되지 않았는데 대부분의 reviewer들이 review할 코드를 읽지 않고 들어옵니다. 따라서 별로 능동적으로 참여하지 않게 되고 시간 낭비라는 생각에 코드 리뷰 시간을 싫어하죠. :-)

Wikipedia를 보니 line-by-line 코드 리뷰가 defect를 제거하는데 별로 효율적이지 않다는 말도 있네요. 하느냐 마느냐... 그것이 문제군요. :-)

부록(?)으로 Code Review Starter Kit 에 있는 내용입니다.


  1. Everyone knows which code to review

  2. Reviewers are familiar with requirements and design

  3. Purpose of review is clear

  4. Reviewers review all the code by themselves first

  5. Reviewers record comments in writing

  6. Code author hears and accepts comments in person

  7. Code author tracks comments through to fix

  8. Everyone saves time-stamped records to see how they’re doing

Comments

Popular posts from this blog

CodeHighlighter plugin test page.

This post is for testing CodeHighlighter plugin which uses GeSHi as a fontifier engine. ((Those code blocks are acquired from Google Code Search .)) ((For more supported languages, go CodeHighlighter plugin or GeSHi homepage.)) C++ (<pre lang="cpp" lineno="1">) class nsScannerBufferList { public: /** * Buffer objects are directly followed by a data segment. The start * of the data segment is determined by increment the |this| pointer * by 1 unit. */ class Buffer : public PRCList { public: Buffer() { ++index_; } PHP (<pre lang="php" lineno="4">) for ($i = 0; $i $value = ord( $utf8_string[ $i ] ); if ( $value < 128 ) { // ASCII $unicode .= chr($value); } else { if ( count( $values ) == 0 ) { $num_octets = ( $value } $values[] = $value; Lisp (<pre lang="lisp">) ;;; Assignment (define-caller-pattern setq ((:star var fo...

Textiler plugin test page

This post is for testing Textiler plugin . This plugin uses Textile engine (version 2.0.0). The sample text is come from Textile test page. (Note that the result will be vary according to your CSS options.) Supported wiki syntax Rendering result h2{color:green}. This is a title h3. This is a subhead p{color:red}. This is some text of dubious character. Isn't the use of "quotes" just lazy writing -- and theft of 'intellectual property' besides? I think the time has come to see a block quote. bq[fr]. This is a block quote. I'll admit it's not the most exciting block quote ever devised. Simple list: #{color:blue} one # two # three Multi-level list: # one ## aye ## bee ## see # two ## x ## y # three Mixed list: * Point one * Point two ## Step 1 ## Step 2 ## Step 3 * Point three ** Sub point 1 ** Sub point 2 Well, that went well. How about we insert an <a href="/" title="watch out">old-fashioned hypertext link</a>? Will the quo...

BookCover plugin test page

This post is for testing BookCover plugin . (( The previous test page has some comments from users.)) The 'Books Reading' section in the sidebar is also using this plugin. [ bookcover:1932394613] [bookcover:1932394613] [ bookcover:1590598385(Smart and Gets Things Done)] [bookcover:1590598385(Smart and Gets Things Done)] [ bookcover:1591841380(Wikinomics : How Mass Collaboration Changes Everything)] [bookcover:1591841380(Wikinomics : How Mass Collaboration Changes Everything)] [ bookcover:8995856408] [bookcover:8995856408] [ bookcover:8831793721] [bookcover:8831793721] [ bookcover:9788831793728] [bookcover:9788831793728]