5 ms·
> Imperative programming is a programming paradigm that uses a sequence of statements to reach a certain goal. It focuses on how to perform actions to achieve t
by kowdermeister 10y ago
> Imperative programming is a programming paradigm that uses a sequence of statements to reach a certain goal. It focuses on how to perform actions to achieve the expected result.
But, but, but... I live my life like that. I focus on the next action to achieve my goal.
The two examples remind me a bad TV shop advert starting with the black and white trash old way of doing things.
The problem with these articles is that they are often biased towards one side which is often FP, because impreative programming is not sexy.
I'm not saying that FP is bad or inferior :) It just has its places and I still have to read an article which clearly states good use cases for FP rather then selling it me as a religion.
- bepitulaz 10y agoBut...but...my life is like that macromanager Lol. Don't worry, sometimes I'm also doing micromanaging. I'm not trying to tell imperative is bad, because I'm still using it when I feel FP is not efficient. I wrote that article to introduce FP to anyone who wants broaden their knowledge. By knowing another paradigm, we will get the right tools for the right jobs, right?
- kowdermeister 10y agoThe micro/macromanager analogy is flawed IMHO. I can write modular, component based code imperative style. It won't be worse than please().do().this().for(me) > I'm not trying to tell imperative is bad "In another word, the imperative one is an annoying micromanager" ;) > By knowing another paradigm, we will get the right tools for the right jobs, right? Yes, if you not only introduce the paradigm, but tell them when it makes sense to use it. I haven't seen it in your article.
- bepitulaz 10y agoHmm...I thought I had told them in the article. > According to sample number 2 above, we will read the loop 4 times to track the current value of sample. Imagine if you have an array with 1000 elements inside it. That is one of that. > ...made our code more concise and also in the summary. Well, I know maybe "concise" is a subjective thing :)
- kowdermeister 10y agoI've read that, but it really depends on the bug. A simple console.log would catch it easily. I think you need debugging skills in FP right? I don't always prefer concise code. It means that I have to keep everything in my head, what the function does exactly. So what I miss is real use cases. Would you write a video editor in FP? Would you make Quake 4 in FP? Is it good for Todo apps? CLI apps maybe? Or is it best for 50 line microservices?
- bepitulaz 10y agoHonestly I did almost anything using FP. Mostly in Clojure and Clojurescript. Btw, is using map, filter, reduce considered as using FP too? I always use it in my Swift and JS code. One of the thing that I can't use FP is in embedded development (arduino and esp8266).
- kowdermeister 10y agoI don't know, you tell me :) I use FP in my imperative code ;)
- bepitulaz 10y agoActually the part 2 will talk about that :)