Skip to content

Instantly share code, notes, and snippets.

@scokmen
scokmen / HttpStatusCode.ts
Created April 25, 2017 11:10
Typescript Http Status Codes Enum
"use strict";
/**
* Hypertext Transfer Protocol (HTTP) response status codes.
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
*/
enum HttpStatusCode {
/**
* The server has received the request headers and the client should proceed to send the request body
@Hamzali
Hamzali / safeobj.js
Last active June 8, 2018 13:37
Node - SafeObject
class SafeObject {
constructor(mainObject) {
this.mainObject = mainObject;
this.configs = {
get: SafeObject.get.bind(this)
}
}
static get (target, prop) {
if (prop in target) {
@Yengas
Yengas / 01-Examples.md
Last active August 23, 2023 21:05
Examples in Implementing Domain Driven Design

Chapter 1 - Getting Started with DDD

BacklogItem is modeled two different ways. First one is the anemic model where we only have getters and setters on the BacklogItem. Making it pretty much the "domain" version of the database model we have in our minds.

The second one is a richer BacklogItem that has logic to uncommit / commit to a new sprint. E.g. All of the logics related to "committing to a sprint" are put into the BacklogItem's #commitTo. Creating high cohesion. BacklogItem emits an event after comitting to the sprint. This way other actors in the same/different bounded context can be notified of the changes.

Private/Protected methods + different #uncommitFrom are highlighted to show how they are helpful to implement #commitTo and other usecases.

Chapter 2 - Domains, Subdomains, and Bounded Contexts

"When a user is browsing the Catalog, Customer means one thing, but when a user is placing an Order, it means something else." Each domain expert things of something else.