Optimizing too much for readability, can't be well worth doing, I think.
It's a contradiction in terms. Watching out for changes that make the
code shorter instead of more readable seems like useful advice and maybe
a sign that I am "optimizing" too much. I'm pretty sure I could figure
out a way to waste time making something insignificantly more readable.
I don't have much of a problem with the abstract idea that good is
better than bad. I have a problem with degrees of goodness. I doubt that
there is a formula to guard against that, but advice like comparing
readability vs.l terseness is what I was looking for.
Kendall
On 10/22/2013 02:42 AM, Niels van Klaveren wrote:
I can imagine this behavior. Unlike premature performance
optimization, readability / terseness are well worth optimizing for
when learning Clojure, as long as you value readability over terseness
to keep well away from code golf territory.
With Clojure, I always have the idea that things could be done in a
simpler way, and usually it can. A lot of what I consider 'draft' code
that works can be cleaned up drastically, and sometimes after cleaning
I still have some niggles. However, with time my 'draft' code tends
to get cleaner and cleaner, and I also see up front where algorithms
and function input / output can be changed to prevent code getting
needlessly complex, and having to handle more exceptions than rules.
While doing 4clojure problems, some of my first attempts were 4 or 5
lines. While this is considered next nothing in Javaland, getting them
down to 1 line, and comparing them to some of the Clojure vets you get
a good feel for what's the idiomatic Clojure way to solve certain
problems. So I guess it's all part of the learning process. I would
not worry about it too much, you can only clean up for readability /
terseness up to a point.
Be sure to stay away from performance optimization unless absolutely
necessary. There's way too many options, and it needs a really good
insight into Clojure's implementation details to do effectively. Most
idiomatic Clojure code performs on par or better compared to other
dynamic languages like Python and Ruby.
On Saturday, October 19, 2013 1:20:33 AM UTC+2, queshaw wrote:
With clojure in particular, I am having trouble not rearranging my
code
to be what I think is more optimal in ways that seem probably not
practical. I've noticed myself doing that when I'm newish to
languages
and apis. But, I go bonkers with clojure.
Do you have any thoughts about how to avoid that, other than Bob
Newhart's advice:
http://www.youtube.com/watch?v=Ow0lr63y4Mw
<http://www.youtube.com/watch?v=Ow0lr63y4Mw>
Kendall
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
ThisIsHardToRead, asIsThis. This_is_easier, unless_it_is_underlined.
This.is.easy. This-is-easy-too. Almost as easy to read as this.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.