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.
Read or Download Becoming Functional: Steps for Transforming Into a Functional Programmer PDF
Similar object-oriented software design books
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.
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.
- UML Bible
- Programming Rust: Fast, Safe Systems Development
- Project Management with the IBM(R) Rational Unified Process(R): Lessons From The Trenches
- Developing Software with UML: Object-Oriented Analysis and Design in Practice (2nd Edition)
- COM and .NET Interoperability
Extra resources for Becoming Functional: Steps for Transforming Into a Functional Programmer
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
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.