Timeline for Am I too 'clever' to be readable by Jr. devs? Too much functional programming in my JS?
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 19, 2018 at 10:50 | comment | added | Caleth | @OlleHärstedt ?: is just a different spelling of "expression if else" because those names were already taken | |
| Jun 13, 2017 at 16:51 | comment | added | b0nyb0y | @OlleHärstedt Umm, that's an interesting claim you made. The thing is, Functional Programming paradigm, or any paradigm out there, is never tied down to any particular "real" functional language, much less its syntax. Thus, dictating what conditional constructs should be or should "never" be used just doesn't make any sense. A ternary operator is as valid as a regular if statement, whether you like it or not. The readability debate between if-else and ?: camp is never-ending, so I won't get into it. All I will say is, with trained eyes, lines like these are hardly "too tense". | |
| Jun 12, 2017 at 20:15 | comment | added | Olle Härstedt | Sorry, but this code listing is still much less obvious to me than the original "junior code" in OP's post. Basically: Never use ternary operator if you can avoid it. It's too tense. In a "real" functional language, if-statements would be expressions and not statements, and therefore more readable. | |
| Jun 11, 2017 at 17:32 | history | edited | b0nyb0y | CC BY-SA 3.0 | added 11 characters in body |
| Jun 11, 2017 at 9:15 | comment | added | b0nyb0y | @YoTengoUnLCD Ah, good catch. Now you know that me and my team are still on the journey of unlearning some of our lodash use. That code can use spread operator, or even [].concat() if one wants to keep the shape of the code intact. | |
| Jun 11, 2017 at 5:10 | comment | added | YoTengoUnLCD | +1. Just a small pedantic remark, you can use the spread (...) operator instead of _.concat to remove that dependency. | |
| Jun 10, 2017 at 8:24 | comment | added | Giorgio | +1 for pointing out this wide-spread attitude (does not necessarily apply to the OP): "Just because you're using the latest ES6 techniques or using the most popular programming paradigm doesn't necessarily mean that your code is more correct, or that junior's code is wrong.". | |
| Jun 10, 2017 at 5:08 | history | edited | b0nyb0y | CC BY-SA 3.0 | added 152 characters in body |
| Jun 9, 2017 at 19:30 | history | answered | b0nyb0y | CC BY-SA 3.0 |