If you were to do a search right now for the hottest technology trends, you would see a consistent theme of focus on the technical areas of web, cloud, and mobile solutions combined with big data and economies of scale. With these trends comes a need for tools that allow technologists, such as you and me, to harness these technical focal areas and bend them to our will. How do we achieve this? What combination of architectures, tools, languages, and techniques will make it possible for us to write programs that target multiple devices and scale effortlessly, while still allowing the solutions to be robust, maintainable, testable, and reusable?
A number of tools are available that meet many of our needs, but using them to their fullest potential while achieving our development goals requires more capabilities than they provide. To get the most bang for our buck we really need a language that is specifically intended to solve the challenges that these trends create. This language needs to inherently tackle complexities such as concurrency, asynchrony, and big data, while being able to seamlessly integrate with other languages, technologies, and tools that are best suited to resolve other challenges. Luckily for us this language exists today, and its name is F#.
In this book I will show you how to use F# to build key aspects of web, cloud, and mobile solutions to conquer these challenges. The expressive, powerful, succinct, and functional-first nature of F#, combined with technologies with which you are already familiar, such as ASP.NET MVC, ASP.NET Web API, WCF, Windows Azure, HTML5, CSS3, JavaScript, jQuery, and jQuery Mobile, will allow you to build incredible solutions that not only meet but exceed the demands of these current and future technology trends.
This book is intended for technologists with experience in .NET who have heard about the benefits of F#, have at least a cursory understanding of the basic syntax, and wish to learn how to combine F# with other technologies to build better web, cloud, and mobile solutions. If you are brand new to F#, I encourage you to check out one of the many great F# books that provide information on getting started with F#, such as Chris Smith’s Programming F#, 3.0 (O’Reilly). If you are new to other platforms and frameworks mentioned in this book, such as ASP.NET MVC, WCF, ASP.NET Web API, Windows Azure, HTML, CSS, and/or jQuery Mobile, there are a number of other books offered by O’Reilly and other publishers that can quickly get you the information you need.
The majority of the examples within this book were created with Visual Studio 2012. It is recommended that you use Visual Studio 2012 Professional or higher to run the examples; however, most of the examples will also work as expected with F# Tools for Visual Studio Express 2012 for Web, which was announced September 12, 2012, on the F# team blog. You can download F# Tools for Visual Studio Express 2012 for Web via the Microsoft Web Platform Installer here. Depending on the platform or framework that is being targeted, installation of the following is required:
Additional installations and/or tools are referenced (when applicable) in the appropriate chapters.
This book provides everything you need to know to start building web, cloud, and mobile solutions with F#. In addition, it explores many of the latest technologies, platforms, and libraries such as Windows Azure, jQuery Mobile, SignalR, CouchDB, RavenDB, MongoDB, and more. The following provides a more detailed breakdown of what you will see in each chapter.
- Chapter 1, Building an ASP.NET MVC 4 Web Application with F#
This chapter provides everything you need to get started building ASP.NET MVC 4 web applications with F# doing the majority of the server-side heavy lifting. Additionally, this chapter shows off several advanced techniques and F# language features that allow you to write more elegant code.
- Chapter 2, Creating Web Services with F#
This chapter introduces the tools and concepts needed to create various types of web services including WCF SOAP and HTTP services, and approaches for interacting with a few of the available web micro-frameworks. The chapter also provides information on tools and techniques that are useful for unit-testing these services.
- Chapter 3, To the Cloud! Taking Advantage of Azure
This chapter walks you through the creation of F# web applications and web services that run on Windows Azure. Additionally, it provides F# examples for interacting with several of the Azure APIs. Lastly, it talks about a few excellent examples of libraries and runtimes that have been built with F# to run on Azure.
- Chapter 4, Constructing Scalable Web and Mobile Solutions
This chapter goes into more detail on how to use F# with other technologies to create scalable solutions that allow reuse by mobile and web frontends. The chapter includes information and/or examples for building web sockets, using SignalR, storing data in various NoSQL databases, and more.
- Chapter 5, Functional Frontend Development
This chapter introduces LiveScript, Pit, and WebSharper, which are tools that, among other things, allow the creation of client-side code with a functional style. These tools make it possible to create end-to-end web stacks using functional concepts. A list of advantages, information on how to get started, and examples are provided for each option.
This book also features several appendixes that provide information that can help you on your journey toward developing cutting-edge web, cloud, and mobile solutions, but that do not fall directly into the scope of the main concepts covered in the core chapters.
- Appendix A
This appendix lists and briefly describes several tools that can make your life easier as a web, cloud, and mobile solution developer.
- Appendix B
This appendix provides a number of links to websites that offer information on F# as well as other tools and libraries that are mentioned in the book.
- Appendix C
This appendix briefly explores a few technologies that complement F# web and mobile development.
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.
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Building Web, Cloud, and Mobile Solutions with F# by Daniel Mohl (O’Reilly). Copyright 2013 Daniel Mohl, 978-1-449-33376-8.”
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com.
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.
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/building-web.
To comment or ask technical questions about this book, send email to bookquestions@oreilly.com.
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
First and foremost, I’d like to thank my wife (Melissa) and daughter (Eva) for putting up with me during the many hours of heads-down computer time that it took to bring this book to fruition.
I’d also like to thank the following people for their great work, support, guidance, and/or awesomeness!
Don Syme and the rest of the F# team
Rachel Roumeliotis
Elijah Manor
Stephen Swensen
Fahad Suhaib
Ryan Riley
Steffen Forkmann
Anton Tayanovskyy
Adam Granicz
Get Building Web, Cloud, and Mobile Solutions with F# 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.