Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made maximum subarray solution more terse #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bruce-Feldman
Copy link
Contributor

Used standard javascript array functionality to condense implementation

@codecov-io
Copy link

Codecov Report

Merging #160 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #160   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         121    121           
  Lines        2335   2317   -18     
  Branches      396    393    -3     
=====================================
- Hits         2335   2317   -18
Impacted Files Coverage Δ
...orithms/sets/maximum-subarray/dpMaximumSubarray.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70ec623...47dff8d. Read the comment docs.

Copy link
Contributor

@appleJax appleJax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants