• Typescript perfect sync - 3 tricks to keep it tight
    Mini essays,  Code

    Typescript perfect sync – 3 tricks to keep it tight

    Typescript perfect sync can be kept using couple of strategies. Most of us start with simple union types, like this: const ScenarioStatus = 'success' | 'fail' | 'error' | 'other'; So far so good. That works great… until you need to iterate over those values for rendering, validation, or other logic. And now You are stuck with two separate definitions: one array for logic, and one string union for the type. Sooner or later, they’ll fall out of sync and provide headaches to people. You could go for en enum…. Below behold the three TypeScript tricks to make your code tight, hard to break, cleaner, safer, DRYer and resistant to…

    Możliwość komentowania Typescript perfect sync – 3 tricks to keep it tight została wyłączona
  • locality of behaviour
    Code

    Locality of Behaviour

    Locality of Behaviour is a great principle that should help with maintaining the code. This is the characteristic of the code that enables a developer to only read a small portion of code to understand its function. Without the need to skip, skim, read, jump all over multiple files. I love that rule cause it DOES MAKE SENSE. I can see many places where we would benefit from it but not always do it that way because of the 'standard’. Which, in the end, nobody knows what it is anymore cause everyone is mixing patterns, antipatterns and the number one performance metric is how fast you can deliver… maybe i…

Piotr Kowalski