Clean Architecture


Chapter 32 Frameworks Are Details



Download 6,37 Mb.
Pdf ko'rish
bet180/259
Sana26.02.2022
Hajmi6,37 Mb.
#465587
1   ...   176   177   178   179   180   181   182   183   ...   259
Bog'liq
Clean Architecture A Craftsman’s Guide to Software Structure and Design by Robert C. Martin (z-lib.org)

Chapter 32 Frameworks Are Details
294

The framework may evolve in a direction that you don’t find helpful. You 
may be stuck upgrading to new versions that don’t help you. You may even 
find old features, which you made use of, disappearing or changing in ways 
that are difficult for you to keep up with.

A new and better framework may come along that you wish you could 
switch to.
Th e S o lu ti o n
What is the solution? 
Don’t marry the framework! 
Oh, you can 
use
the framework—just don’t couple to it. Keep it at arm’s 
length. Treat the framework as a detail that belongs in one of the outer circles 
of the architecture. Don’t let it into the inner circles.
If the framework wants you to derive your business objects from its base 
classes, say no! Derive proxies instead, and keep those proxies in components 
that are 
plugins
to your business rules. 
Don’t let frameworks into your core code. Instead, integrate them into 
components that plug in to your core code, following the Dependency Rule.
For example, maybe you like Spring. Spring is a good dependency injection 
framework. Maybe you use Spring to auto-wire your dependencies. That’s 
fine, but you should not sprinkle 
@autowired
annotations all throughout 
your business objects. Your business objects should not know about Spring.
Instead, you can use Spring to inject dependencies into your 
Main
component. It’s OK for 
Main
to know about Spring since 
Main
is the dirtiest, 
lowest-level component in the architecture. 
www.EBooksWorld.ir


Conclusion
295
I N ow Pro n o u n c e Yo u …
There are some frameworks that you simply must marry. If you are using 
C++, for example, you will likely have to marry STL—it’s hard to avoid. If 
you are using Java, you will almost certainly have to marry the standard 
library. 
That’s normal—but it should still be a 
decision
. You must understand that 
when you marry a framework to your application, you will be stuck with that 
framework for the rest of the life cycle of that application. For better or for 
worse, in sickness and in health, for richer, for poorer, forsaking all others, 
you 
will
be using that framework. This is not a commitment to be entered 
into lightly. 

Download 6,37 Mb.

Do'stlaringiz bilan baham:
1   ...   176   177   178   179   180   181   182   183   ...   259




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