2 Functional thinking in action

 
Image

In this chapter

  • See examples of functional thinking applied to real problems.
  • Understand why stratified design can help organize your software.
  • Learn how actions can be visualized in timelines.
  • See how timelines help you discover and resolve problems having to do with timing.

This chapter will give a broad overview of the two big ideas we will address in this book. Your main goal should be to get a taste of thinking with FP. Don’t worry about understanding everything right away. Remember that each of these ideas will be addressed in several chapters later on. This will be a whirlwind tour of functional thinking in action.

Welcome to Toni’s Pizza

Welcome to Toni’s Pizza. The year is 2118. It turns out people still like pizza in the future. But all of the pizza is made by robots. And the robots are programmed in JavaScript. Go figure.

Toni has applied a lot of functional thinking to the code that runs her restaurants. We’re going to take a brief tour through some of her systems, including the kitchen and her inventory, and see how she has applied the two levels of functional thinking.

Just so you don’t have to flip back, here are the two levels again. Here’s how Toni uses them.

Part 1: Distinguishing actions, calculations, and data

 
 

Part 2: Using first-class abstractions

 
 
 

Part 1: Distinguishing actions, calculations, and data

 

1. Actions

 
 
 

2. Calculations

 
 

3. Data

 
 
 

Organizing code by “rate of change”

 

A first glimpse of stratified design

 
 
 

Part 2: First-class abstractions

 
 

As applied to a robotic kitchen

 
 

Timelines visualize distributed systems

 
 
 
 

Multiple timelines can execute in different orderings

 
 
 

Hard-won lessons about distributed systems

 
 
 

Toni does a postmortem

 
 

Cutting the timeline: Making the robots wait for each other

 
 
 

Positive lessons learned about timelines

 
 
 

Retrospective on coordinating robots

 
 

Conclusion

 
 

Summary

 
 

Up next…

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage