Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
SomeNone7115y> ... 200 lines of code
Which most likely merit being refactored into several subfunctions. -
hack64145yBeen there, refactored much. The concept that prevents this called guard clauses. Explain it and send a mail to yor co-workers about it like I did. Some sources about it:
https://medium.com/@scadge/...
https://refactoring.com/catalog/... -
@SomeNone completely agree, you wouldn't believe how many .forEach were actually .map in disguise, O(n^2) lookups which could be just O(n) etc..
-
To be fair this IS failing asap :) the failure is just 1 branch away ;)
readability is another thing -
Interesting, I have co-worker that thinks otherwise 😝 They feel likely to seeing flow in spaghetti-nested logic rather than, once and for all, understand that the reason for further code execution lies behind top listed conditions that were not met and thus did not return.
Though that argument can go long, as brackets placing, or tabs vs. spaces, etc.
When the fuck will people learn to handle errors as soon as possible and return early? I have been reading the some code all day and the amount of nested:
```
if(okay) {
... 200 lines of code
} else {
throw
}
```
is frustrating. the indentation is sometimes 6-7 tabs deep...
rant
javascript