5 ms·
TL;DR author provides an example of map, filter and reduce functions in JS. I have been wondering lately what is the value of articles like this. They do not c
by arkadiytehgraet 9y ago
TL;DR author provides an example of map, filter and reduce functions in JS.
I have been wondering lately what is the value of articles like this. They do not convey any meaningful idea, they do not offer any useful insight on underlying matters; why do people even write something like this, except to litter the Internet even more?
Anyone, who is distinctly familiar with functional programming or even just with the concept of higher order functions, surely knows those three basic primitives; those, who are not, would benefit much more from the basic concepts of first-class functions etc, than this random abrupt post.
- nxsynonym 9y agoWhile it may not be valuable to the vast majority of people, it was probably valuable to the author at least. The article is not ground breaking or even front page worthy, but that doesn't mean it's the litter of the Internet. At absolute worst it's an exercise in thinking about a subject and trying to explain it to others.
- Blackstone4 9y agoFrom my comment below: "Thank you for this! I've been learning JS for React and .reduce, .every and .some are new to me! Super helpful" I feel like learning is always easier in smaller bitesizes and the person wrote something very clear and digestible. Sounds like it wasn't aimed at more advanced programmers like yourself
- such_a_casual 9y agoThe blog post has tremendous value to the right audience, no doubt about that. But it's worse than worthless for its actual target audience because the article makes those people feel like they're supposed to get it, and they probably feel shitty when they don't (I did). Even though they shouldn't. No one expects you to read that blog post and get it if you've never used Map or Reduce before. It's misleading and disheartening to the target audience. It's a pretty easy fix. Just change who you're talking to.
- brudgers 9y agoWhen I discovered Array.map, I already knew about map/filter/reduce. The reason it was a discovery is that the bulk of Javascript resources used for(){} loops and in those few places where map/filter/reduce were used, many implemented map/filter/reduce as library functions because Array.map etc were not always part of Javascript...I think Mozilla added them at some point based on how I found out about them.
- brudgers 9y agoThe future is already here -- it's just not very evenly distributed. When I first started reading Hacker News, I had never heard of functional programming...or Python.
- kaishiro 9y agoMan, I had just worked up the nerve to start a personal dev blog but you've just scared me straight off.
- pryelluw 9y agoDont let idiots scare you away. Go ahead and do it. If you meed help ping me (check profile).
- bshimmin 9y agoYou should do it, even if it's just for your own benefit! (It's unlikely it'll benefit arkadiytehgraet, but he probably finds that with a great many things.)
- lgas 9y agoWho cares what other people think? Do what you want.
- mattferderer 9y agoI highly encourage you to start a blog for yourself, not for any assumed audience. You'll gain important skills. * Better understanding the topic by trying to re-teach it * Improve writing skills. Programming is basically writing but with even crazier grammar freaks. * Employers interested in possibly hiring you will have a better idea of what you know & enjoy * Provide yourself (and possibly your company) with documentation for the future. Lastly if you need encouragement by someone more established than me, here's Troy Hunt at NDC Oslo 2017 - https://www.youtube.com/watch?v=-MUhcgXBj_A https://www.youtube.com/watch?v=-MUhcgXBj_A
- arkadiytehgraet 9y agoI have wanted to start a personal dev blog myself for quite a while, but each time I think of a suitable topic, I immediately recall an article or a post that is already better than anything I could write myself on the matter. If you think you have something valuable or interesting or just funny to share, that either was never discussed or written about or you know you can do better, then you absolutely should blog about it and do not let haters like me stop you. As for the original article: * It should have been named just "JavaScript arrays and higher-order functions" (I get that using term functional programming is very catchy nowadays, but I am trying to talk about quality here, not clickbaitness) * As it is aimed for people unfamiliar with the concept and coming from more imperative background, where first-class functions are either not present or not that popular or handy to work with, an introduction (even the most gentle one) would be very suitable * Then the introduction of filter/map/reduce functions would be in place, ideally compared in place with imperative implementation of the same task * The best way to make sure a reader understands how each of this functions works is to make them implement each one of them, even the naive implementation would suffice * Finally, you could provide some reasonably unobvious usages of any of the functions, e.g. insertion sort done with fold-only.
- such_a_casual 9y agoI'm sorry to say that I completely agree. As a "here's how you do X in javascript" this is a great post. However, the conclusion clearly shows that this post was not aimed at people who already know how to use map and reduce: "Functional programming is a great tool and will drastically improve your productivity...." It's like someone showing you multiplication and saying. See look how useful it is! See look how simple and easy it is to understand! I still don't know multiplication, or even addition for that matter. Map and reduce are things you build up to by doing recursive functions over and over again. They are not something you learn from reading an article. Just like you can't read an article and suddenly know how to solve problems with long division.
- acdha 9y agoSomeone on the internet wrote something but you don't like it. The appropriate reaction is to be quiet and go read something else. Slagging the author for giving something to the world for free doesn't help anyone and it's almost certainly going to discourage the sharing which everyone on the internet has benefited from.
- johnstew 9y agoI'm not sure why you feel the need to bash this person. If you already know the concepts then go read something else. Instead you took the time to write this shitty comment. This may not provide value to you and thats completely fine. This does however provide a lot of value to the author and to others. Writing technical thoughts in a way that is simple and understandable is a skill and I think this author did a great job of that. Also its the internet I can write posts for myself all day long and guess what? Ain't shit you can do about it. I'll keep littering the internet with these "random abrupt posts".
- cx1000 9y agoAnd yet here it is, upvoted, clicked, and commented on by enough people to make it to the front page of a highly competitive news aggregator. It's easy to forget what it's like to not know something I guess, but clearly there are enough beginners still out there who find this type of post useful.
- yen223 9y agoWhat's the value of comments like this?
- roboguy12 9y agoHere's an example of why it's useful for me to see articles like this on HN. I'm an engineering manager, and someone on my team recently joined who wasn't very familiar with these more functional styles. I offered to explain to him benefits of declarative styles like this vs imperative, but he said he learned better by reading. He asked if I had any articles that I'd recommend about the topic, and since I've seen this, I'll send it his way.