Clean Architecture


Chapter 26 The Main Component



Download 6,37 Mb.
Pdf ko'rish
bet147/259
Sana26.02.2022
Hajmi6,37 Mb.
#465587
1   ...   143   144   145   146   147   148   149   150   ...   259
Bog'liq
Clean Architecture A Craftsman’s Guide to Software Structure and Design by Robert C. Martin (z-lib.org)

Chapter 26 The Main Component
236
Finally, notice that 
main
creates the map. 
private static void createMap() {
int nCaverns = (int) (Math.random() * 30.0 + 10.0);
while (nCaverns-- > 0)
caverns.add(makeName());
for (String cavern : caverns) {
maybeConnectCavern(cavern, NORTH);
maybeConnectCavern(cavern, SOUTH);
maybeConnectCavern(cavern, EAST);
maybeConnectCavern(cavern, WEST);
}
String playerCavern = anyCavern();
game.setPlayerCavern(playerCavern);
game.setWumpusCavern(anyOther(playerCavern));
game.addBatCavern(anyOther(playerCavern));
game.addBatCavern(anyOther(playerCavern));
game.addBatCavern(anyOther(playerCavern));
game.addPitCavern(anyOther(playerCavern));
game.addPitCavern(anyOther(playerCavern));
game.addPitCavern(anyOther(playerCavern));
game.setQuiver(5);
}
// much code removed…
}
www.EBooksWorld.ir


Conclusion
237
The point is that 
Main
is a dirty low-level module in the outermost circle of the 
clean architecture. It loads everything up for the high level system, and then 
hands control over to it.
C o n c lu s i o n
Think of 
Main
as a plugin to the application—a plugin that sets up the initial 
conditions and configurations, gathers all the outside resources, and then 
hands control over to the high-level policy of the application. Since it is a 
plugin, it is possible to have many 
Main
components, one for each 
configuration of your application.
For example, you could have a 
Main
plugin for 
Dev
, another for 
Test
, and yet 
another for 
Production
. You could also have a 
Main
plugin for each country 
you deploy to, or each jurisdiction, or each customer. 
When you think about 
Main
as a plugin component, sitting behind an 
architectural boundary, the problem of configuration becomes a lot easier to 
solve.
www.EBooksWorld.ir


This page intentionally left blank 
www.EBooksWorld.ir



Download 6,37 Mb.

Do'stlaringiz bilan baham:
1   ...   143   144   145   146   147   148   149   150   ...   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