Made maximum subarray solution more terse#160
Conversation
Codecov Report
@@ Coverage Diff @@
## master #160 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 121 121
Lines 2335 2317 -18
Branches 396 393 -3
=====================================
- Hits 2335 2317 -18
Continue to review full report at Codecov.
|
appleJax
left a comment
There was a problem hiding this comment.
Hey @Bruce-Feldman, nice js-jutsu! You've certainly succeeded in tersify-ing the maxSubarray algorithm.
The problem with merging commits like this, though, is that there are a lot of concepts in your code that are nuanced and require implicit javascript knowledge with no explanation. Even though your code removes 43 lines, it actually takes longer to read than the original, and it is very easy to misinterpret.
Code is meant primarily for other humans to read and understand. As such, the goal should be ease of understanding, and not minimum number of characters. Dense code takes up more of a developer's time, whether you're trying to grok it for the first time, debug an issue, or reacquaint yourself with code you haven't seen recently.
I agree with you though, that the original code could be simpler. I submitted an alternate PR #189 to give you a concrete example of what I'm trying to say. Of course no code is perfect, but I made an explicit effort to make it easy to understand.
Thanks for contributing to open source, and keep up the work! I hope you take this advice the right way, you are obviously skilled at javascript.
Used standard javascript array functionality to condense implementation