The Clean Architecture in php



Download 2,26 Mb.
Pdf ko'rish
bet63/179
Sana24.06.2021
Hajmi2,26 Mb.
#100337
1   ...   59   60   61   62   63   64   65   66   ...   179
Bog'liq
The-Clean-Architecture-in-PHP-Kristopher-Wilson

class
OrderRepository
{
public function
getOrdersByMonth
(
$month
);
}
class
InvoicingService
{
public function
generateAndSendInvoices
() {}
}
class
InvoiceFactory
{
public function
createInvoice
(Order
$order
) {}
}
class
InvoiceGenerator
{
public function
createInvoiceFormat
(
Invoice
$invoice
,
$format
) {}
}
class
InvoiceDeliveryService
{
public function
sendInvoice
(
Invoice
$invoice
,
$method
) {}
}
Our four classes here represent the responsibilities of the previous
InvoicingService
class.
Ideally, we’d probably even have more than this: we’ll probably want strategy classes for each
format needed for the
InvoiceGenerator
and strategy classes for each delivery method of the


SOLID Design Principles
34
InvoiceDeliveryService
. Otherwise, these classes end up having more than one responsibility
as they’re either generating multiple file formats, or utilizing multiple delivery methods.
This is a lot of classes, almost seemingly a silly number of classes. What we’ve given up, however,
is one very large, monolithic class with multiple responsibilities. Each time we need to make a
change to one of those responsibilities, we potentially risk introducing an unintended defect in
the rest of the seemingly unrelated code.

Download 2,26 Mb.

Do'stlaringiz bilan baham:
1   ...   59   60   61   62   63   64   65   66   ...   179




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish