Domain Modeling – Offerings vs. Usages

I have a question about an issue I always seem to run into when building a domain model. The issue comes up whenever a domain object is used in what I am calling an “offering” scenario and in a “usage” scenario. For example, let’s take a small school.

This school offers programs of study. Each program requires that a student enroll in and complete a certain number of classess of a certain type. In other words, one program may require 2 “general education” type classess, and one “math” type coruse. Here is the domain model for this:

This is all fine so far. Now, let’s consider the student enrolling in this program. The student has the option to select from 2 “general education” classess and one “math” class. Once these classes are selected they need to be associated with the program the student is enrolled in. Here is a domain model for this:

Both of these domain models seem fine. However, when you add them together you get something that is not clear at all. You get the following:

This is confusing because you cannot tell what relationships apply to which scenario (the “offering” or the “usage”, in other words, the offered programs and the ones that a student has enrolled in). It looks like programs that the school offers might already have selected classes. Alternatively you might think that even after a student is enrolled in a class there are still class options.

Is there a general way to deal with this issue? I find that it presents itself in most businesses and therefore software projects. Are there domain modeling “patterns” for things like this?

Thanks for any help that can be provided.

0

Actually, you discovered what Fowler would probably call a Bounded Context – the idea of splitting one domain model into two different sub-models, one for the “class options” and one for the students’ choices.

Just take your third model as a blueprint for your database schema, and keep the other two models as part of the spec. Or try to draw some fences around your objects like this:

2

In addition to what Doc Brown mentioned regarding Bounded Contexts, you might want to consider that you’re colluding two different events regarding the student. They enroll in a program, but the selection of a class does not flow through the program itself. That is, You have a ProgramEnrollment for a Student and there is a separate concept of a ClassEnrollment for the Student. The Program defines a set of required courses or categories of courses that the student can select from but the enrollment is separate from the program itself.

3

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật