From da9c0e7cc191bb8023256001048799d6aa225ff2 Mon Sep 17 00:00:00 2001 From: Lukasz Skotarek Date: Sun, 9 Jul 2023 13:54:01 +0200 Subject: [PATCH] new note --- _notes/Signals.md | 24 ++++++++++++++++++++++++ _notes/codex vitae.md | 1 + _notes/excuse hydra.md | 1 + _notes/software engineering.md | 1 + _notes/solid for fp.md | 1 + 5 files changed, 28 insertions(+) create mode 100644 _notes/Signals.md diff --git a/_notes/Signals.md b/_notes/Signals.md new file mode 100644 index 0000000..87127ea --- /dev/null +++ b/_notes/Signals.md @@ -0,0 +1,24 @@ +--- +title: Signals +tags: se +--- + +Status: 🌿 + +Signals, as Sandi Metz calls them (not sure if she came up with the name or just passed along) is obvious in hindsight but brilliant programming tool. + +Here examples will describe best what they are, so: + +1. Prime/large numbers - pick arbitrary prime/large number, so it signals insignificance of a number. For example, in tests, you can write 5000 where any other number is not bigger than 10; this is a **signal** for others to not search for a meaning behind a number. Personally, I prefer `0` or large numbers instead of primes, as they are more clear on intent. +2. Strings. Same as with numbers, but there's more flexibility. For example, if I need to pass a user ETH wallet address, but it's irrelevant for testing I will go with `"0xfakeaddress"` - so it's clear that it's there just as it's needed and there's no special meaning. If it was a legit address it could make someone believe it's important. + +Signals can also imply meaning. While I'm yet to find this usecase, Sandi shown this example + +In Ruby code blocks can be in `{ }` or `do end` + +1. code in `do end` has side effects +2. code in `{ }` has no side effects + +*(note that it's not any official standard and it's not enforced by anyone or any tool)* + +This is example of syntax based signal that gives clear understanding of a code (outside tests) to show what's happening even before reading the code in the code block. \ No newline at end of file diff --git a/_notes/codex vitae.md b/_notes/codex vitae.md index a3bbe96..aed207d 100644 --- a/_notes/codex vitae.md +++ b/_notes/codex vitae.md @@ -1,5 +1,6 @@ --- title: Codex Vitae +tag: personal --- Status: 🌱 diff --git a/_notes/excuse hydra.md b/_notes/excuse hydra.md index 32d7e50..d189cee 100644 --- a/_notes/excuse hydra.md +++ b/_notes/excuse hydra.md @@ -1,5 +1,6 @@ --- title: Excuse Hydra +tag: opinions --- Status: 🌱 diff --git a/_notes/software engineering.md b/_notes/software engineering.md index be6d99d..7c1e7b9 100644 --- a/_notes/software engineering.md +++ b/_notes/software engineering.md @@ -5,3 +5,4 @@ title: Software Engineering During my years working with code I stumbled upon stories to share and some thoughts to explore. All of those will be put here [[SOLID for FP]] +[[Signals]] diff --git a/_notes/solid for fp.md b/_notes/solid for fp.md index 9183d49..d738f3c 100644 --- a/_notes/solid for fp.md +++ b/_notes/solid for fp.md @@ -1,5 +1,6 @@ --- title: SOLID for FP +tags: se, fp --- Status: 🌱