2011/1/8 Cédric Beust ♔ <[email protected]>
>
>
> On Sat, Jan 8, 2011 at 5:43 AM, Kevin Wright <[email protected]>wrote:
>
>> and a functional style just leads to more inherently testable code
>
>
> Do you seriously believe that?
>
> Actually, ignore my question because you're going to spin into an endless
> Scala rant yet again.
>
> Anyone who thinks that good quality code is a function of a programming
> language or a programming style and not of a good developer hasn't written
> enough code.
>
>
Yes, I do sincerely believe that. Declarative programming tends towards a
style in which code performs a sequence of transformations.
So whereas, in an imperative style, you might see a snippet like this:
for(i <- intList) {
println("doubled entry: " + i*2)
}
A functional approach would be more like:
val doubledList = intList map { _ * 2 }
doubledList foreach { println("doubled entry: " + _) }
Used throughout a system, this approach leads to a lot more "seams"* in the
code, where it's easy to wrap unit tests, or to inspect/log intermediate
results.
Ultimately code quality *is*, in part, a function of programming style.
Which is itself a function of being a good developer.
*(* I thank Michael Feathers for first introducing use of the word "seam" in
this context.)*
--
> Cédric
>
>
> --
> 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]<javaposse%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
--
Kevin Wright
gtalk / msn : [email protected]
<[email protected]>mail: [email protected]
vibe / skype: kev.lee.wright
twitter: @thecoda
--
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.