Skip to content

Understanding Your Domain

Mehmet Özkaya edited this page Apr 18, 2019 · 9 revisions

Its really important to understand what you will develop and its crucial that defining your use cases. So this run-aspnetcore is a base repository but we are implementing this basement into run-aspnetcore-realworld repository which basically create a e-commerce web application.

This page mostly referring the ZAN KAVTASKIN - Applied Domain-Driven Design (DDD), Part 0 - Requirements and Modelling

Lets analysis e-commerce domain in order to provide our development roadmap.

Requirements and Modelling

  • Identify User Stories
  • Identify the Nouns in the user stories
  • Identify the Verbs in the user stories
  • Put together object interaction diagram
  • Put together object responsibilities diagram
  • Put together class digram UML showing only interesting interactions

So here are made up user stories:

  • As a customer I want to list products
  • As a customer I want to be able to filter products as per brand and categories
  • As a customer I want to see the supplier of product in the product detail screen with all characteristics of product
  • As a customer I want to be able to put products that I want to purchase in to the shopping cart so that I can check out quickly later on
  • As a customer I want to see the total cost all for all of the items that are in my cart so that I see if I can afford to buy everything
  • As a customer I want to see the total cost of each item in the shopping cart so that I can re-check the price for items
  • As a customer I want to be able to specify the address of where all of the products are going to be sent to
  • As a customer I want to be able to add a note to the delivery address so that I can provide special instructions to the postman
  • As a customer I want to be able to specify my credit card information during check out so that I can pay for the items
  • As a customer I want system to tell me how many items are in stock so that I know how many items I can purchase
  • As a customer I want to receive order confirmation email with order number so that I have proof of purchase
  • As a customer I want to list my old orders and order items history
  • As a customer I want to login the system as a user and the system should remember my shopping cart items

Now I am going extract nouns and verbs from the stories above. I am looking for the nouns that will become my main objects and not the attributes.

Nouns:

  • Customer
  • Order
  • Order Details
  • Product
  • Shopping Cart
  • Shopping Cart Items
  • Supplier
  • User
  • Address
  • Brand
  • Category

Verbs:

  • List products applying to paging
  • Filter products by brand, category and supplier
  • See product all information in the details screen
  • Put products in to the shopping cart
  • See total cost for all of the items
  • See total cost for each item
  • Checkout order with purchase steps
  • Specify delivery address
  • Specify delivery note for delivery address
  • Specify credit card information
  • Pay for the items
  • Tell me how many items are in stock
  • Receive order confirmation email
  • List the order and details history
  • Login the system and remember the shopping cart items

By using above nouns and verbs we can put together a diagram such as this:

Conceptual model  - Blog - Object Interaction (1)

Once we have object interaction diagram we can start thinking about object responsibilities. One of the most common mistakes is to push responsibilities on to the actor object i.e. Customer. We need to remember that objects must take care of themselves and objects need to be closed for direct communication and that you need go through the functions to communicate with them.

So let's follow above approach and assign responsibilities:

Conceptual model  - Blog - Object Responsibilities (1)

Now that we have object interaction and responsibilities diagram in place we can start thinking about lower level UML class diagram.

Methods, class names, dependencies, interfaces and compositions should be defined as per conceptual responsibility diagram. And we should define methods the main objects. For example ShoppingCart.cs should have AddItemToCart, GetItem vs.. methods.

So after this analysis we can start coding and develop our model to code. Lets continue..

This page mostly referring the ZAN KAVTASKIN - Applied Domain-Driven Design (DDD), Part 0 - Requirements and Modelling

Clone this wiki locally