3 ms·
The code is longer: Without having something like extension methods this might be the case. I'm a C# dev so I'll partially concede here due to ignorance. That p
by darkxanthos 17y ago
The code is longer: Without having something like extension methods this might be the case. I'm a C# dev so I'll partially concede here due to ignorance. That predicate syntax really does suck... it'd be nice if you had lambdas but [shrugs]
The code is slower: It is slower but in my experience it is very rare that our performance bottle necks occur in these sections of code. We have actually profiled our code and changed from for loops in the legacy version to a redesigned version of the class using this more functional approach during refactoring and we can meet our performance needs just fine. More often than not the big performance improvements lie in disk i/o or more intelligent algorithms rather than just a general use of more functional idioms.
Much less clear _for a Java programmer_: Isn't that always the case until programmers start to learn other ways of doing things? If this was just one guy and not what appears to be a industry wide sea-change maybe I wouldn't argue. The functional paradigm however is being given a fair amount of attention and I don't think it's something you can classify as a niche concern.
"cute constructs for their own sake"- I believe the point of developers moving away from loops is that we are starting to realize that explicitly asking the compiler to loop through these items in this particular order is over-specification 99% of the time. Really we are just saying do this to each one of these. By shifting to a functional paradigm these types of tasks can be easily parallelized and abstracted to the point that you really care about.
- deleted 17y ago[deleted]
- swolchok 17y agoHow much power is wasted worldwide by slow code that isn't the bottleneck? Surely, fast habits are better than slow habits, all else being equal.
- darkxanthos 17y agoWhat kind of question is that? Of course fast > slow where all else is equal, the problem is that that isn't the case. I made more than one point regarding the use of FP style where applicable and there's others as well (including maintainability which is a huge money hole). Whether or not you think the performance implications are worth the benefits is a personal, contextual decision. But you just grossly misrepresented the entire point by saying that both styles are equivalent except that one is slower.
- davidmfoley 17y agoHow much power is wasted worldwide by misguided programmers doing premature optimization? All else is never equal.
- troels 17y agoMy CPU's idles most of the time.
- tetha 17y agoMaybe it is just me, but at least to me, a loop and an if (and an accumulating list) is far, far, far simpler (and thus, clearer) than... creating a new anonymous subclass from a templated class with an overriden method and invoking some other method? (at least, I think that's what's going on, I am not sure. A bad sign). And this is not because I don't get filter and functional programming (coming from pythons listcomps, having used haskell and lisp)