On several occasions, I've had a moment when very few lines of code solved an issue I was trying to solve earlier with very complicated or confusin...
For further actions, you may consider blocking this person and/or reporting abuse
Fair point, but I guess this may mislead beginners into thinking that writing a lot of code is wrong or bad practice. Surely, there are cases (like this one), where you can leverage the language's perks, and be able to solve it with a few lines of code, but it is not always the case. I'm not trying to criticize you though, I just want to give a fair warning to beginners reading this. It was a good read, nonetheless. Good work!
You're not wrong, This is more like encouragement to maybe take a few step back whenever things become complicated or confusing and challenge yourself to seek a simpler way.
This is highly depending on the context. Sometimes you'll need "a lot" of code, sometimes you won't. No silver bullet here.
It's hard to get it your code right the first time, so here's what we should really do:
When you write something a bit consequent, you often write a draft first. It's the same for programming.
I agree
Good job showing how to write more readable and robust code by using the right tools for the job 👍 The first version could also be made more readable by defining helper functions to remove all that nesting?
Yeah, but that's will come after the implementation is being figured out completely
I respectfully disagree, I think it's better to write short functions with single responsibilities from the beginning. That makes refactoring a lot simpler and easier to see if the composed function is doing what it should. But that's just my experience 🙂
That's okay
This is why we have Haskell.
Hahaha! I don't know Haskell and I'm sure it'll be overkill for web
For web, there is purescript that very similar with haskell.
Something like this one
🕷 dev.to/epsi/purescript-playing-wit...
That's interesting, thanks for sharing
In this case, less code is indeed simpler; sometimes, more code is simpler. Looking at you bit twiddling over optimized one liners...
It depends on what you are doing at the moment.
🤔️ I never thought of it as clickbait
I personally prefer more code, if it's more explicit and self explanatory with no needed for comments or documentation.