Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4e1c065

Browse files
authored
Merge pull request#8 from EarthCodingLab/feat/functions
docs: translate functions to korean
2 parentsd7a3eb2 +c83c793 commit4e1c065

File tree

1 file changed

+30
-60
lines changed

1 file changed

+30
-60
lines changed

‎README.md‎

Lines changed: 30 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
-[불필요한 맥락 제거하기](#불필요한-맥락-제거하기)
1818
-[Use default arguments instead of short circuiting or conditionals](#use-default-arguments-instead-of-short-circuiting-or-conditionals)
1919
-[**Functions**](#functions)
20-
-[Functions should do one thing](#functions-should-do-one-thing)
21-
-[Function arguments (2 or fewer ideally)](#function-arguments-2-or-fewer-ideally)
22-
-[Function names should say what they do](#function-names-should-say-what-they-do)
23-
-[Functions should only be one level of abstraction](#functions-should-only-be-one-level-of-abstraction)
24-
-[Don't use flags as function parameters](#dont-use-flags-as-function-parameters)
25-
-[Avoid side effects](#avoid-side-effects)
20+
-[함수는 한 가지 일만 하기](#함수는-한-가지-일만-하기)
21+
-[함수 인자 (이상적으로는 2개 이하)](#함수-인자-이상적으로는-2개-이하)
22+
-[함수 이름은 함수가 무슨 일을 하는지 알기 쉽게](#함수-이름은-함수가-무슨-일을-하는지-알기-쉽게)
23+
-[함수는 하나의 추상화 수준만 가지기](#함수는-하나의-추상화-수준만-가지기)
24+
-[함수 파라미터로 플래그 사용하지 않기](#함수-파라미터로-플래그-사용하지-않기)
25+
-[사이드 이펙트 피하기](#사이드-이펙트-피하기)
2626
-[**Classes**](#classes)
2727
-[**Single Responsibility Principle (SRP)**](#single-responsibility-principle-srp)
2828
-[**Open/Closed Principle (OCP)**](#openclosed-principle-ocp)
@@ -286,15 +286,11 @@ def create_micro_brewery(name: str = "Hipster Brew Co."):
286286

287287
##**Functions**
288288

289-
###Functions should do one thing
289+
###함수는 한 가지 일만 하기
290290

291-
This is by far the most important rule in software engineering. When functions
292-
do more than one thing, they are harder to compose, test, and reason about.
293-
When you can isolate a function to just one action, they can be refactored
294-
easily and your code will read much cleaner. If you take nothing else away from
295-
this guide other than this, you'll be ahead of many developers.
291+
소프트웨어 엔지니어링에서 가장 중요한 규칙입니다. 함수가 한가지 이상의 일을 수행한다면 함수를 구성, 테스트, 추론하기 어려워집니다. 함수를 한 가지 일만 수행하도록 분리한다면 쉽게 리팩토링 할 수 있으며, 코드는 더욱 깔끔해집니다. 이 가이드에서 이 한 가지만 기억하더라도 다른 많은 개발자보다 앞서게 될 것입니다.
296292

297-
**Bad:**
293+
**나쁜 예:**
298294

299295
```python
300296
from typingimport List
@@ -316,7 +312,7 @@ def email_clients(clients: List[Client]) -> None:
316312
email(client)
317313
```
318314

319-
**Good**:
315+
**좋은 예**:
320316

321317
```python
322318
from typingimport List
@@ -343,9 +339,9 @@ def email_clients(clients: List[Client]) -> None:
343339
email(client)
344340
```
345341

346-
Do you see an opportunity for using generators now?
342+
generator를 사용하여 더욱 개선할 수 있습니다.
347343

348-
**Even better**
344+
**더 좋은 예**
349345

350346
```python
351347
from typingimport Generator, Iterator
@@ -373,24 +369,13 @@ def email_client(clients: Iterator[Client]) -> None:
373369

374370
**[⬆ back to top](#table-of-contents)**
375371

376-
###Function arguments (2 or fewer ideally)
372+
###함수 인자 (이상적으로는 2개 이하)
377373

378-
A large amount of parameters is usually the sign that a function is
379-
doing too much (has more than one responsibility). Try to decompose it
380-
into smaller functions having a reduced set of parameters, ideally less than
381-
three.
374+
함수에 많은 파라미터가 있는 경우 함수가 너무 많은 작업 (하나 이상의 책임) 을 수행하고 있다는 신호일 수 있습니다. 이상적으로 2개 이하의 파라미터를 가지도록 함수를 분해해보세요.
382375

383-
If the function has a single responsibility, consider if you can bundle
384-
some or all parameters into a specialized object that will be passed as an
385-
argument to the function. These parameters might be attributes of a single
386-
entity that you can represent with a dedicated data structure. You may also
387-
be able to reuse this entity elsewhere in your program. The reason why this is
388-
a better arrangement is than having multiple parameters is that we may be able
389-
to move some computations, done with those parameters inside the
390-
function, into methods belonging to the new object, therefore reducing the
391-
complexity of the function.
376+
만약 함수가 하나의 책임만을 가진다면, 일부 또는 모든 파라미터를 함수에 전달할 특수화된 객체로 묶어보는 것을 고려해보세요. 이러한 파라미터는 전용 데이터 구조로 표현될 수 있는 단일 엔티티의 애트리뷰트일 수 있습니다. 또한 이러한 엔티티는 다른 곳에서도 재사용할 수 있습니다. 여러 파라미터를 사용하는 것보다 이 방법이 나은 이유는 함수 내부에서 해당 파라미터로 수행되는 일부 계산을 새 엔티티에 속하는 메서드로 옮겨 함수의 복잡도를 줄일 수 있기 떄문입니다.
392377

393-
**Bad:**
378+
**나쁜 예:**
394379

395380
```python
396381
defcreate_menu(title,body,button_text,cancellable):
@@ -561,9 +546,9 @@ create_menu(
561546

562547
**[⬆ back to top](#table-of-contents)**
563548

564-
###Function names should say what they do
549+
###함수 이름은 함수가 무슨 일을 하는지 알기 쉽게
565550

566-
**Bad:**
551+
**나쁜 예:**
567552

568553
```python
569554
classEmail:
@@ -590,12 +575,11 @@ message.send()
590575

591576
**[⬆ back to top](#table-of-contents)**
592577

593-
###Functions should only be one level of abstraction
578+
###함수는 하나의 추상화 수준만 가지기
594579

595-
When you have more than one level of abstraction, your function is usually
596-
doing too much. Splitting up functions leads to reusability and easier testing.
580+
만약 하나 이상의 추상화 수준을 가진다면, 함수는 너무 많은 일을 할 수도 있습니다. 함수를 재사용 가능하고 테스트하기 쉽게 분리하세요.
597581

598-
**Bad:**
582+
**나쁜 예:**
599583

600584
```python
601585
#type:ignore
@@ -619,7 +603,7 @@ def parse_better_js_alternative(code: str) -> None:
619603
pass
620604
```
621605

622-
**Good:**
606+
**좋은 예:**
623607

624608
```python
625609
from typingimport Tuple, List, Dict
@@ -657,11 +641,9 @@ def parse(tokens: List) -> List:
657641

658642
**[⬆ back to top](#table-of-contents)**
659643

660-
###Don't use flags as function parameters
644+
###함수 파라미터로 플래그 사용하지 않기
661645

662-
Flags tell your user that this function does more than one thing. Functions
663-
should do one thing. Split your functions if they are following different code
664-
paths based on a boolean.
646+
플래그는 사용자에게 함수가 한 가지 이상의 일을 한다는 것을 알려줍니다. 함수는 한가지 일만을 수행해야 합니다. 따라서 불리언 값에 따라 다른 코드 경로를 따르도록 함수를 분리하세요.
665647

666648
**Bad:**
667649

@@ -694,27 +676,15 @@ def create_temp_file(name: str) -> None:
694676

695677
**[⬆ back to top](#table-of-contents)**
696678

697-
###Avoid side effects
679+
###사이드 이펙트 피하기
698680

699-
A function produces a side effect if it does anything other than take a value
700-
in and return another value or values. For example, a side effect could be
701-
writing to a file, modifying some global variable, or accidentally wiring all
702-
your money to a stranger.
681+
함수가 입력값을 받아서 다른 값들을 반환하는 것 이외에 다른 작업을 수행하면 사이드 이펙트를 일으킵니다. 예를 들어, 파일 쓰기, 전역 변수 수정, 실수로 모르는 사람에게 돈을 송금하는 것 등이 있습니다.
703682

704-
Now, you do need to have side effects in a program on occasion - for example,
705-
like in the previous example, you might need to write to a file. In these
706-
cases, you should centralize and indicate where you are incorporating side
707-
effects. Don't have several functions and classes that write to a particular
708-
file - rather, have one
709-
(and only one) service that does it.
683+
프로그램에서 때때로 사이드 이펙트가 필요할 수 있습니다. 예를 들어, 이전 예와 같이 파일에 쓰기 작업이 필요할 수 있습니다. 이러한 경우에는 사이트 이펙트를 포함하는 위치를 중앙 집중화하고 표시해야 합니다. 특정 파일에 쓰기 작업을 하는 여러 함수와 클래스를 가지지 말고 하나의 서비스만을 가지세요.
710684

711-
The main point is to avoid common pitfalls like sharing state between objects
712-
without any structure, using mutable data types that can be written to by
713-
anything, or using an instance of a class, and not centralizing where your side
714-
effects occur. If you can do this, you will be happier than the vast majority
715-
of other programmers.
685+
요점은 구조 없이 객체 간에 상태를 공유하거나, 누구나 쓸 수 있는 가변 데이터 유형을 사용하거나, 클래스의 인스턴스를 사용하거나, 부작용이 발생하는 위치를 중앙 집중화하지 않는 것과 같은 일반적인 함정을 피하는 것입니다. 이를 통해 대다수의 다른 프로그래머보다 행복하게 작업할 수 있을 것입니다.
716686

717-
**Bad:**
687+
**나쁜 예:**
718688

719689
```python
720690
#type:ignore
@@ -743,7 +713,7 @@ print(fullname) # ["Ryan", "McDermott"]
743713
# function again?
744714
```
745715

746-
**Good:**
716+
**좋은 예:**
747717

748718
```python
749719
from typingimport List, AnyStr

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp