@AndaristRake I was trying to figure out why I haven't hit this more in Zod
it's because superclass constructors get called before property initializers in the class body, and I use this "def" pattern everywhere
potentially not a bad workaround here
Most coding tutorials teach you to code like a GPS teaches you a city. Following along works fine until there’s a problem and you have to detour.
That’s why people get stuck doing tutorial after tutorial. They aren’t actually learning much.
🔥It's official🔥
👿Evil Apple is back, and it's killing PWAs on iOS for EU users🇪🇺
"To comply with the DMA’s requirements, we had to remove the Home Screen web apps feature in the EU.
-"Very low user adoption of Home Screen web apps"
-"Minimal impact to their functionality"
Wow! AWS released their own JS runtime! The devil is in the details, and this is only tailored to be a runtime for Lambda. I’ll definitely tinker with it!
Instead, why didn’t work to optimize
Node.js and contribute back?
https://t.co/7acFA91JNF https://t.co/RBbZ34Hgfj
WebSocket support is coming to MSW!
But before it does, please help us shape it by providing feedback on this RFC:
📜 https://t.co/yh9gqNOdxt
If you're working with WebSockets, please participate in that discussion! You'd be helping thousands of developers mock APIs better.
One thing people should be more aware of is that crunching and working late for a long period of time has much higher chances of burning you out so hard that you will need to take a long break and loose all career advancement instead of pushing it forward. It will also most likely happen at the most undesirable moment.
Weekends fully off, 1-1,5 week of vacation per quarter can take you much further than crunching all the time without breaks.
When should you code FAIL FAST?
🔥 #ARCHITECTURE#FOCUS 🔥
What FAIL FAST is ❌NOT❌?
💥 #javascript’s NaN: ‘hi mom’ * 5...
💥 why does a platform perform a stupid operation?
💥 why doesn’t it EXPLICITLY notify the developer (by throwing an error)?
FAIL FAST is:
🥊 a design technique (or coding style)
🥊 similar to “strong typing”
where:
🥊 if something MIGHT be incorrect, it FAILs explicitly
🥊 you check your state along as the logic is performed
🥊 as soon as possible
🥊 so that we don’t carry on with an INVALID situation
🥊 and we DON’T WORK AROUND the problem instead of solving it
🧟 same as with mutation testing: kill the mutants! 🧟🧟🧟
🪓 if something doesn’t make sense -> BREAK IT! 🪓
CONSEQUENCES?
🪚 your codebase would throw way more errors 🐛
🪚 you’d have to handle them 👷♂️
🪚 … but you also GET RID OF all invalid/inconsistent states 💪
BTW 🟥FAILING BUILDS 🟥 adapt the 🟥 FAIL FAST 🟥 strategy
🟥 Even if the linter raises an error, you shall not be able to deploy.
Examples of FAIL-FAST:
💣 DON’T ALLOW to create an invalid/inconsistent object
💊 FIX: conditionally throw an error in your constructor, if any data/logic is inconsistent.
💣 if you expect something and don’t get it, FAIL FAST by throwing an error
💊 FIX: #typescript assertion function
💣 Don't rescue your logic by introducing meaningless defaults like #javascript/#typescript “?? []” - WHY IS THE ARRAY NOT THERE IN THE FIRST PLACE?
💊 FIX: if you want an array to be guaranteed somewhere… then f🤬🤬🤬ing GUARANTEE IT 😅
💣 AVOID OPTIONAL PROPERTIES as much as possible. Optional properties multiply number of potential states, where majority of them is usually invalid.
💊 FIX: Introduce a #typescript union instead.
🤮 sidenote: leaky data structures are the worst… 🤮
There’s plenty of space to apply FAIL FAST techniques within your #angular, #react and #vue applications. Just don’t let any doubtful state leak into your logic.
See examples below: