read
The Art of Readable Code by Dustin Boswell The Art of Readable Code by Dustin Boswell

Permalink: http://amzn.com/0596802293

몇몇 인상 깊었던 줄 친 문장들을 옮겨와 본다.

What we noticed is that all of the principles stem from a single theme. KEY IDEA : Code should be easy to understand.

It's so important that we call it "The Fundamental Theorem of Readability" KEY IDEA : Code should be written to minimize the time it would take for someone else to understand it.

Readability 는 코드 품질에 대한 가장 강력한 기준이다. 코드는 한번 쓰여지고, 여러 번 읽히기 때문이다. 읽기 좋은 코드를 만든다는 것 그 자체가 생산성과 직결되는 행위이기도 하다. 물론 어떻게 쓰는 것이 readable 한 가? 라는 질문에 대해서는 여러 가지 답이 있을 수 있겠다만, 이 책은 그런 논란이 있을 수 있는 부분은 최대한 조심스레 접근한다.

 

KEY IDEA : Consistent style is more important than the "right" style.

팀의 코딩 컨벤션을 정할 때, 이것이 좋은가 저것이 좋은가 논쟁이 일어나기 쉽다. 어느 정도는 따져봄 직 하겠지만, 너무 몰입할 필요 없다. 컨벤션은 말 그대로 컨벤션이다. 그냥 정해서 모두 다 같이 쓰면 되는 문제. 중요한 것은 정해진 것을 같이 지키려는 노력이다.

 

good code > bad code + good comments

주석에 대한 나의 가치관도 딱 이 문장과 같다. 이걸 좀 극단으로 가져가서 아예 주석을 달지 않으려고 노력했었다. 그런데 요즘 드는 생각은 너무 극단으로 가기 보다는 적절한 타협점을 찾는 게 나을 것 같다. 중요한 것은 코드의 readability 개선 여지를 항상 살펴봐야 한다는 것이겠지.

 

There are a number of markers that have become popular among programmers:

  • TODO : Stuff I haven't gotten around to yet
  • FIXME: Known-broken code here
  • HACK: Admittedly inelegant solution to a problem
  • XXX: Danger! major problem here

TODO 나 HACK 정도는 가끔 볼 수 있는 태그들인데, XXX 같은 경우는 처음 봤다. Danger! 라고 할 정도의 코드를 남겨놔도 되나 싶은 생각이 드는데, 아마 필요한 경우가 있긴 하니까 popular 태그 라고 설명을 해주지 않았나 싶다.

 

Overall, Bjarne Stroustrup, the creator of C++, says it best (in The C++ Programming Language):

In my experience, the do-statement is a source of errors and confusion. ... I prefer the condition "up front where I can see it." Consequently, I tend to avoid do-statements.

C++ 만든 비야네 스트롭스트룹 이 do-while 문에 대해 한 말이라고 한다. 결론은 do-while 은 읽기에 불편하다. 가능하면 쓰지 말자. 정도 되는 듯

 

Engineering is all about breaking down big problems into smaller ones and putting the solutions for those problems back together.

공학에 대한 통찰력 있는 문장. Divide and Conquer  

 

We agree wholeheartedly with Knuth's statement, "Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do"

Blog Logo

Ki Sung Bae


Published

Image

Gsong's Blog

Developer + Entrepreneur = Entreveloper

Back to Overview