Skip to content

Commit 4cf2499

Browse files
committed
DRY translated
1 parent 906d132 commit 4cf2499

1 file changed

Lines changed: 10 additions & 23 deletions

File tree

README.md

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,26 +2078,13 @@ class Manager
20782078

20792079
Try to observe the [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) principle.
20802080

2081-
Do your absolute best to avoid duplicate code. Duplicate code is bad because
2082-
it means that there's more than one place to alter something if you need to
2083-
change some logic.
2084-
2085-
Imagine if you run a restaurant and you keep track of your inventory: all your
2086-
tomatoes, onions, garlic, spices, etc. If you have multiple lists that
2087-
you keep this on, then all have to be updated when you serve a dish with
2088-
tomatoes in them. If you only have one list, there's only one place to update!
2089-
2090-
Often you have duplicate code because you have two or more slightly
2091-
different things, that share a lot in common, but their differences force you
2092-
to have two or more separate functions that do much of the same things. Removing
2093-
duplicate code means creating an abstraction that can handle this set of different
2094-
things with just one function/module/class.
2095-
2096-
Getting the abstraction right is critical, that's why you should follow the
2097-
SOLID principles laid out in the [Classes](#classes) section. Bad abstractions can be
2098-
worse than duplicate code, so be careful! Having said this, if you can make
2099-
a good abstraction, do it! Don't repeat yourself, otherwise you'll find yourself
2100-
updating multiple places any time you want to change one thing.
2081+
ডুপ্লিকেট কোড এড়ানোর জন্য সব সময় ই চেষ্টা করা উচিত। ডুপ্লিকেট কোড খারাপ কারণ হল যে আপনার যদি কোন কিছু পরিবর্তন করতে হয় তাহলে যত জায়গায় ডুপ্লিকেট কোড লিখেছেন সব জাইগায় ই পরিবর্তন করতে হবে।
2082+
2083+
মনে করেন আপনি একটা রেস্টুরেন্ট চালাচ্ছেন এবং আপনার সব ইনভেন্টরি এর হিসাব রাখতে হয়: টমাটো, পেয়াজ, রসুন, মরিচ ইত্যাদি। এখন যদি এই ইনভেন্টরি এর জন্য আলাদা আলাদা লিস্ট করেন তাহলে প্রতি বার ই আপনার সবগুলো লিস্ট আপডেট করতে হবে যদি কোন লিস্ট আপডেট করতে ভুলে যান তাহলে আপনার হিসাব ও ভুল হয়ে যাবে। কিন্তু যদি শুধু একটা লিস্ট থাকত তাহলে কত সহজেই কাজ হয়ে যেত শুদু মাত্র একটা জায়গায় তেই পরিবর্তন এর মাধ্যমে।
2084+
2085+
যদি এমন হয় যে আপনার ডুপ্লিকেট কোড করার কারণ হল আপনার কাছে ২ টা আলাদা জিনিষ আছে কিন্তু সেখানে কিছু জিনিস একই রকম যেটা আপনাকে ফোর্স করতেছে আলাদা ভাবে কোড করার জন্য। তাহলে আপনি ওই আলদা জিনিসগুলো আলাদা ভাবে abstraction করে জিনিসটা হান্ডেল করতে পারেন আর এর জন্য ওই আলাদা জিনিষ গুলো একটা function/module/class এ নিয়ে কাজ করতে পারেন তাহলে এই function/module/class আপনি অন্য কোথায় লাগলে সেখানে ব্যাবহার করতে পারবেন।
2086+
2087+
abstraction করা আসলে একটুখানি কঠিন এর জন্য আপনার উচিত হবে SOLID principles এর [Classes](#classes) section তা ফলো করা। কারণ খারাপ abstraction ডুপ্লিকেট কোড এর থেকেও বেশি খারাপ, তাই আপনাকে এই বিষয়ে অবশ্যই সাবধান হতে হবে।
21012088

21022089
**খারাপ:**
21032090

@@ -2145,7 +2132,7 @@ function showList(array $employees): void
21452132

21462133
**Very good:**
21472134

2148-
It is better to use a compact version of the code.
2135+
কোড এর কম্প্যাক্ট ভার্সন ব্যাবহার করা সবসময় ভাল।
21492136

21502137
```php
21512138
function showList(array $employees): void
@@ -2160,9 +2147,9 @@ function showList(array $employees): void
21602147

21612148
## অনুবাদ
21622149

2163-
This is also available in other languages:
2150+
এটা অন্যান্য ভাষাতেও খুঁজে পাবেন এখানেঃ
21642151

2165-
* :bangladesh: **Bangla:**
2152+
* :bangladesh: **বাংলা:**
21662153
* [nayeemdev/clean-code-php](https://github.com/nayeemdev/clean-code-php)
21672154
* :cn: **Chinese:**
21682155
* [php-cpm/clean-code-php](https://github.com/php-cpm/clean-code-php)

0 commit comments

Comments
 (0)