# تا حد ممکن فانکشن‌های کوچک بنویسید

وقتی که صحبت از اندازهٔ (Size) یک فانکشن یا تابع به میان می‌آید، منظور هم می‌تواند تعداد خطوطی که داخل فانکشن مد نظر نوشته شده باشد و هم تعداد تَسک‌هایی که آن فانکشن قرار است انجام دهد.

گرچه هر دو موضوع از اهمیت بسزایی برخوردارند، اما تخصصی بودن فانکشن از اهمیت به مراتب بیشتری برخوردار است. در واقع، هرچه ما فانکشن‌هایی که می‌نویسیم تخصصی‌تر باشند، مدیریت سورس‌کد در آینده، خواندن کدها توسط دیگر دولوپرها و به حداقل رساندن وابستگی‌ها در سورس‌کد پروژه‌ٔ خود بیشتر و بیشتر می‌شود.

به عبارت دیگر، هر فانکشن نباید بیش از یک تَسک (کار) را انجام دهد که در چنین حالتی می‌گوییم فانکشن مد نظر دارای قابلیت Single Responsibility است.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://97-things-every-x-should-know.gitbook.io/97-things-every-programmer-should-know/fa/thing_94.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
