TURI BLOG

[Nomad Coders Challenge] Clean Code - Assignment #04 ๋ณธ๋ฌธ

Nomad Coders

[Nomad Coders Challenge] Clean Code - Assignment #04

TURI BLOG 2024. 12. 2. 17:21

 

 

๐Ÿ“ It is part of a book club challenge on a programming learning website called Nomad Coders. The challenge is to demonstrate what I have learned after reading Clean Code by Robert C. Martin.

 

๐Ÿ“ It will consist of the following sections over three weeks: the range of reading, the top quotes from the book, my review, and remaining questions. 

  ๐Ÿ”—Challenge Schedule


๐Ÿ’ป I plan to read Clean Code in JavaScript and Python, referring to the GitHub repositories shared by Nomad Coders with the challengers.

 

Assignment #04

  • ๐Ÿ“š Chapter 3. Functions - ํ•จ์ˆ˜๋ฅผ ์ž˜ ๋งŒ๋“œ๋Š” ๋ฒ•
  • โœ”๏ธ TIL 
    • Top quotes from the book
    • My review
    • Remaining questions

 

๐Ÿ“ Top quotes from the book

  • ์ž‘๊ฒŒ ๋งŒ๋“ค์–ด๋ผ
    • ํ•จ์ˆ˜๊ฐ€ ์ž‘์„์ˆ˜๋ก ๋” ์ข‹๋‹ค
    • if ๋ฌธ/ esle ๋ฌธ/ while ๋ฌธ ๋“ฑ์— ๋“ค์–ด๊ฐ€๋Š” ๋ธ”๋ก์€ ํ•œ ์ค„์ด์–ด์•ผ ํ•œ๋‹ค๋Š” ์˜๋ฏธ๋‹ค.
  •  Functions should do one thing. ๊ทธ ํ•œ๊ฐ€์ง€๋ฅผ ์ž˜ ํ•ด์•ผ ํ•œ๋‹ค. ๊ทธ ํ•œ๊ฐ€์ง€๋งŒ์„ ํ•ด์•ผ ํ•œ๋‹ค.
    • TO RenderPageWithSetupsAndTeardowns
      ํŽ˜์ด์ง€๊ฐ€ ํ…Œ์ŠคํŠธ ํŽ˜์ด์ง€์ธ์ง€ ํ™•์ธ ํ•œ ํ›„ -> ํ…Œ์ŠคํŠธ ํŽ˜์ด์ง€๋ฉด -> ์„ค์ • ํŽ˜์ด์ง€, ํ•ด์ œ ํŽ˜์ด์ง€๋ฅผ ๋„ฃ๋Š”๋‹ค. ํ…Œ์ŠคํŠธ ํŽ˜์ด์ง€๋“  ์•„๋‹ˆ๋“  -> HTML๋กœ ๋ Œ๋”๋งํ•œ๋‹ค. 
    •  ํ•จ์ˆ˜๊ฐ€ 'ํ•œ ๊ฐ€์ง€'๋งŒ ํ•˜๋Š”์ง€ ํŒ๋‹จํ•˜๋Š” ๋‹ค๋ฅธ ๋ฐฉ๋ฒ• - ์˜๋ฏธ ์žˆ๋Š” ์ด๋ฆ„์œผ๋กœ ๋‹ค๋ฅธ ํ•จ์ˆ˜๋ฅผ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ๊ทธ ํ•จ์ˆ˜๋Š” ์—ฌ๋Ÿฌ ์ž‘์—…์„ ํ•˜๋Š” ์…ˆ์ด๋‹ค. [G34]
    • This is by far the most important rule in software engineering. When functions do more than one thing, they are harder to compose, test, and reason about. When you can isolate a function to just one action, it can be refactored easily and your code will read much cleaner. ( @ryanmcdermott. Clean Code in Javascript: Functions. GitHub. Link )
  •  Functions should only be one level of abstraction. 
    • When you have more than one level of abstraction your function is usually doing too much. Splitting up functions leads to reusability and easier testing. ( @ryanmcdermott. Clean Code in Javascript: Functions. GitHub. Link )
  • ...

 

๐Ÿ–Š๏ธ My review

  • ...

 

 

๐Ÿ” Remaining questions


๐Ÿ”— Additional Resources

 

Comments