You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
factorial.js is a code of Procedural/Imperative programming style, and uses mutable variables.
factorialRecursive.js is recursive, and can be said functional programming style, immutable. Alghouth this is a typical implementation which I can see everywhere, in terms of "Big O notations". this is rather anti-pattern.
This is as efficient as the factorial.js in terms of "Big O notations", and immutable.
I think when algorithms are presented, it's significantly important to clarify what kind of programming paradigm the algorithms are based on.
Currently, it seems the contributions are updated randomly without formal classification for them, and I think it's a good idea to show a guideline in the README that to clarify which paradigm every algorithm belongs to. In this manner, a contributors notice "oh, here, there is no Functional or Imperative pattern yet, so I will add.."
Thanks.
The text was updated successfully, but these errors were encountered:
What programming paradigms do you mean? I mean how do you suggest to split algorithms in main README? Is it something from https://en.wikipedia.org/wiki/Programming_paradigm like imperative and declarative? Or more detailed like object-oriented, procedural and functional?
Thanks for your response and the great project again @trekhleb .
As you suggest, the classification is another issue to be considered. It's often not easy.
An idea to classify things, especially these days, is not to "split" but to "tag" the algorithms.
One algorithm can be tagged as "#imperative #procedual #object-oriented", another can be "#functional #declarative #lazy-evaluation". Tagging is a good method to express classifications that cross over.
Again, I really think it's not great especially for learners that we put algorithms for a certain target in the same box of mixed programming paradigms without any classifications.
Hi, this is a great project. Thanks.
I have a concern that I would like to share.
For instance, looking at
/algorithms/math/factorial
which is one of the most basic math topic:https://github.com/trekhleb/javascript-algorithms/tree/master/src/algorithms/math/factorial
I found 2 implementations:
factorial.js
factorialRecursive.js
factorial.js
is a code of Procedural/Imperative programming style, and uses mutable variables.factorialRecursive.js
is recursive, and can be said functional programming style, immutable. Alghouth this is a typical implementation which I can see everywhere, in terms of "Big O notations". this is rather anti-pattern.A better or I would say, a proper way is,
factorialFunctional.js
This is as efficient as the
factorial.js
in terms of "Big O notations", and immutable.I think when algorithms are presented, it's significantly important to clarify what kind of programming paradigm the algorithms are based on.
Currently, it seems the contributions are updated randomly without formal classification for them, and I think it's a good idea to show a guideline in the README that to clarify which paradigm every algorithm belongs to. In this manner, a contributors notice "oh, here, there is no Functional or Imperative pattern yet, so I will add.."
Thanks.
The text was updated successfully, but these errors were encountered: