7 ms·
I know my reason for not wanting to develop in Java is that since for the most part the speed difference doesn't matter for my needs, it boils down to how easil
by kbenson 14y ago
I know my reason for not wanting to develop in Java is that since for the most part the speed difference doesn't matter for my needs, it boils down to how easily I can transcribe/translate my concepts into code.
The conceptual impedance of Java is just higher for me. I think most of the code I write (the non-algorithm complex stuff) that boils down to stuff like "take the subset of the collection of orders with a total over 100, and sort by number of items." In Perl, that may be as simple as:
my @large_orders = sort { $a->{items} <=> $b->{items} } grep { $_->{total} } @orders;
I think allowing me to express myself easily and succinctly like this saves time, reduces errors and allows me to concentrate my time and attention on the more complex portions of the code.
I also think succinctness (where idiomatic for the language, so it's not confusing) is useful in it's own right. The more of the current (or related) function and program state that's obvious on the screen when I'm coding, the less likely I am to have to break off from what I'm doing to go look up a detail I need.
- zimpenfish 14y agoNot a great advert for Perl, that, since it doesn't implement the quoted action correctly...
- kbenson 14y agoD'oh! You're totally right, I forgot the greater than filter in the grep. my @large_orders = sort { $a->{items} <=> $b->{items} } grep { $_->{total} > 100 } @orders; Embarrassing.
- prakashk 14y agoBecause `> 100` is missing from the condition? Other than an example of poor copy-pasting of code, how do you conclude that it is "[n]ot a great advert for Perl"? For the record, this would be the code with missing part included: my @large_orders = sort { $a->{items} <=> $b->{items} } grep { $_->{total} > 100 } @orders;
- zimpenfish 14y agoIt might lead someone to conclude that Perl users were slapdash in their approach and prone to tossing off untested code. Possibly unreasonably, possibly not.