<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: The Seductions of Scala, Part II - Functional Programming</title>
    <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>The Seductions of Scala, Part II - Functional Programming</title>
      <description>&lt;p&gt;&lt;em&gt;A Functional Programming Language for the &lt;span class="caps"&gt;JVM&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;In my &lt;a href="http://blog.objectmentor.com/articles/2008/08/03/the-seductions-of-scala-part-i"&gt;last blog post&lt;/a&gt;, I discussed Scala&amp;#8217;s support for &lt;span class="caps"&gt;OOP&lt;/span&gt; and general improvements compared to Java. In this post, which I&amp;#8217;m posting from &lt;a href="http://www.agile2008.org/"&gt;Agile 2008&lt;/a&gt;, I discuss Scala&amp;#8217;s support for &lt;a href="http://en.wikipedia.org/wiki/Functional_programming"&gt;functional programming&lt;/a&gt; (FP) and why it should be of interest to OO developers.&lt;/p&gt;


	&lt;h3&gt;A Brief Overview of Functional Programming&lt;/h3&gt;


	&lt;p&gt;You might ask, don&amp;#8217;t most programming languages have functions? FP uses the term in the mathematical sense of the word. I hate to bring up bad memories, but you might recall from your school days that when you solved a function like&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
y = sin(x)
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;for &lt;code&gt;y&lt;/code&gt;, given a value of &lt;code&gt;x&lt;/code&gt;, you could input the same value of &lt;code&gt;x&lt;/code&gt; an arbitrary number of times and you would get the same value of &lt;code&gt;y&lt;/code&gt;. This means that &lt;code&gt;sin(x)&lt;/code&gt; has no &lt;em&gt;side effects&lt;/em&gt;. In other words, unlike our &lt;em&gt;imperative&lt;/em&gt; OO or &lt;em&gt;procedural&lt;/em&gt; code, no global or object state gets changed. All the work that a mathematical function does has to be returned in the result.&lt;/p&gt;


	&lt;p&gt;Similarly, the idea of a &lt;em&gt;variable&lt;/em&gt; is a little different than what we&amp;#8217;re used to in &lt;em&gt;imperative&lt;/em&gt; code. While the value of &lt;code&gt;y&lt;/code&gt; will vary with the value of &lt;code&gt;x&lt;/code&gt;, once you have fixed &lt;code&gt;x&lt;/code&gt;, you have also fixed &lt;code&gt;y&lt;/code&gt;. The implication for FP is that &amp;#8220;variables&amp;#8221; are immutable; once assigned, they cannot be changed. I&amp;#8217;ll call such immutable variables &lt;em&gt;value objects&lt;/em&gt;.&lt;/p&gt;


	&lt;p&gt;Now, it would actually be hard for a &amp;#8220;pure&amp;#8221; FP language to have no side effects, ever. I/O would be rather difficult, for example, since the state of the input or output stream changes with each operation. So, in practice, all &amp;#8220;pure&amp;#8221; FP languages provide some mechanisms for breaking the rules in a controlled way.&lt;/p&gt;


	&lt;p&gt;Functions are first-class objects in FP. You can create named or anonymous functions (&lt;em&gt;e.g.&lt;/em&gt;, &lt;em&gt;closures&lt;/em&gt; or &lt;em&gt;blocks&lt;/em&gt;), assign them to variables, pass them as arguments to other functions, &lt;em&gt;etc.&lt;/em&gt; Java doesn&amp;#8217;t support this. You have to create objects that wrap the methods you want to invoke.&lt;/p&gt;


	&lt;p&gt;Functional programs tend to be much more declarative in nature than imperative programs. This is perhaps more obvious in pure FP languages, like Erlang and Haskell, than it is in Scala.&lt;/p&gt;


	&lt;p&gt;For example, the definition of Fibonacci numbers is the following.&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
