DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Your Cross-Cutting Concerns are Someone Else's Core Domain

Your Cross-Cutting Concerns are Someone Else's Core Domain

Cyrille Martraire user avatar by
Cyrille Martraire
·
Sep. 08, 10 · Java Zone · Interview
Like (0)
Save
Tweet
5.41K Views

Join the DZone community and get the full member experience.

Join For Free

consider a domain, for example an online bookshop project that we call buycheapbooks. the ubiquitous language for this domain would talk about book, category, popularity, shoppingcart etc.

business domains

from scratch, coding this domain can be quite fast, and we can play with the fully unit-tested domain layer quickly. however if we want to ship, we will have to spend several times more effort because of all the extra cross-cutting concerns we must deal with: persistence, user preferences, transactions, concurrency and logging (see non-functional requirements ). they are not part of the domain, but developers often spend a large amount of their time on them, and by the way, middleware and java ee almost exclusively focus on these concerns through jpa, jta, jmx and many others.

on first approximation, our application is made of a domain and of several cross-cutting concerns. however, when it is time to implement the cross-cutting concerns, they each become the core domain -a technical one- of another dedicated project in its own right. these technical projects are managed by someone else, somewhere not in your team, and you would usually use these specific technical projects to address your cross-cutting concerns, rather than doing it yourself from scratch with code.

technical domains

for example, persistence is precisely the core domain of an orm like hibernate . the ubiquitous language for such project would talk about data mapper , caching, fetching strategy (lazy load etc.), inheritance mapping ( single table inheritance , class table inheritance , concrete table inheritance ) etc. these kinds of projects also deal with their own cross-cutting concerns such as logging and administration, among others.

logging is the core domain of log4j , and it must itself deal with cross-cutting concerns such as configuration.

domain_ccc1

in this perspective, the cross-cutting concerns of a project are the core domains of other satellite projects, which focus on technical domains.

hence we see that the very idea of core domain vs. cross-cutting concerns is essentially relative to the project considered.

note, for the sake of it, that there may even be cycles between the core domains and the required cross-cutting concerns of several projects. for example there is a cycle between a (hypothetical) project conf4j that focuses on configuration (its core domain) and that requires logging (as a cross-cutting concern), and another project log4j that focuses on logging (its core domain) and that requires configuration (as a cross-cutting concern).

conclusion

there is no clear and definite answer as to whether a concept is part of the domain or whether it is just a cross-cutting concern: it depends on the purpose of the project. there is almost always a project which domain addresses the cross-cutting concern of another.

for projects that target end-users, we usually tend to reuse the code that deals with cross-cutting concerns through middleware and apis, in order to focus on the usually business-oriented domain, the one that our users care about. but when our end-users are developers, the domain may well be technical.

from http://cyrille.martraire.com/2009/12/your-crosscuttingconcerns-are-someone-else-core-domai/

Cross-cutting concern Inheritance (object-oriented programming) Java EE Database Scratch (programming language) dev Log4j Persistence (computer science) Middleware

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Simple Guide to Heaps, Stacks, References, and Values in JavaScript
  • Everything I Needed to Know About Observability, I Learned from ‘Bewitched’
  • Exporting and Importing Projects in Eclipse
  • Use Lambda Function URL To Write a Serverless App Backed by DynamoDB

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo