Preface

Programming Is Hard

Programming is a hard job. Deceivingly so. At first you write code, and it works, and you are happy. Then it has bugs and you spend hours, days, even weeks trying to find, fix, and resolve bugs and edge cases. Then when you have everything perfectly programmed and just when you thought the job couldn’t get harder, you have to go deploy your code. vim apache.conf. vim my.cnf. vim /etc/hosts. iptables. Just when you thought you were a programmer, all of a sudden you get waist deep in system administration and wonder how you got there.

If there is one thing that programmers are good at, it is being productively lazy. When a programmer does the same thing over and over again, eventually he thinks: can’t my computer do this for me? Around 2005, enough programmers in the world had edited apache.conf files that something dramatically changed. A few brilliant programmers decided they didn’t want to do it any more.

Out of this came two paradigms that have forever changed the landscape of deploying applications in the world: DevOps and PaaS. DevOps’s response to apache.conf editing says: I can write code templates (called recipes or cookbooks) that do system administration for me. PaaS’s response to apache.conf editing says: I can write a program that manages system administration for me. Many great books have been written about DevOps—like Puppet Types and Providers by Dan Bode and Nan Liu or Test-Driven Infrastructure with Chef by Stephen Nelson-Smith—but few books have been written about PaaS.

PaaS is great because you get the benefits of dedicated hosting (like each app running in its own process and load balanced to scale) with the ease of shared hosting (you don’t do any configuration management, the PaaS does it for you). But those benefits come at a cost. You have to write code that works with the PaaS.

Writing Code That Works on PaaS

This topic has not been written about a lot: which programming patterns work well on PaaS and which anti-patterns no longer work in a PaaS environment? This is the entire theme of this book. Although the popularity of PaaS has grown exponentially with millions of developers worldwide having already adopted it and millions more starting to learn about it right now, not a lot of work has been written to help guide developers on how to successfully incorporate PaaS best practices into their coding processes.

Specifically, one of the biggest challenges facing many developers working in businesses today is how to move legacy code and older applications into a PaaS paradigm. There have been few resources to help guide people through this challenge and hopefully this book will be a first step in the right direction to providing the dialogue.

Audience

This book is aimed at programmers, developers, engineers, and architects who want to know more about Platform-as-a-Service.

You do not need to be a programmer to find value in this book. In fact, if you are trying to convince your boss to let you use PaaS inside your company, you may want to give your boss a copy of this book. Alternatively, you can find resources for talking to your boss about PaaS, both the pros and cons, in Chapter 8. This will show you have thought through the problem from both sides of the table and have an informed opinion, not just a passing fashion.

In some of the technical chapters, I even provide code samples. Since PaaS works with many programming languages, I provided simple programming samples in various programming languages including PHP, Ruby, Node.js, Java, and Objective-C. We do not go deep in any one language, but rather stay high level on various ones in hopes that you are familiar with one or two and can read through the others.

The Structure of This Book

If you are an architect or technical manager, or are simply new to PaaS, the first three chapters are very important to understand the context for which PaaS has entered the technical landscape. These chapters explain what the cloud is (Chapter 1), what PaaS is (Chapter 2), and different kinds of PaaS technologies and their relative strengths and weaknesses (Chapter 3).

If you already know about the history of PaaS or have used a PaaS, you can skim through the first three chapters and dig in for the next three chapters around Chapters 4, 5, or 6. These chapters are the heart of this book, providing real life tools, techniques, and programming patterns that will help you stay away from the biggest pitfalls of PaaS and not waste any time on programming anti-patterns.

Chapter 7 is an important chapter for everyone to understand. Services like database and caching services or email services contain some of the biggest gotchas in the PaaS world. If you are not careful, this is the place you can fail most quickly when adopting PaaS.

The next two chapters go back to a higher level of understanding. In Chapter 8, there is discussion around the appropriateness of adopting PaaS at all, including the strengths and weaknesses of PaaS in general. Understanding whether PaaS is a good fit for the problem you are tackling is critical. In Chapter 9, the discussion centers around where PaaS is going, some industry trends, and thoughts around Open Source movements in the PaaS world.

The last chapter is a great place to reference any technologies available around PaaS. Chapter 10 should have a bookmark sticking out of it, because you will be flipping to it to find ideas for service providers and technologies of all types (PaaS, IaaS, SaaS, and helpful programming libraries).

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip, suggestion, or general note.

Caution

This icon indicates a warning or caution.

Safari® Books Online

Note

Safari Books Online (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://oreil.ly/programming-paas.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

First, I would like to thank Doug Baldwin for all his assistance putting this book together; it could never have been done without him.

If it were not for Meghan Blanchette’s patience and persistence and Mike Loukides believing in me, I would never have started or finished this book.

Thank you to Kara Ebrahim, Meghan Connolly, and the whole O’Reilly crew for making this possible.

This book would be appallingly low quality were it not for our technical reviewers, who spotted bugs, problems, and conceptual errors: John Purrier, Alex Parkinson, Larry Hitchon, Andrei Matei, Chad Keck, and Troy Howard.

To my wife, my son, my daughter, my dog, my mom, my dad, my brother, and all my family and family-in-law, thank you for your everlasting support and love.

Finally, to the programmers and inventors who created PaaS and the companies that supported them, thank you for making all of our lives easier.

Get Programming for PaaS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.