Domain Model


Published on

Some basic definitions of a domain model and its representation in Java (without the Modelibra framework).

1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Domain Model

  1. 1. Domain Model Dzenan Ridjanovic 2009-03-08
  2. 2. Domain Model Domain model is a semantic network of concepts and their relationships in a certain domain. Example of a domain: Education. Example of a model: PersonalLibrary. Example of concepts: Book, Person. Example of a relationship: a person may borrow several books; a book may be lent to a person.
  3. 3. Model Concept A concept often represents an organization, a product, a service, a person, a transaction, a thing, an event, ... A concept may have many entities in a real world. Book is a concept. There may be many books that share the same attributes.
  4. 4. Concept Descriptors A concept has structure (properties, neighbors) and behavior (methods). A concept may have an identifier. An identifier gives a unique identity to each entity of the same concept.
  5. 5. Book Concept Book properties: title, author. Book neighbor: person. Book identifier: title. Book methods: isCataloged, isAvailable, checkOutTo, checkIn, catalog, discard.
  6. 6. Person Concept Person properties: firstName, lastName, maxNumberOfBooks. Person neighbor: books. Person identifier: firstName, lastName. Person methods: isMember, isWithoutBooks, register, unregister.
  7. 7. Concept Property A property is a characteristic of its concept. A property of an entity may be null. A property of an entity usually carries a single value. A property value comes from a type of possible values.
  8. 8. Book Property Book property: title. The title property is a characteristic of the Book concept. A book must have a title. A title of a book carries a text value. A title text comes from String values.
  9. 9. Person Property Person property: maxNumberOfBooks. A maxNumberOfBooks is a characteristic of the Person concept. A person may have a default value for maxNumberOfBooks. A maxNumberOfBooks of a person carries an integer value.
  10. 10. Concept Neighbor A neighbor is a relationship characteristic of its concept. A neighbor of an entity usually references a single entity (parent neighbor) or a collection of entities (child neighbor). A parent neighbor of an entity may be optional (null). A child neighbor may be an empty collection of entities.
  11. 11. Book Neighbor Book neighbor: person. The person neighbor is a relationship characteristic of the Book concept. A book may not be related to a person and in that case is available. A book that references a person is not available.
  12. 12. Person Neighbor Person neighbor: books. The books neighbor is a relationship characteristic of the Person concept. A person may have an empty collection of books.
  13. 13. Entry Concepts Some concepts in a model are declared as entry points to the model. Non-entry concepts are reachable only from entry concepts by following neighbors. Concepts with only child neighbors are good candidates for entry points.
  14. 14. Personal Library Entries Person Book
  15. 15. Personal Library Model
  16. 16. Eclipse Project Eclipse project in the modelibra space at Assembla: modelibra.beginner src: source code test: test code mm: model files
  17. 17. Java Packages One package for model. One package for concepts (for a small model). One package per concept (for larger models).
  18. 18. Java Classes One class for model. Two classes for each concept: Concept, Concepts.
  19. 19. Model Class Create entry points in the model's constructor.
  20. 20. Concept Class First do Concept classes for entry points. Model parent property, properties for parent concepts, properties for child concepts. Create child entities in the concepts's constructor. Private set methods (or not at all) for setting parents or children. Public attach and detach methods for relationships.
  21. 21. Concepts Class Add an entity. Get an entity based on its identifier. Select and order methods.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.