You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-20Lines changed: 9 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1426,30 +1426,19 @@ by this author.
1426
1426
1427
1427
## **Don't repeat yourself (DRY)**
1428
1428
1429
-
Try to observe the [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)
1430
-
principle.
1431
1429
1432
-
Do your absolute best to avoid duplicate code. Duplicate code is bad because it
1433
-
means that there's more than one place to alter something if you need to change
1434
-
some logic.
1430
+
[DRY]((https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)) 원칙을 따르세요.
1435
1431
1436
-
Imagine if you run a restaurant and you keep track of your inventory: all your
1437
-
tomatoes, onions, garlic, spices, etc. If you have multiple lists that you keep
1438
-
this on, then all have to be updated when you serve a dish with tomatoes in
1439
-
them. If you only have one list, there's only one place to update!
1432
+
중복된 코드는 피하세요. 중복된 코드는 만약 변경이 생겼을 때 여러 군데에서 변경을 해줘야 하기 때문에 좋지 않습니다.
1440
1433
1441
-
Often you have duplicate code because you have two or more slightly different
1442
-
things, that share a lot in common, but their differences force you to have two
1443
-
or more separate functions that do much of the same things. Removing duplicate
1444
-
code means creating an abstraction that can handle this set of different things
1445
-
with just one function/module/class.
1434
+
식당을 운영하고 재고를 관리한다고 가정해보겠습니다. 토마토, 양파, 마늘, 향신료 등 모든 재고를 관리해야 합니다.이때 여러 개의 목록을 가지고 있다면 토마토가 들어있는 요리를 제공할 때마다 모든 목록을 업데이트해야 합니다. 반면에 목록이 하나만 있다면 업데이트할 곳은 한 곳 뿐입니다.
1446
1435
1447
-
Getting the abstraction right is critical. Bad abstractions can be worse than
1448
-
duplicate code, so be careful! Having said this, if you can make a good
1449
-
abstraction, do it! Don't repeat yourself, otherwise you'll find yourself
1450
-
updating multiple places any time you want to change one thing.
1436
+
종종 중복된 코드가 생기는 이유로 코드에서 공통점이 많지만, 약간의 차이로 인해 동일한 작업을 수행하는 두 개 이상의 별도 함수를 가져야 하기 때문입니다. 중복된 코드를 제거하는 것은 단일 함수/모듈/클래스로 이 서로 다른 집합을 처리할 수 있는 추상화를 만드는 것을 의미합니다.
1451
1437
1452
-
**Bad:**
1438
+
추상화를 올바르게 얻는 것이 중요합니다. 잘못된 추상화는 중복된 코드보다 더 나쁠 수 있으므로 주의하세요! 그럼에도 불구하고, 좋은 추상화를 만들 수 있다면 그것을 하세요! 자신을 반복하지 마세요. 그렇지 않으면 한 가지를 변경할 때마다 여러 곳을 업데이트하게 될 것입니다.
0 commit comments