An open API service indexing awesome lists of open source software.

https://github.com/heedrox/string-calculator-js

String Calculator kata with Javascript
https://github.com/heedrox/string-calculator-js

Last synced: about 2 months ago
JSON representation

String Calculator kata with Javascript

Awesome Lists containing this project

README

          

# String Calculator (functional js)

This repo practices the String Calculator with functional javascript based on :

http://osherove.com/tdd-kata-1/

It practices and uses concepts from @ggalmazor
twitch at: https://www.twitch.tv/videos/157749121

I saw the video time ago, and now I'm trying to do it myself. Where will I get?

---

Why I do this:

Because I think I know things only when hearing them. But unless I practice them, I do not retain them.

As Confucio says:

_Oigo y olvido.
Veo y recuerdo.
Hago y entiendo_

---

What I did at this point:

- I first saw the video about 2-3 weeks ago.
- I just did the kata myself. I know I have some things I am not applying from the video, and I haven't tried. I will try to apply them after this commit. => v1.0
- I applied the concept of "pipes" => https://vanslaars.io/post/create-pipe-function/ => I realize that there is this little extra effort I cannot apply because of checkNegatives => v2.0
- I check twich video to check how to pipe the checkNegative function (I remember something about R having this)
- I applied the R.tap function => v3.0
- I exported the original class as a function => v4.0
- After @artolamola insight (https://twitter.com/artolamola/status/892090041396342784) => some major refactoring => v5.0

---

Things I learnt / reflected on through this kata:

- importing R into your project (ramdajs)
- pipe function. What its use. When to use.
- R.tap function. - http://ramdajs.com/docs/#tap
- functional programming means exporting functions. Not classes :)
- If not reusing, group functions and dont expose
- Make your functions in your "class" as specific to your domain as possible. Think about tinier common functions as horizontals, and include them from the class. (Thanks @artolamola - https://twitter.com/artolamola/status/892090041396342784)