Clean Code



Download 3,58 Mb.
Pdf ko'rish
bet162/384
Sana05.04.2022
Hajmi3,58 Mb.
#530298
1   ...   158   159   160   161   162   163   164   165   ...   384
Bog'liq
Clean Code

Listing 11-3 (continued)
JDK Proxy Example


163
Pure Java AOP Frameworks
and complexity are two of the drawbacks of proxies. They make it hard to create clean
code! Also, proxies don’t provide a mechanism for specifying system-wide execution
“points” of interest, which is needed for a true AOP solution.
11
Pure Java AOP Frameworks
Fortunately, most of the proxy boilerplate can be handled automatically by tools. Proxies
are used internally in several Java frameworks, for example, Spring AOP and JBoss AOP,
to implement aspects in pure Java.
12
In Spring, you write your business logic as 
Plain-Old
Java Objects
. POJOs are purely focused on their domain. They have no dependencies on
enterprise frameworks (or any other domains). Hence, they are conceptually simpler and
easier to test drive. The relative simplicity makes it easier to ensure that you are imple-
menting the corresponding user stories correctly and to maintain and evolve the code for
future stories. 
You incorporate the required application infrastructure, including cross-cutting con-
cerns like persistence, transactions, security, caching, failover, and so on, using declara-
tive configuration files or APIs. In many cases, you are actually specifying Spring or
JBoss library aspects, where the framework handles the mechanics of using Java proxies
or byte-code libraries transparently to the user. These declarations drive the dependency
injection (DI) container, which instantiates the major objects and wires them together on
demand
.
Listing 11-4 shows a typical fragment of a Spring V2.5 configuration file, app.xml
13
:
11. AOP is sometimes confused with techniques used to implement it, such as method interception and “wrapping” through 
proxies. The real value of an AOP system is the ability to specify systemic behaviors in a concise and modular way. 
12. See [Spring] and [JBoss]. “Pure Java” means without the use of AspectJ.

Download 3,58 Mb.

Do'stlaringiz bilan baham:
1   ...   158   159   160   161   162   163   164   165   ...   384




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