On Tue, Jul 13, 2010 at 14:48, Lyle <[email protected]> wrote:
>> I think there is a difference between boilerplate and meaningful
>> variable and function names!
> There is nothing preventing you from writing meaningful identifiers in
> non-Java languages.
No, but if you choose longer identifier names then using functional
expressions, you get really long expressions, hence people tend to use
short names then when using functional style.
> Is a type somehow more meaningful if you write it twice on the same
> line?
E.g. for the definitions it is not twice the same line.
In the first line you say, "hey this should always contain an item
that is of class X or implements interface X".
Later you really put an item of a particular class into it (which not
necessarily is always X - can also be a subclass or another class
implementing interface X).
>>> You forgot my favourite!
>>> scala: val list2 = list map (_ + 1)
>> A very good example of code that is difficult to read. If you are not
>> into Scala you can't understand. I like languages, where you look at a
>> code example and you understand already without really knowing the
>> language.
> Really? What about that is any harder than an uninitiated person
> grokking Java's for loop syntax?
Indeed the for loop is also not very readable - at least it is c-like
and once you know the c-like loop definitions you can read it in all
languages that use that style.
BTW: Java already allows this:
for (Object object : list)
{
}
which is more readable (although that style has it's limitations - you
can't manipulate the current index).
Believe it or not, having an "easy" readable/learnable/understandable
language helps a lot. Especially in agile development, where you might
have sitting a non-programmer next to you while coding. Only today I
listened to a podcast where such situations happen:
http://techcast.chariotsolutions.com/index.php?post_id=627724
> The underscore requires a guess, but
> if you know what a map function does and have ever used one in any
> language, it's not too great a leap to guess.
It needs more explanation than any short adequate keyword. This is a
reason why so many people hate Perl (me too).
Imagine you need to use different languages, e.g. Python where the
underscore is used for different purposes. You simply mix up things
more easily.
>> Imagine a school boy learning the language. I mean, I
>> wrote my first program, when I was about 8 years old using BASIC.
> That's a fine property to have for a language to teach 8-year-olds,
> but we don't have to restrict language design to what an 8-year-old
> can understand (but here I'm falling for a bit of a straw man - just
> because a language isn't on the "my first language" level does not
> also mean it's needlessly complex). The object oriented paradigm was
> notably absent from the programs you wrote in BASIC, should we resist
> using that as well?
No, of course not. And the object oriented languages I faced first
with about 13 or so - not that difficult for me back then either. For
generics it already was more difficult to get but the point is: The
language should be in general as easy as possible by not doing too
much harm to efficiency (see COBOL which is a good example for
exaggerating the idea of readability - I always thought of writing
english poems when programming in COBOL).
BTW - when talking about English: The English language is a good
example - easy to learn simple in the grammar, limited number of used
characters.
The intensive usage of special characters for example is not something
I consider very good.
--
Martin Wildam
Home: http://sites.google.com/site/mwildam/
Life Hack Blog: http://1-2-solved.blogspot.com
IT Blog: http://it-tactics.blogspot.com
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.