F(n) = F(n-1) + F(n-2) where F(1)=1 and F(2)=1
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;An here is a complete implementation in Haskell.&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
module Main where 
-- Function f returns the n'th Fibonacci number. 
-- It uses binary recursion. 
f n | n &amp;lt;= 2 = 1 
    | n &amp;gt;  2 = f (n-1) + f (n-2) 
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Without understanding the intricacies of Haskell syntax, you can see that the code closely matches the &amp;#8220;specification&amp;#8221; above it. The &lt;code&gt;f n | ...&lt;/code&gt; syntax defines the function &lt;code&gt;f&lt;/code&gt; taking an argument &lt;code&gt;n&lt;/code&gt; and the two cases of &lt;code&gt;n&lt;/code&gt; values are shown on separate lines, where one case is for &lt;code&gt;n &amp;lt;= 2&lt;/code&gt; and the other case if for &lt;code&gt;n &amp;gt; 2&lt;/code&gt;.&lt;/p&gt;


	&lt;p&gt;The code uses the recursive relationship between different values of the function and the special-case values when &lt;code&gt;n = 1&lt;/code&gt; and &lt;code&gt;n = 2&lt;/code&gt;. The Haskell runtime does the rest of the work.&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s interesting that most &lt;a href="http://www.martinfowler.com/bliki/DomainSpecificLanguage.html"&gt;domain-specific languages&lt;/a&gt; are also declarative in nature. Think of how JMock, EasyMock or Rails&amp;#8217; ActiveRecord code look. The code is more succinct and it lets the &amp;#8220;system&amp;#8221; do most of the heavy lifting.&lt;/p&gt;


	&lt;h3&gt;Functional Programming&amp;#8217;s Benefits for You&lt;/h3&gt;


	&lt;h4&gt;Value Objects and Side-Effect Free Functions&lt;/h4&gt;


	&lt;p&gt;It&amp;#8217;s the immutable variables and side-effect free functions that help solve the &lt;a href="http://www.technologyreview.com/Infotech/17682/page1/"&gt;multicore problem&lt;/a&gt;. Synchronized access to shared state is not required if there is no state to manage. This makes robust concurrent programs far easier to write.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ll discuss concurrency in Scala in my third post. For now, let&amp;#8217;s discuss other ways that FP in Scala helps to improve code, concurrent or not.&lt;/p&gt;


	&lt;p&gt;Value objects are beneficial because you can pass one around without worrying that someone will change it in a way that breaks other users of the object. Value objects aren&amp;#8217;t unique to FP, of course. They have been promoted in &lt;a href="http://domaindrivendesign.org/"&gt;Domain Driven Design&lt;/a&gt; (DDD), for example.&lt;/p&gt;


	&lt;p&gt;Similarly, side-effect free functions are safer to use. There is less risk that a caller will change some state inappropriately. The caller doesn&amp;#8217;t have to worry as much about calling a function. There are fewer surprises and everything of &amp;#8220;consequence&amp;#8221; that the function does is returned to the caller. It&amp;#8217;s easier to keep to the &lt;a href="http://www.objectmentor.com/resources/articles/srp.pdf"&gt;Single Responsibility Principle&lt;/a&gt; when writing side-effect free functions.&lt;/p&gt;


	&lt;p&gt;Of course, you can write side-effect free methods and immutable variables in Java code, but it&amp;#8217;s mostly a matter of discipline; the language doesn&amp;#8217;t give you any enforcement mechanisms.&lt;/p&gt;


	&lt;p&gt;Scala gives you a helpful enforcement mechanism; the ability to declare variables as &lt;code&gt;val&lt;/code&gt;&amp;#8217;s (&lt;em&gt;i.e.,&lt;/em&gt; &amp;#8220;values&amp;#8221;) &lt;em&gt;vs.&lt;/em&gt; &lt;code&gt;var&lt;/code&gt;&amp;#8217;s (&lt;em&gt;i.e.,&lt;/em&gt; &amp;#8220;variables&amp;#8221;, um&amp;#8230; back to the imperative programming sense of the word&amp;#8230;). In fact, &lt;code&gt;val&lt;/code&gt; is the default, where neither is required by the language. Also, the Scala library contains both immutable and mutable collections and it &amp;#8220;encourages&amp;#8221; you to use the immutable collections.&lt;/p&gt;


	&lt;p&gt;However, because Scala combines both &lt;span class="caps"&gt;OOP&lt;/span&gt; and FP, it doesn&amp;#8217;t force FP purity. The upside is that you get to use the approach that best fits the problem you&amp;#8217;re trying to solve. It&amp;#8217;s interesting that some of the Scala library classes expose FP-style interfaces, immutability and side-effect free functions, while using more traditional imperative code to implement them!&lt;/p&gt;


	&lt;h4&gt;Closures and First-Class Functions&lt;/h4&gt;


	&lt;p&gt;True to its functional side, Scala gives you true closures and first-class functions. If you&amp;#8217;re a Groovy or Ruby programmer, you&amp;#8217;re used to the following kind of code.&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
