Skip to content

Commit e7fa191

Browse files
author
Umut Isik
committed
Solid and Test section
1 parent 2fe2b52 commit e7fa191

File tree

1 file changed

+72
-73
lines changed

1 file changed

+72
-73
lines changed

README.md

Lines changed: 72 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,16 +1369,16 @@ class Employee {
13691369

13701370
## **SOLID**
13711371

1372-
### Single Responsibility Principle (SRP)
1372+
### Tek sorumluluk prensibi (SRP)
13731373

1374-
As stated in Clean Code, "There should never be more than one reason for a class
1375-
to change". It's tempting to jam-pack a class with a lot of functionality, like
1376-
when you can only take one suitcase on your flight. The issue with this is
1377-
that your class won't be conceptually cohesive and it will give it many reasons
1378-
to change. Minimizing the amount of times you need to change a class is important.
1379-
It's important because if too much functionality is in one class and you modify
1380-
a piece of it, it can be difficult to understand how that will affect other
1381-
dependent modules in your codebase.
1374+
Clean Code kitabında söylendiği gibi, "Bir sınıfın değişmesi için hiçbir zaman birden
1375+
fazla sebep olmamalıdır". Uçuşunuzda yalnızca bir valiz alabildiğiniz zamanki gibi
1376+
bir çok işlevi olan bir sınıfı sıkıştırarak çıkarmak cazip gelir. Bunun sorun
1377+
olmasının sebebi, bu durumda sınıfınızın kavramsal olarak uyumlu olmaması ve değişmesi
1378+
için birçok nedene sahip olmasıdır. Bir sınıfı gerektiğinde değiştirmek için ihtiyacınız
1379+
duyulan zamanı azaltmanız önemlidir. Bu önemlidir, çünkü çok fazla işlevsellik bir sınıftaysa
1380+
ve bir parçasını değiştirirseniz, bunun kod tabanınızdaki diğer bağımlı modülleri nasıl
1381+
etkileyeceğini anlamak zor olabilir.
13821382

13831383
**Yanlış:**
13841384

@@ -1429,12 +1429,12 @@ class UserSettings {
14291429

14301430
**[⬆ başa dön](#içindekiler)**
14311431

1432-
### Open/Closed Principle (OCP)
1432+
### Açık/Kapalı Prensibi (OCP)
14331433

1434-
As stated by Bertrand Meyer, "software entities (classes, modules, functions,
1435-
etc.) should be open for extension, but closed for modification." What does that
1436-
mean though? This principle basically states that you should allow users to
1437-
add new functionalities without changing existing code.
1434+
Bertrand Meyer tarafından belirtildiği gibi, "yazılım varlıkları (sınıflar, modüller,
1435+
fonksiyonlar, vb.) genişlemek için açık, ancak değişiklik için kapalı olmalıdır".
1436+
Bu ne anlama geliyor? Bu ilke, temel olarak, kullanıcıların mevcut kodu değiştirmeden
1437+
yeni işlevler eklemelerine izin vermeniz gerektiğini belirtir.
14381438

14391439
**Yanlış:**
14401440

@@ -1520,20 +1520,19 @@ class HttpRequester {
15201520

15211521
**[⬆ başa dön](#içindekiler)**
15221522

1523-
### Liskov Substitution Principle (LSP)
1523+
### Liskov Yerdeğiştirme Prensibi (LSP)
15241524

1525-
This is a scary term for a very simple concept. It's formally defined as "If S
1526-
is a subtype of T, then objects of type T may be replaced with objects of type S
1527-
(i.e., objects of type S may substitute objects of type T) without altering any
1528-
of the desirable properties of that program (correctness, task performed,
1529-
etc.)." That's an even scarier definition.
1525+
Bu çok basit bir kavram için karmaşık bir terimdir. Resmen "S, T'nin bir alt tipi ise,
1526+
o zaman T tipi olan nesneler, bu programın istenen özelliklerinden herhangi birini
1527+
değiştirmeden, S tipi olan nesnelerle (yani, S tipi objelerin yerini alabilir),
1528+
T tipi objelerin yerini alabilir. (doğruluk, yapılan görev vb.) Bu daha da karmaşık
1529+
bir tanım.
15301530

1531-
The best explanation for this is if you have a parent class and a child class,
1532-
then the base class and child class can be used interchangeably without getting
1533-
incorrect results. This might still be confusing, so let's take a look at the
1534-
classic Square-Rectangle example. Mathematically, a square is a rectangle, but
1535-
if you model it using the "is-a" relationship via inheritance, you quickly
1536-
get into trouble.
1531+
Bunun için en iyi açıklama bir ana sınıfınız ve bir alt sınıfınız varsa, temel sınıf ve
1532+
alt sınıf yanlış sonuçlar alınmadan birbirlerinin yerine kullanılabilir. Bu hala kafa
1533+
karıştırıcı olabilir, o yüzden klasik kare dikdörtgen örneğine bakalım. Matematiksel
1534+
olarak, bir kare bir dikdörtgendir, ancak kalıtsallık yoluyla "is-a" ilişkisini
1535+
kullanarak modellerseniz, derhal başınız derde girer.
15371536

15381537
**Yanlış:**
15391538

@@ -1581,7 +1580,7 @@ function renderLargeRectangles(rectangles) {
15811580
rectangles.forEach(rectangle => {
15821581
rectangle.setWidth(4);
15831582
rectangle.setHeight(5);
1584-
const area = rectangle.getArea(); // BAD: Returns 25 for Square. Should be 20.
1583+
const area = rectangle.getArea(); // BAD: Kare için 25 döner. 20 olmalı.
15851584
rectangle.render(area);
15861585
});
15871586
}
@@ -1639,21 +1638,21 @@ renderLargeShapes(shapes);
16391638

16401639
**[⬆ başa dön](#içindekiler)**
16411640

1642-
### Interface Segregation Principle (ISP)
1641+
### Arayüz Ayrım Prensibi (ISP)
16431642

1644-
JavaScript doesn't have interfaces so this principle doesn't apply as strictly
1645-
as others. However, it's important and relevant even with JavaScript's lack of
1646-
type system.
1643+
JavaScript'te interface yoktur, bu nedenle bu ilke diğerleri kadar uygulanabilir
1644+
değildir. Bununla birlikte, bu kavramJavaScript’in tip sistem eksikliğinde bile
1645+
faydalı ve önemlidir.
16471646

1648-
ISP states that "Clients should not be forced to depend upon interfaces that
1649-
they do not use." Interfaces are implicit contracts in JavaScript because of
1650-
duck typing.
1647+
Arayüz Ayrım Prensibi (ISP) "İstemcilerin kullanmadıkları arayüzlere bağlı
1648+
kalmaması gerektiğini" belirtmektedir. Arayüzler, kendi zayıf yapısı nedeniyle
1649+
JavaScript'te gizli sözleşmelerdir.
16511650

1652-
A good example to look at that demonstrates this principle in JavaScript is for
1653-
classes that require large settings objects. Not requiring clients to setup
1654-
huge amounts of options is beneficial, because most of the time they won't need
1655-
all of the settings. Making them optional helps prevent having a
1656-
"fat interface".
1651+
Bu prensibi JavaScript'te gösteren iyi bir örnek, büyük ayar nesneleri
1652+
gerektiren sınıflardır. İstemciden büyük miktarda seçenek ayarlamalarını
1653+
istememek faydalıdır, çünkü çoğu zaman tüm ayarlara ihtiyaç duymazlar.
1654+
Bunları isteğe bağlı yapmak, "şişman interface" sahip olmamaya yardımcı
1655+
olur.
16571656

16581657
**Yanlış:**
16591658

@@ -1676,7 +1675,7 @@ class DOMTraverser {
16761675

16771676
const $ = new DOMTraverser({
16781677
rootNode: document.getElementsByTagName("body"),
1679-
animationModule() {} // Most of the time, we won't need to animate when traversing.
1678+
animationModule() {} // Çoğu zaman gezinirken animate kullanma ihtiyacımız olmaz.
16801679
// ...
16811680
});
16821681
```
@@ -1717,28 +1716,28 @@ const $ = new DOMTraverser({
17171716

17181717
**[⬆ başa dön](#içindekiler)**
17191718

1720-
### Dependency Inversion Principle (DIP)
1719+
### Bağımlılığın Ters Çevrilmesi (DIP)
17211720

1722-
This principle states two essential things:
1721+
Bu prensip ik temel şeyi belirtir:
17231722

1724-
1. High-level modules should not depend on low-level modules. Both should
1725-
depend on abstractions.
1726-
2. Abstractions should not depend upon details. Details should depend on
1727-
abstractions.
1723+
1. Üst seviye modüller alt seviye modüllere bağımlı olmamalı. İkisi birden
1724+
ortak soyutlamalara bağımlı olmalı.
1725+
2. Soyutlamalar ayrıntılara bağlı olmamalıdır. Ayrıntıkar soyutlamaya bağlı
1726+
olmalıdır.
17281727

1729-
This can be hard to understand at first, but if you've worked with AngularJS,
1730-
you've seen an implementation of this principle in the form of Dependency
1731-
Injection (DI). While they are not identical concepts, DIP keeps high-level
1732-
modules from knowing the details of its low-level modules and setting them up.
1733-
It can accomplish this through DI. A huge benefit of this is that it reduces
1734-
the coupling between modules. Coupling is a very bad development pattern because
1735-
it makes your code hard to refactor.
1728+
İlk başta bunu anlamak zor olabilir, ancak AngularJS ile çalıştıysanız,
1729+
bu ilkenin Bağımlılık Enjeksiyonu (DI) şeklinde uygulandığını gördünüz.
1730+
Aynı kavramlar olmasalar da, DIP, yüksek seviye modüllerinin düşük seviye
1731+
modüllerinin ayrıntılarını bilmesini ve kurmasını önler. Bunu DI ile
1732+
başarabilir. Bunun en büyük yararı modüller arasındaki eşleşmeyi azaltmasıdır.
1733+
İkileme çok kötü bir gelişme şeklidir çünkü kodunuzu elden geçirilmesini
1734+
zorlaştırır.
17361735

1737-
As stated previously, JavaScript doesn't have interfaces so the abstractions
1738-
that are depended upon are implicit contracts. That is to say, the methods
1739-
and properties that an object/class exposes to another object/class. In the
1740-
example below, the implicit contract is that any Request module for an
1741-
`InventoryTracker` will have a `requestItems` method.
1736+
Daha önce de belirtildiği gibi, JavaScript'in ara yüzleri bulunmadığından
1737+
bağımlı olan soyutlamalar gizli sözleşmelerdir. Başka bir deyişle,
1738+
bir nesnenin / sınıfın başka bir nesneye / sınıfa açtığı yöntem ve
1739+
özellikler. Aşağıdaki örnekte, gizli sözleşme, bir `InventoryTracker`
1740+
için herhangi bir Request modülünün bir `requestItems` yöntemine sahip olmasıdır.
17421741

17431742
**Yanlış:**
17441743

@@ -1820,24 +1819,24 @@ inventoryTracker.requestItems();
18201819

18211820
**[⬆ başa dön](#içindekiler)**
18221821

1823-
## **Testing**
1822+
## **Test etme**
18241823

1825-
Testing is more important than shipping. If you have no tests or an
1826-
inadequate amount, then every time you ship code you won't be sure that you
1827-
didn't break anything. Deciding on what constitutes an adequate amount is up
1828-
to your team, but having 100% coverage (all statements and branches) is how
1829-
you achieve very high confidence and developer peace of mind. This means that
1830-
in addition to having a great testing framework, you also need to use a
1831-
[good coverage tool](https://gotwarlost.github.io/istanbul/).
1824+
Test, sonucu oluşturmaktan daha önemlidir. Eğer hiç testiniz yoksa veya yetersiz
1825+
miktarda ise, sonra kodu her gönderdiğinizde hiçbir şeyi bozmadığınızdan emin
1826+
olmayacaksınız. Neyin uygun bir miktar oluşturduğuna karar vermek ekibinize bağlıdır,
1827+
ancak %100 kapsama sahip olmak (tüm özellik ve branşlar) çok yüksek bir güven ve
1828+
geliştirici gönül rahatlığı elde etmenizdir. Bu, harika bir test çerçevesine
1829+
ek olarak, aynı zamanda bir[iyi kapsam aracı](https://gotwarlost.github.io/istanbul/)
1830+
sahip olmanız demektir.
18321831

1833-
There's no excuse to not write tests. There are [plenty of good JS test frameworks](https://jstherightway.org/#testing-tools), so find one that your team prefers.
1834-
When you find one that works for your team, then aim to always write tests
1835-
for every new feature/module you introduce. If your preferred method is
1836-
Test Driven Development (TDD), that is great, but the main point is to just
1837-
make sure you are reaching your coverage goals before launching any feature,
1838-
or refactoring an existing one.
1832+
Test yazmamak için mazeret yok. Bol miktarda [JS test çatısı](https://jstherightway.org/#testing-tools)
1833+
var, bu yüzden ekibinizin tercih ettiği bir tane bulun. Takımınız için uygun
1834+
olanı bulduğunuzda, tanıttığınız her yeni özellik / modül için her zaman
1835+
testler yazmayı hedefleyin. Tercih ettiğiniz yöntem Test Tahrikli Geliştirme (TDD) ise,
1836+
bu harika, ancak asıl mesele, herhangi bir özelliği başlatmadan veya mevcut olanı yeniden
1837+
düzenlemeden önce kapsama hedeflerinize ulaştığınızdan emin olmaktır.
18391838

1840-
### Single concept per test
1839+
### Her test için tek kavram
18411840

18421841
**Yanlış:**
18431842

0 commit comments

Comments
 (0)