• 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…

    Comments Off on Typescript perfect sync – 3 tricks to keep it tight
  • Statics VS AI code analysis
    Mini essays,  AI,  Code,  Tech

    Statics VS AI code analysis ~13 tools

    Statics VS AI code analysis works best using the pros from both words. Go hybrid ! Static tools understand the syntext, hardcoded parameters and are very strict. On the other hand AI understands context, can figure out business logic, adapt the codebase. Logic flaws or performance bottlenecks rule-based scanners might miss, AI will put more effort into that. Static analysis limits Static tools scan for syntax errors, style violations, and basic security patterns using fixed rules. Always consistenst, very fast but might generate false positives, ignore business logic, and require manual rule overrides. How often did You use @typescript-error 🙂 Do You code for the linter to pass, logic to…

  • Mini essays

    How to delete code – the story of interface

    How to Delete Code: The Interface Story How to delete code, safely of course, is usually a major problem. Difficult and You always second guess every decision because You don’t know what You don’t know. It is not just hitting the “delete” button. You need to make a smart decision and second guess your solution. How to remove unnecessary code with a focus ? Refactor the code, use interfaces and then test it twice remembering about user experience. TL; DR 😉 Define one interface. Create two implementations – legacy, modern and any other. Unify! Use it in already existing services or create such services by refactoring code. Switch between them…

    Comments Off on How to delete code – the story of interface
  • Lauers Law why less code is better
    Mini essays

    Lauers Law – why less code is better

    Lauers Law – why less code is better as a very solid idea. Just remind Yourself about all those DTOs that could be a simpler one with a mapper or a dedicated if-else-tree somewhere around data transformation. It challenges developers to prioritize efficiency and elegance in their coding practices, ultimately leading to cleaner, easier to understand and more maintainable systems. The Essence of Lauer’s Law At its core, Lauer’s Law emphasizes that reducing the amount of code can lead to better outcomes. The principle suggests that if developers had twice as much time, they could create a system with half the code while maintaining or improving its quality. The idea…

  • How to judge code
    Code,  Mini essays

    How to judge code – part I

    How to judge code is a tricky question. With all the clean code rules, KISS, DRY, YAGNI, SOLDI and so on and so forth one can go crazy and question ones sanity in the end. What i wanted to throw out there is to judge the code be a very simple rule the encompasses multiple different one, is not straightforward and is very flexible. How to judge code ? Judge the code by how easy it is to debug We all know that one person at a company that knows all the quirks and secret sauce of a language, pipes, default interfaces and so on…. that person also knows the…

Piotr Kowalski