class ExpensiveResource {
    def open(worker: () =&amp;gt; Unit) = {
        try {
            println("Doing expensive initialization")
            worker()
        } finally {
            close()
        }
    }
    def close() = {
        println("Doing expensive cleanup")
    }
}
// Example use:
try {
    (new ExpensiveResource()) open { () =&amp;gt;        // 1
        println("Using Resource")                 // 2
        throw new Exception("Thrown exception")   // 3
    }                                             // 4
} catch {
    case ex: Throwable =&amp;gt; println("Exception caught: "+ex)
}
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Running this code will yield:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
Doing expensive initialization
Using Resource
Doing expensive cleanup
Exception caught: java.lang.Exception: Thrown exception
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;The &lt;code&gt;ExpensiveResource.open&lt;/code&gt; method invokes the user-specified &lt;code&gt;worker&lt;/code&gt; function. The syntax &lt;code&gt;worker: () =&amp;gt; Unit&lt;/code&gt; defines the &lt;code&gt;worker&lt;/code&gt; parameter as a function that takes no arguments and returns nothing (recall that &lt;code&gt;Unit&lt;/code&gt; is the equivalent of &lt;code&gt;void&lt;/code&gt;).&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;ExpensiveResource.open&lt;/code&gt; handles the details of initializing the resource, invoking the worker, and doing the necessary cleanup.&lt;/p&gt;


	&lt;p&gt;The example marked with the comment &lt;code&gt;// 1&lt;/code&gt; creates a new &lt;code&gt;ExpensiveResource&lt;/code&gt;, then calls &lt;code&gt;open&lt;/code&gt;, passing it an anonymous function, called a &lt;em&gt;function literal&lt;/em&gt; in Scala terminology. The function literal is of the form &lt;code&gt;(arg_list_) =&amp;gt; function body&lt;/code&gt; or &lt;code&gt;() =&amp;gt; println(...) ...&lt;/code&gt;, in our case.&lt;/p&gt;


	&lt;p&gt;A special syntax trick is used on this line; if a method takes one argument, you can change expressions of the form &lt;code&gt;object.method(arg)&lt;/code&gt; to &lt;code&gt;object method {arg}&lt;/code&gt;. This syntax is supported to allow user-defined methods to read like control structures (think &lt;code&gt;for&lt;/code&gt; statements &amp;#8211; see the next section). If you&amp;#8217;re familiar with Ruby, the four commented lines read a lot like Ruby syntax for passing blocks to methods.&lt;/p&gt;


	&lt;p&gt;Idioms like this are very important. A library writer can encapsulate all complex, error-prone logic and allow the user to specify only the unique work required in a given situation. For example, How many times have you written code that opened an I/O stream or a database connection, used it, then cleaned up. How many times did you get the idiom &lt;a href="http://blog.objectmentor.com/articles/2008/07/31/always-close-in-a-finally-block"&gt;wrong&lt;/a&gt;, especially the proper cleanup when an exception is thrown? First-class functions allow writers of I/O, database and other resource libraries to do the correct implementation &lt;em&gt;once&lt;/em&gt;, eliminating user error and duplication. Here&amp;#8217;s a rhetorical question I always ask myself:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;How can I make it &lt;strong&gt;impossible&lt;/strong&gt; for the user of this &lt;span class="caps"&gt;API&lt;/span&gt; to fail?&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;h4&gt;Iterations&lt;/h4&gt;


	&lt;p&gt;Iteration through collections, &lt;code&gt;Lists&lt;/code&gt; in particular, is even more common in FP than in imperative languages. Hence, iteration is highly evolved. Consider this example:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
object RequireWordsStartingWithPrefix {
    def main(args: Array[String]) = {
        val prefix = args(0)
        for {
            i &amp;lt;- 1 to (args.length - 1)   // no semicolon
            if args(i).startsWith(prefix)
        } println("args("+i+"): "+args(i))
    }
}
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Compiling this code with &lt;code&gt;scalac&lt;/code&gt; and then running it on the command line with the command&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
scala RequireWordsStartingWithPrefix xx xy1 xx1 yy1 xx2 xy2
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;produces the result&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
args(2): xx1
args(5): xx2
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;The for loop assigns a loop variable &lt;code&gt;i&lt;/code&gt; with each argument, but only if the &lt;code&gt;if&lt;/code&gt; statement is true. Instead of curly braces, the for loop argument list could also be parenthesized, but then each line as shown would have to be separated by a semi-colon, like we&amp;#8217;re used to seeing with Java for loops.&lt;/p&gt;


	&lt;p&gt;We can have an arbitrary number of assignments and conditionals. In fact, it&amp;#8217;s quite common to filter lists:&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
object RequireWordsStartingWithPrefix2 {
    def main(args: Array[String]) = {
        val prefix = args(0)
        args.slice(1, args.length)
            .filter((arg: String) =&amp;gt; arg.startsWith(prefix))
            .foreach((arg: String) =&amp;gt; println("arg: "+arg))
    }
}
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;This version yields the same result. In this case, the args array is sliced (loping off the search prefix), the resulting array is filtered using a function literal and the filtered array is iterated over to print out the matching arguments, again using a function literal.  This version of the algorithm should look familiar to Ruby programmers.&lt;/p&gt;


	&lt;h4&gt;Rolling Your Own &lt;em&gt;Function Objects&lt;/em&gt;&lt;/h4&gt;


	&lt;p&gt;Scala still has to support the constraints of the &lt;span class="caps"&gt;JVM&lt;/span&gt;. As a comment to the first blog post said, the Scala compiler wraps closures and &amp;#8220;bare&amp;#8221; functions in &lt;code&gt;Function&lt;/code&gt; objects. You can also make other objects behave like functions. If your object implements the &lt;code&gt;apply&lt;/code&gt; method, that method will be invoked if you put parentheses with an matching argument list on the object, as in the following example.&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
class HelloFunction {
    def apply() = "hello" 
    def apply(name: String) = "hello "+name
}
val hello = new HelloFunction
println(hello())        // =&amp;gt; "hello" 
println(hello("Dean"))  // =&amp;gt; "hello Dean" 
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;h4&gt;Option, None, Some&amp;#8230;&lt;/h4&gt;


	&lt;p&gt;Null pointer exceptions suck. You can still get them in Scala code, because Scala runs on the &lt;span class="caps"&gt;JVM&lt;/span&gt; and interoperates with Java libraries, but Scala offers a better way.&lt;/p&gt;


	&lt;p&gt;Typically, a reference might be null when there is nothing appropriate to assign to it. Following the conventions in some FP languages, Scala has an &lt;code&gt;Option&lt;/code&gt; type with two subtypes, &lt;code&gt;Some&lt;/code&gt;, which wraps a value, and &lt;code&gt;None&lt;/code&gt;, which is used instead of &lt;code&gt;null&lt;/code&gt;. The following example, which also demonstrates Scala&amp;#8217;s &lt;code&gt;Map&lt;/code&gt; support, shows these types in action.&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
val hotLangs = Map(
    "Scala" -&amp;gt; "Rocks", 
    "Haskell" -&amp;gt; "Ethereal", 
    "Java" -&amp;gt; null)
println(hotLangs.get("Scala"))          // =&amp;gt; Some(Rocks)
println(hotLangs.get("Java"))           // =&amp;gt; Some(null)
println(hotLangs.get("C++"))            // =&amp;gt; None
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Note that &lt;code&gt;Map&lt;/code&gt; stores values in &lt;code&gt;Options&lt;/code&gt; objects, as shown by the &lt;code&gt;println&lt;/code&gt; statements.&lt;/p&gt;


	&lt;p&gt;By the way, those &lt;code&gt;-&amp;gt;&lt;/code&gt; aren&amp;#8217;t special operators; they&amp;#8217;re methods. Like &lt;code&gt;::&lt;/code&gt;, valid method names aren&amp;#8217;t limited to alphanumerics, &lt;code&gt;_&lt;/code&gt;, and &lt;code&gt;$&lt;/code&gt;.&lt;/p&gt;


	&lt;h4&gt;Pattern Matching&lt;/h4&gt;


	&lt;p&gt;The last FP feature I&amp;#8217;ll discuss in this post is pattern matching, which is exploited more fully in FP languages than in imperative languages.&lt;/p&gt;


	&lt;p&gt;Using our previous definition of &lt;code&gt;hotLangs&lt;/code&gt;, here&amp;#8217;s how you might use matching.&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
def show(key: String) = {
    val value: Option[String] = hotLangs.get(key)
    value match {
        case Some(x) =&amp;gt; x
        case None =&amp;gt; "No hotness found" 
    }
}
println(show("Scala"))  // =&amp;gt; "Rocks" 
println(show("Java"))   // =&amp;gt; "null" 
println(show("C++"))    // =&amp;gt; "No hotness found" 
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;The first &lt;code&gt;case&lt;/code&gt; statement, &lt;code&gt;case Some(x) =&amp;gt; x&lt;/code&gt;, says &amp;#8220;if the &lt;code&gt;value&lt;/code&gt; I&amp;#8217;m matching against is a &lt;code&gt;Some&lt;/code&gt; that could be constructed with the &lt;code&gt;Some[+String](x: A)&lt;/code&gt; constructor, then return the &lt;code&gt;x&lt;/code&gt;, the thing the &lt;code&gt;Some&lt;/code&gt; contains.&amp;#8221; Okay, there&amp;#8217;s a lot going on here, so more background information is in order.&lt;/p&gt;


	&lt;p&gt;In Scala, like Ruby and other languages, the last value computed in a function is returned by it. Also, almost everything returns a value, including &lt;code&gt;match&lt;/code&gt; statements, so when the &lt;code&gt;Some(x) =&amp;gt; x&lt;/code&gt; case is chosen, &lt;code&gt;x&lt;/code&gt; is returned by the &lt;code&gt;match&lt;/code&gt; and hence by the function.&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;Some&lt;/code&gt; is a generic class and the &lt;code&gt;show&lt;/code&gt; function returns a &lt;code&gt;String&lt;/code&gt;, so the match is to &lt;code&gt;Some[+String]&lt;/code&gt;. The &lt;code&gt;+&lt;/code&gt; in the &lt;code&gt;+String&lt;/code&gt; expression is analogous to Java&amp;#8217;s &lt;code&gt;extends&lt;/code&gt;, &lt;em&gt;i.e.,&lt;/em&gt; &lt;code&gt;&amp;lt;? extends String&amp;gt;&lt;/code&gt;. Capiche?&lt;/p&gt;


	&lt;p&gt;Idioms like &lt;code&gt;case Some(x) =&amp;gt; x&lt;/code&gt; are called &lt;em&gt;extractors&lt;/em&gt; in Scala and are used a lot in Scala, as well as in FP, in general. Here&amp;#8217;s another example using Lists and our friend &lt;code&gt;::&lt;/code&gt;, the &amp;#8220;cons&amp;#8221; operator.&lt;/p&gt;


&lt;pre&gt;
    &lt;code&gt;
def countScalas(list: List[String]): Int = {
    list match {
        case "Scala" :: tail =&amp;gt; countScalas(tail) + 1
        case _ :: tail       =&amp;gt; countScalas(tail)
        case Nil             =&amp;gt; 0
    }
}
val langs = List("Scala", "Java", "C++", "Scala", "Python", "Ruby")
val count = countScalas(langs)
println(count)    // =&amp;gt; 2
    &lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;We&amp;#8217;re counting the number of occurrences of &amp;#8220;Scala&amp;#8221; in a list of strings, using matching and recursion and no explicit iteration.  An expression of the form &lt;code&gt;head :: tail&lt;/code&gt; applied to a list returns the first element set as the &lt;code&gt;head&lt;/code&gt; variable and the rest of the list set as the &lt;code&gt;tail&lt;/code&gt; variable. In our case, the first &lt;code&gt;case&lt;/code&gt; statement looks for the particular case where the head equals &lt;code&gt;Scala&lt;/code&gt;. The second &lt;code&gt;case&lt;/code&gt; matches all lists, except for the empty list (&lt;code&gt;Nil&lt;/code&gt;). Since matches are eager, the first &lt;code&gt;case&lt;/code&gt; will always pick out the &lt;code&gt;List("Scala", ...)&lt;/code&gt; case first. Note that in the second &lt;code&gt;case&lt;/code&gt;, we don&amp;#8217;t actually care about the value, so we use the placeholder &lt;code&gt;_&lt;/code&gt;. Both the first and second &lt;code&gt;case&lt;/code&gt;&amp;#8217;s call &lt;code&gt;countScalas&lt;/code&gt; recursively.&lt;/p&gt;


	&lt;p&gt;Pattern matching like this is powerful, yet succinct and elegant. We&amp;#8217;ll see more examples of matching in the next blog post on concurrency using message passing.&lt;/p&gt;


	&lt;h2&gt;Recap of Scala&amp;#8217;s Functional Programming&lt;/h2&gt;


	&lt;p&gt;I&amp;#8217;ve just touched the tip of the iceberg concerning functional programming (and I hope I got all the details right!). Hopefully, you can begin to see why we&amp;#8217;ve overlooked FP for too long!&lt;/p&gt;


	&lt;p&gt;In my last post, I&amp;#8217;ll wrap up with a look at Scala&amp;#8217;s approach to concurrency, the Actor model of message passing.&lt;/p&gt;</description>
      <pubDate>Tue, 05 Aug 2008 20:32:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e80aea1f-2ab7-41fa-b431-8d7a5a29c6ed</guid>
      <author>Dean Wampler</author>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming</link>
      <category>Dean's Deprecations</category>
      <category>Design Principles</category>
      <category>Clean Code</category>
      <category>functional</category>
      <category>objects</category>
      <category>FP</category>
      <category>OOP</category>
      <category>Scala</category>
      <category>Java</category>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by short term stay singapore</title>
      <description>&lt;p&gt;I wanted saying thanks to you just for this excellent read!! I definitely loved every amount of it. I&amp;#8217;ve got you bookmarked your web blog to look into the latest belongings you post.&lt;/p&gt;</description>
      <pubDate>Wed, 08 Feb 2012 05:30:47 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:bee0f6e3-9df7-419e-a661-78fede8de50c</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-202347</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by restaurants in savannah ga</title>
      <description>&lt;p&gt;Liked the book that is nice!
&lt;a href="http://www.restaurantsinsavannahga.org/" rel="nofollow"&gt;restaurants in savannah ga&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 30 Jan 2012 12:56:45 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:eb5a9713-74c6-435c-918f-9ed2d2685c59</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-200272</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by most fuel efficient suv</title>
      <description>&lt;p&gt;There is a new concept of SUV which is put forward &lt;a href="http://www.mostfuelefficientsuv.info/nissan-pathfinder-concept-most-fuel-efficient-suv/" rel="nofollow"&gt;Nissan Pathfinder Concept | Most Fuel Efficient SUV&lt;/a&gt; 
Smaller vans, whilst extremely beneficial, lack the gait style virtually all &lt;a href="http://en.wikipedia.org/wiki/Sport_utility_vehicle" rel="nofollow"&gt;SUVs&lt;/a&gt;, at the same time characteristically far more fuel-efficient, have yet to replicate the requesting view of the highway found in any kind of Sports utility vehicle.&lt;/p&gt;</description>
      <pubDate>Sat, 14 Jan 2012 01:32:13 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:cb0a6345-d385-4b2a-b11a-018068307c70</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-197787</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Martin Roscoe</title>
      <description>&lt;p&gt;Thank you the wonderful post&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://f1hybrids.com/bengal-cat-breed/" rel="nofollow"&gt;&lt;b&gt;bengal cats&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 30 Dec 2011 04:45:16 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:aa5e34a2-ff25-49a4-b75c-2c5a52674e52</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-193683</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Martin Roscoe</title>
      <description>&lt;p&gt;India Export Import Business trading company is providing &lt;a href="http://www.indiaexport-import.com/" rel="nofollow"&gt;&lt;b&gt;indian exporters&lt;/b&gt;&lt;/a&gt; and &lt;a href="http://www.indiaexport-import.com/" rel="nofollow"&gt;&lt;b&gt;indian importers&lt;/b&gt;&lt;/a&gt;, india garment, handicraft, jewellery, food, furniture, gifts exporters list. India Export Import business Directory, manufactures,trade leads and much more products are available for buy and sell.&lt;/p&gt;</description>
      <pubDate>Fri, 30 Dec 2011 04:39:45 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:a1c79211-672d-4060-a96b-26cc13676982</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-193682</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Breguet watches</title>
      <description>&lt;p&gt;that whether&lt;/p&gt;</description>
      <pubDate>Fri, 23 Dec 2011 21:20:30 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:df9f6964-8570-49e0-aa2a-efddfcaedd8a</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-190983</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Psychics</title>
      <description>&lt;p&gt;Thank you for your informative post.I know a little bit about functional programming.This blog is very helpful.Plaease update the content.&lt;/p&gt;</description>
      <pubDate>Fri, 23 Dec 2011 04:41:10 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:bb68b4f0-c2b8-4c72-a9ac-2a6ea8fe9910</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-190756</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by satibo online</title>
      <description>&lt;p&gt;satibo online:http://www.naturalpills2u.com/satibo.html
Wodibo:http://www.naturalpills2u.com/wodibocapsule.html
sex medicine:http://www.naturalpills2u.com/
vigrx:http://www.naturalpills2u.com/vigrx.html
sex medicine online:http://www.naturalpills2u.com/&lt;/p&gt;</description>
      <pubDate>Tue, 13 Dec 2011 03:45:48 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:fe132d42-9fdb-4826-ad39-b5dd4b80a390</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-185963</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by ??</title>
      <description>&lt;p&gt;???: &lt;a href="http://www.86and81.com/Energy.html" rel="nofollow"&gt;http://www.86and81.com/Energy.html&lt;/a&gt;
???: &lt;a href="http://www.86and81.com/product/55.html" rel="nofollow"&gt;http://www.86and81.com/product/55.html&lt;/a&gt;
??: &lt;a href="http://www.86and81.com/Product/189.html" rel="nofollow"&gt;http://www.86and81.com/Product/189.html&lt;/a&gt;
????: &lt;a href="http://www.86and81.com/Product/21.html" rel="nofollow"&gt;http://www.86and81.com/Product/21.html&lt;/a&gt;
??: &lt;a href="http://www.86and81.com/product/393.html" rel="nofollow"&gt;http://www.86and81.com/product/393.html&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 13 Dec 2011 03:45:13 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:15f2872f-dba7-4d5c-b547-bc402c0e8cb2</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-185961</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by ???</title>
      <description>&lt;p&gt;SEX DROPS:http://www.001kanpo.com/product/224.html
K-YJelly???:http://www.001kanpo.com/product/230.html
???:http://www.001kanpo.com/product/224.html
????:http://www.001kanpo.com/product/284.html
?:http://www.001kanpo.com/product/227.html&lt;/p&gt;</description>
      <pubDate>Tue, 13 Dec 2011 03:44:53 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:095daee6-3782-42d6-8262-aafc24088c74</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-185960</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by james dean</title>
      <description>&lt;p&gt;Online Export Import is web based export import company, it provide online data data base of manufactures,Exporters,Importers Suppliers,Buyers products and services providers.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.onlineexportimport.com/" rel="nofollow"&gt;online sellers&lt;/a&gt; | &lt;a href="http://www.onlineexportimport.com/" rel="nofollow"&gt;online buyers&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 07 Dec 2011 06:48:12 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:57d6cade-fc49-40d5-a703-1082f060b82f</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-184222</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by www.downjacketdiscount.com/</title>
      <description>&lt;p&gt;It is good to see the writing can be the thank you&lt;/p&gt;</description>
      <pubDate>Wed, 07 Dec 2011 03:36:34 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:b524284e-0412-4e3d-8757-d6883c0d910d</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-184173</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Louis Vuittion Clothing</title>
      <description>&lt;p&gt;Fendi achieved miraculous repeatedly watch, leather, &lt;a href="http://www.ezpayless.com" rel="nofollow"&gt;http://www.ezpayless.com&lt;/a&gt; leather will become more in recent years women popular choice, often appear in casual clothing,&lt;/p&gt;</description>
      <pubDate>Fri, 25 Nov 2011 06:38:29 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:98d0b06c-0c29-4942-af59-17e7c0a73d0b</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-178055</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Php Web Developers</title>
      <description>&lt;p&gt;Thanks for this post. It Very nice article. It was a very good article. I like it. Thanks for sharing. Ask you to share good article again.&lt;/p&gt;</description>
      <pubDate>Thu, 24 Nov 2011 22:20:08 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:0bda37db-615f-46b7-ab64-41c550ac77cc</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-177792</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by latest news today</title>
      <description>&lt;p&gt;I am really not too familiar with this subject but I do like to visit blogs for layout ideas. You really expanded upon a subject that I usually don&#8217;t care much about and made it very exciting. This is a unique blog that I will take note of. I already bookmarked it for future reference.Thank yo&lt;/p&gt;</description>
      <pubDate>Thu, 24 Nov 2011 12:44:26 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:386a5e51-06df-47ae-af08-9a05a2e5924f</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-177549</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Php Web Developers</title>
      <description>&lt;p&gt;Your blog has some of the most fascinating buy viagra information! I&amp;#8217;ve read several pages here and I just had to comment and let you know that I thought you&amp;#8217;ve been doing a great job here. Keep it up!&lt;/p&gt;</description>
      <pubDate>Thu, 24 Nov 2011 04:47:40 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:2ff8437a-6bff-492f-9451-7779465cafe9</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-177450</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by moroccan oil for hair</title>
      <description>&lt;p&gt;Hi author, The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post.&lt;/p&gt;</description>
      <pubDate>Thu, 17 Nov 2011 02:22:46 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:fa2ce25a-a0bf-494d-9659-cd7fe0ab1b3d</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-174567</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Uniform designer</title>
      <description>&lt;p&gt;Your post is really good providing good information.. I liked it and enjoyed reading it. Keep sharing such important posts.
&lt;a href="http://www.fashionizer.com" rel="nofollow"&gt;Uniform Designer&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 14 Nov 2011 05:31:19 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:cecf2d9f-7806-49ab-be9f-6842bf049a20</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-172553</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by christmas cards</title>
      <description>&lt;p&gt;I am happy when reading your blog with updated information! thanks alot and hope that you will post more site that are related to this site.&lt;/p&gt;</description>
      <pubDate>Fri, 11 Nov 2011 12:43:55 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:432e7164-6fb4-4529-9e77-3eac4b7cee4a</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-171426</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by serviced apartments singapore</title>
      <description>&lt;p&gt;Thanks for this post. It Very nice article. It was a very good article. I like it. Thanks for sharing. Ask you to share good article again.&lt;/p&gt;</description>
      <pubDate>Wed, 09 Nov 2011 05:14:20 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:64a2ff60-635e-4088-b97a-343939427177</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-170510</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by chy</title>
      <description>&lt;p&gt;&lt;a href="http://www.burberrybuy.org" rel="nofollow"&gt;Burberry Outlet&lt;/a&gt; September big AD movie has just been published, they cooperates with models Amber Anderson, Matthew Whitehouse, Edie Campbell and Rob Pryor. The model Matthew Whitehouse appears in Burberry AD movie for the second time. The theme is Burberry Nude Color, which derived from the sexy elements of Burberry New Arrival Women Perfume in the nice 1960s.in &lt;a href="http://www.burberryoutletonline1879.uk.com" rel="nofollow"&gt;Burberry UK&lt;/a&gt; Prorsum September AD movie, men and women models wear in nude color together, it seems that nude element will become the new fashion focus in this year. The nude color lambs coats wore by models, looks so elegant and exquisite. Burberry offers platform for designers to show literary or artistic talent as always, and combine itself with British artists, weather and music.This season, Burberry Nude Collection is iconic Women Capsule Collection, the clothing are?&lt;a href="http://www.burberrysalesmall.com" rel="nofollow"&gt;Burberry Sale &lt;/a&gt;, the other kinds include Burberry Sunglasses, Burberry Watches, Burberry Bags, Burberry Shoes. The materials includes satins, sateen, silks, cashmere, lace, PU leather, fur, lambs and so on.&lt;/p&gt;</description>
      <pubDate>Wed, 02 Nov 2011 20:29:41 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:bdf2ca67-1f7f-4e58-8481-aeacd5e27b0e</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-166887</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by   S5 Marketing</title>
      <description>&lt;p&gt;&lt;a href="http://twitter.com/s5marketing" rel="nofollow"&gt;  S5 Marketing&lt;/a&gt;I am really in appreciative of your work. Your illustration job is well done. I see your work each week and it is good.&lt;/p&gt;</description>
      <pubDate>Tue, 01 Nov 2011 05:31:45 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d76fbd13-235a-4074-bc3e-a36543d89719</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-166702</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by   S5 Marketing</title>
      <description>&lt;p&gt;I am really in appreciative of your work. Your illustration job is well done. I see your work each week and it is good.&lt;/p&gt;</description>
      <pubDate>Tue, 01 Nov 2011 05:30:41 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:653f9066-3804-4a92-bc56-16b77994a763</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-166701</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Midlands Consulting</title>
      <description>&lt;p&gt;&lt;a href="http://twitter.com/midlandscco" rel="nofollow"&gt;Midlands Consulting&lt;/a&gt;Thank you for sharing this website.&lt;/p&gt;</description>
      <pubDate>Tue, 01 Nov 2011 00:11:20 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:6fbbf751-6b01-4ac4-85d8-f0184a501122</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-166397</link>
    </item>
    <item>
      <title>"The Seductions of Scala, Part II - Functional Programming" by Midlands Consulting</title>
      <description>&lt;p&gt;I really agree that there are numerous reasons to love and hate Apple. It has a lot of advantages and disadvantages. Thanks for this great post.&lt;/p&gt;</description>
      <pubDate>Tue, 01 Nov 2011 00:06:33 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:866ec330-d895-4725-a548-87eeb581396f</guid>
      <link>http://blog.objectmentor.com/articles/2008/08/05/the-seductions-of-scala-part-ii-functional-programming#comment-166396</link>
    </item>
  </channel>
</rss>

