Re:Magic is often used to describe confusing code
by hueving on Friday March 25, 2016 @08:47PM
(#11363830)
>Just as with many other tools, they are powerful, and should be used WHEN APPROPRIATE.
You can't work in a vacuum on large projects. To be an effective engineer you have to understand the limitations of your team members. Forgoing map in lieu of a more verbose loop is completely appropriate if you're working with a bunch of junior people that need to maintain and fix bugs in the same codebase.
Re:Magic is often used to describe confusing code
by stickfigure on Saturday March 26, 2016 @03:19AM
(#11364770)
I didn't downvote you, but I'm guessing the reason for your downvotes is that in this day and age, even junior programmers should be expected to understand map. It's such a simple concept that anyone who writes code for a living should be reasonably expected to understand it. If you're on a team with a bunch of programmers and nobody understands map, GTFO. It will not end well.
Re:Magic is often used to describe confusing code
by wtetzner on Saturday March 26, 2016 @10:09AM
(#11365679)
In fact, map is simpler than a loop.
Re:Magic is often used to describe confusing code
by weinzierl on Friday March 25, 2016 @07:06PM
(#11363412)
btuilly probably meant map as in mapreduce not map as in hashmap.
Re:Magic is often used to describe confusing code
by lostcolony on Friday March 25, 2016 @07:58PM
(#11363669)
Btilly rather clearly meant it in the sense of the higher order function (from which mapreduce gets its name), a fact deanCommie clearly grasped.
With maps, for instance, yes generally declarative programming is preferable to imperative programming (http://stackoverflow.com/questions/1784664/what-is-the-diffe...)
However, I've seen monster Java8 stream and C# LINQ statements that would benefit from additional intermediary variables, helper functions, and even cases where loops make things more clear.