Introducing TinyWeb

We’ll start our journey with a look at an example of a program that makes heavy use of classic object-oriented patterns, a small web framework called TinyWeb. After introducing TinyWeb, we’ll see how to rewrite it in a hybrid object-oriented and functional style using Scala. Finally, we’ll move on to a more fully functional style in Clojure.

Let’s focus on a few goals for this example. The first is to see several patterns working together in one codebase before we go into them in more detail.

The second is to introduce basic Scala and Clojure concepts for those unfamiliar with either, or both, of the languages. A full introduction to the languages is beyond the scope of this book, but this section gives you enough of the basics to understand the majority of the remaining code.

Finally, we’ll work existing Java code into a Scala or Clojure codebase. We’ll do this by taking the Java version of TinyWeb and transforming it into Scala and Clojure piece by piece.

TinyWeb itself is a small model-view-controller (MVC) web framework. It’s far from complete, but it should feel familiar to anyone who has worked with any of the popular frameworks, such as Spring MVC. There’s one little twist to TinyWeb: since this is a book on functional programming, we’re going to do our best to work with immutable data, which can be quite challenging in Java.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.163.238