On Tue, Jul 13, 2010 at 10:59, Kevin Wright <[email protected]> wrote: > Having IDEs write boilerplate for you is NEVER the correct solution, not > until they can read it for you as well.
I think there is a difference between boilerplate and meaningful variable and function names! > The cost of writing code is trivial > compared to reading, understanding and maintaining it. Eye-tracking studies > and other research have clearly shown that the time taken to understand an > algorithm is directly proportional to how large it is, both in LOC and in > the length of those lines. "Eye-tracking studies" - this already implies that the study can't deliver a full picture of the situation. As if staring out of the window means, I do understand more easily. :) - Oh yes, of course that could help sometimes. I doubt, that a study could bring a really adequate result for such a difficult issue that IMHO can't really be measured. > The classic example in Java is > Map m = new HashMap > Which allows you to change the exact type of Map you use at some later point > in time. > But... this is just a hack to work around the lack of type inference. Now > consider scala: > val myCoolClass = new MyCoolClass > val myCoolClass = new MyCustomCoolClass I prefer the explicit definition of variables - IMHO reduces potential bugs. You could say, this is boilerplate, I find it increases readability, make the code easier to understand (there is the intention of the developer clearly documented). > 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. Imagine a school boy learning the language. I mean, I wrote my first program, when I was about 8 years old using BASIC. Think, that Basic is still a very well established language - because it can be even learned by a 8-years-old... -- Martin Wildam -- 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.
