Skip to content

Instantly share code, notes, and snippets.

@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.

@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) {
@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
@crizstian
crizstian / cinema.microservices.Dockerfile
Last active April 15, 2020 02:15
Example of Dockerfile for a nodejs app
# the first thing we specify in a Dockerfile is the base image.
# This is essentially bare bones alpine linux with node installed.
FROM node:7.5.0-alpine
# Creates a non-root-user.
RUN addgroup -S nupp && adduser -S -g nupp nupp
# Sets the HOME environment variable.
ENV HOME=/home/nupp
@emrekgn
emrekgn / soyisimler
Created December 4, 2015 08:44
Türkçe Soyisim Listesi
ŞEN
KANDEMİR
ÇEVİK
ERKURAN
TÜTEN
ÖZTÜRK
YÜZBAŞIOĞLU
VURAL
YÜCEL
SÖNMEZ
@emrekgn
emrekgn / isimler
Last active April 26, 2024 13:14
Türkçe İsim Listesi
JALE
ALİ
MAHMUT
MANSUR KÜRŞAD
GAMZE
MİRAÇ
YÜCEL
KUBİLAY
HAYATİ
BEDRİYE MÜGE
Security - the elephant in the room. Everyone agrees that it is very important but few takes it seriously. We at RisingStack want you to do it right - this is why we have put together this checklist to help you guide through the must have security checks before your application is enabled to thousands of users/customers.
Most of these items are general and applies to all languages and frameworks not just Node.js - however some of the tools presented are Node.js specific. You should also check our introductory Node.js security blogpost.
Configuration Management
Security HTTP Headers
There are some security-related HTTP headers that your site should set. These headers are:

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@abdullin
abdullin / ddd-in-golang.markdown
Last active October 10, 2023 00:46
DDD in golang

This is my response to an email asking about Domain-Driven Design in golang project.

Thank you for getting in touch. Below you will find my thoughts on how golang works with DDD, changing it. This is merely a perception of how things worked out for us in a single project.

That project has a relatively well-known domain. My colleagues on this project are very knowledgeable, thoughtful and invested in quality design. The story spelled out below is a result of countless hours spent discussing and refining the approach.

Conclusions could be very different, if there was a different project, team or a story-teller.

Short story