Code Monkey home page Code Monkey logo

note's People

Watchers

James Cloos avatar Dong-Su An avatar

note's Issues

읽기 좋은 코드가 좋은 코드다

1. 코드는 이해하기 쉬워야 한다

무엇이 코드를 더 좋게 만드는가?

 for문 linked list iteration vs. while문 linked list iteration

전자가 더 낫다.

3중 mantissa 계산식 vs. if-else mantissa 계산식

후자가 더 낫다. 간결하더라도 친숙하게 느껴지는 이유는?

가독성의 기본 원리

  • 가독성의 기본 정리(the fundamental theorem of readability)
    • 코드는 다른 사람이 그것을 이해하는 데 들이는 시간을 최소화하는 방식으로 작성되어야 한다.
    • 개인 코드라 하더라도 시간이 지나고 이해하기 어려울수 있다.

분량이 적으면 항상 더 좋은가?

보통은 더 좋다. 그러나 항상 더 좋은 것은 아니다. 주석 처리도 코드를 더하긴 하지만 이해를 도와준다.

assert((!(bucket = FindBucket(key))) || !bucket->IsOccupied());

vs.

bucket = FindBucket(key);
if (bucket != NULL) assert(!bucket->IsOccupied());

이해를 위한 시간은 다른 목표와 충돌하는가?

코드의 효율성, 아키텍쳐, 테스트의 용이성과 같은 다른 조건도 고려해야하지 않을 까 하는 고민을 하지만, 이러한 조건들은 아무런 방해도 되지 않는다.

어려운 부분

다른 사람이 코드를 읽고 이해하기 쉬운지 따져보려면 추가적인 노력과 시간이 든다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.