GithubHelp home page GithubHelp logo

fongx777 / hotel-booking-ddd Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 6.0 820 KB

hotel booking app using ddd and clean architeucture to implement

TypeScript 75.22% JavaScript 0.21% Gherkin 24.58%
clean-architecture hotel-booking user-story miro event-storming typescript

hotel-booking-ddd's Introduction

Hotel Booling DDD

Build Status

A hotel room booking app which is implemented under the principle of Domain-Driven Design. Also we used some tools such as user story mapping, specification by example, and event storming to help us model the domain.

Tools

Use case exploration:

  • User Story Mapping: build a big picture and general use cases
  • Specification by Example: for each user story, specification by example helps elaborate business logic
  • Event Stroming:

Development Methodology:

  • Test-Driven Design
  • Behavior-Driven Design
  • Domain-Driven Design

Development Framework and tools:

  • ExpressJS: nodeJS http framework
  • TypeScript: a typed superset of JavaScript that compiles to plain JavaScript
  • Jest: testing framework
  • CircleCI
  • ESlint

Methodology

Entity Pattern Rules

  1. all private properties
  2. public getters & private setters
  3. behavior-driven

(o) a.updateInfo(name, ..,,.., ...); (x) a.setXXX();

Why used props ?

it is just a simple way to avoid tons of this assignment

Design Notes

Controller and Persenters

http://www.plainionist.net/Implementing-Clean-Architecture-Controller-Presenter/ https://crosp.net/blog/software-architecture/clean-architecture-part-2-the-clean-architecture/

img

External Packages

At first, I put all external npm modules in src/booking/infrastructure/, and they all implemnt interfaces from src/booking/usecase/.

for example, if I want to use bcrypt packages, first I would declare an interface: src/booking/usecase/infrastructure/i-bcrypt, then create src/booking/infrastructure/bcrypt to implemnt the interface.

After that, I can injection the bcrypt dependency into usecase constructor to avoid violate the direction of dependency; however, it doesn't worth taking so much time for a single utiliy.

The advantage is obvious, but here are disadvantages:

  1. Hard to used by other bounded context.
  2. Too much work for a simple utility.
  3. Make constructor too complicated to use (more parameters)

Reference

hotel-booking-ddd's People

Contributors

fongx777 avatar hankle10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hotel-booking-ddd's Issues

Style Decision: Use Case or Application Service?

In my thoughts, use case 好處是易懂,且不會跟 domain service 搞混,缺點是要建立一個 use case 建立一個檔案。

Application service 好處是不必被 domain aggregate object 給影響 (不會受限於要用 booking, room, customer 做分類)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.