Clean Architecture


Chapter 6 Functional Programming



Download 6,37 Mb.
Pdf ko'rish
bet40/259
Sana26.02.2022
Hajmi6,37 Mb.
#465587
1   ...   36   37   38   39   40   41   42   43   ...   259
Bog'liq
Clean Architecture A Craftsman’s Guide to Software Structure and Design by Robert C. Martin (z-lib.org)

Chapter 6 Functional Programming
52
I m m u ta b i l i t y a n d A rc h i t e c t u r e
Why is this point important as an architectural consideration? Why would an 
architect be concerned with the mutability of variables? The answer is 
absurdly simple: All race conditions, deadlock conditions, and concurrent 
update problems are due to mutable variables. You cannot have a race 
condition or a concurrent update problem if no variable is ever updated. You 
cannot have deadlocks without mutable locks.
In other words, all the problems that we face in concurrent applications—all 
the problems we face in applications that require multiple threads, and 
multiple processors—cannot happen if there are no mutable variables.
As an architect, you should be very interested in issues of concurrency. You 
want to make sure that the systems you design will be robust in the presence 
of multiple threads and processors. The question you must be asking yourself, 
then, is whether immutability is practicable. 
The answer to that question is affirmative, if you have infinite storage and 
infinite processor speed. Lacking those infinite resources, the answer is a bit 
more nuanced. Yes, immutability can be practicable, if certain compromises 
are made. 
Let’s look at some of those compromises.
S e g r e g ati o n o f M u ta b i l it y
One of the most common compromises in regard to immutability is to 
segregate the application, or the services within the application, into mutable 
and immutable components. The immutable components perform their tasks 
in a purely functional way, without using any mutable variables. The 
immutable components communicate with one or more other components 
that are not purely functional, and allow for the state of variables to be 
mutated (Figure 6.1).
www.EBooksWorld.ir



Download 6,37 Mb.

Do'stlaringiz bilan baham:
1   ...   36   37   38   39   40   41   42   43   ...   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