Becoming Functional: Steps for Transforming Into a by Joshua Backfield

By Joshua Backfield

When you have an primary (and most likely object-oriented) programming heritage, this hands-on e-book will advisor you thru the alien international of sensible programming. writer Joshua Backfield starts slowly by way of displaying you ways to use the main worthy implementation options earlier than taking you additional into functional-style techniques and practices. In each one bankruptcy, you will research a sensible proposal after which use it to refactor the fictitious XXY company's imperative-style legacy code, writing and trying out the useful code your self. As you move during the booklet, you will migrate from Java 7 to Groovy and eventually to Scala because the desire for larger sensible language help progressively raises.

Show description

Read or Download Becoming Functional: Steps for Transforming Into a Functional Programmer PDF

Similar object-oriented software design books

Java Threads

Threads usually are not a brand new concept: many working structures and languages help them. yet regardless of common aid, threads are typically anything that everybody talks approximately, yet few use. Programming with threads has a name for being tough and nonportable. no longer so with Java. Java's thread amenities are effortless to exploit, and - like every thing else in Java - are thoroughly moveable among structures.

Developing Service-Oriented AJAX Applications on the Microsoft Platform

Somebody within the evaluate stack has written that when examining you are going to hate AJAX, WCF and SOA. that is especially true - and that i learn simply 3 chapters! it's written in a really contrite and uninteresting demeanour, and after studying few chapters your eyelids begin to suspend. Coming to the technical facet, he will get info from the database throgh WCF, and use complicated javascript and XSLT coding to show info at the aspx web page.

Just Enough Programming Logic and Design

Locate precisely what you must grasp the basics of programming good judgment with the concise barely enough PROGRAMMING common sense AND layout, 2E. This distinct, language-independent advent to programming common sense presents seven chapters concerned with key programming and common sense content material in an immediate, effective layout that is helping you move throughout the subject material fast.

Extra resources for Becoming Functional: Steps for Transforming Into a Functional Programmer

Example text

Let’s write that really quickly so that we have it ready. Our map function will take a list of anything and another function that will be used to transform each individual item it is passed. The code in Example 3-19 shows the new map function, which will exist inside our Customer class. Example 3-19. call(obj)); } return outList; } Let’s remember our setContractForCustomer function; we can refactor it to return the list of Contracts that were updated, as shown in Example 3-20. Notice how much sim‐ pler writing this code is?

Info | 45 The message template is as follows, where and are place‐ holders to be replaced by the user’s name: Hello , We would like to let you know that a new product is available for you to try. Please feel free to give us a call at 1-800-555-1983 if you would like to see this product in action. Sincerely, Your Friends at XXY We’re going to add the functionality into the Customer class. Let’s think about this func‐ tionally. allCustomer records where both the customer is enabled and the customer’s contract is enabled.

Remember in the preceding chapter how our method getField had a similar for loop? info | 27 Let’s not repeat ourselves; instead, let’s abstract that for loop into its own function, which we’ll call filter. It will take a function that takes a Customer and returns a Boolean. The Boolean will indicate to us whether to keep the record. Our new function is listed in Example 3-4. Example 3-4. add(customer); } } return outList; } Now that we’ve created this function, let’s think back to the getField function in our Customer object.

Download PDF sample

Rated 4.87 of 5 – based on 17 votes