Skip to main content

Über dieses Buch

Functional programming is perhaps the next big wave in application development. As experienced developers know, functional programming makes its mark by allowing application builders to develop solutions to complicated programming situations cleanly and efficiently. A rich history of functional languages, including Erlang and OCaml, leads the way to F#, Microsoft's effort to bring the elegance and focus of functional programming into the world of managed code and .NET.

With Beginning F#, you have a companion that that will help you explore F# and functional programming in a .NET environment. This book is both a comprehensive introduction to all aspects of the language and an incisive guide to using F# for real-world professional development.

Reviewed by Don Syme, the chief architect of F# at Microsoft Research, Beginning F# is a great foundation for exploring functional programming and its role in the future of application development.



Chapter 1. Introduction

Functional programming (FP) is the oldest of the three major programming paradigms. The first FP language, IPL, was invented in 1955, about a year before Fortran. The second, Lisp, was invented in 1958, a year before Cobol. Both Fortran and Cobol are imperative (or procedural) languages, and their immediate success in scientific and business computing made imperative programming the dominant paradigm for more than 30 years. The rise of the object-oriented (OO) paradigm in the 1970s and the gradual maturing of OO languages ever since have made OO programming the most popular paradigm today.
Robert Pickering

Chapter 2. How to Obtain, Install, and Use F#

This chapter is designed to get you up and running with F# as quickly as possible. You’ll look at how to obtain F#, how to install it on both Windows and Linux, and how to use the compiler in various ways. I’ll also discuss what version of software was used to test the examples in this book.
Robert Pickering

Chapter 3. Functional Programming

You saw in Chapter 1 that pure functional programming treats everything as a value, including functions. Although F# is not a pure functional language, it does encourage you to program in the functional style; that is, it encourages you to use expressions and computations that return a result, rather than statements that result in some side effect. In this chapter, you’ll survey the major language constructs of F# that support the functional programming paradigm and learn how they make it easier to program in the functional style.
Robert Pickering

Chapter 4. Imperative Programming

As you saw in Chapter 3, you can use F# for pure functional programming. However, some issues, most notably I/O, are almost impossible to address without some kind of state change. F# does not require that you program in a stateless fashion. It allows you to use mutable identifiers whose values can change over time. F# also has other constructs that support imperative programming. You’ve already seen some in Chapter 3. Any example that wrote to the console included a few lines of imperative code alongside functional code. In this chapter, you’ll explore these constructs—and many others—in much more detail.
Robert Pickering

Chapter 5. Object-Oriented Programming

Object-oriented programming is the third major programming paradigm. There has been a tendency to try and show that the function paradigm and the object-oriented paradigm as competing, but I believe them to be complementary techniques that work well together, which I will try to demonstrate in this chapter. At its heart, object-oriented programming has a few simple ideas, sometimes referred to as the tenets of object-oriented programming: encapsulation, polymorphism, and inheritance.
Robert Pickering

Chapter 6. Organizing, Annotating, and Quoting Code

An important part of any programming language is the ability to organize code into logical units. F# provides modules and namespaces for this; you can learn more about them in this chapter’s “Modules,” “Namespaces,” and “Opening Namespaces and Modules” sections. To attain a good understanding of F#’s module system, it’s also important that you understand the scope of a module, as well as how it will be initialized and executed. You can learn more about these two concepts in the in “Module Scope” and “Module Execution” sections.
Robert Pickering

Chapter 7. The F# Libraries

Although F# can use all the classes available in the .NET BCL, it also ships with its own set of libraries.
Robert Pickering

Chapter 8. User Interfaces

In this chapter, you will learn about one of the most common tasks a programmer needs to perform: the art of putting pixels on the screen. In F#, this is all about the libraries and APIs that you call, and you have a lot of choices in this area, with more emerging as the .NET platform involves. The first choice you need to make is whether you want to build a desktop application; an application that runs locally and uses a series of windows and controls to display information to the user; or a web application, where you define the application’s interface in HTML, which is then rendered by a browser.
Robert Pickering

Chapter 9. Data Access

Computers are designed to process data, so it’s a rare program that doesn’t require some form of data access, whether it’s reading a small configuration file or an enterprise application that accesses a full-scale relational database management system. In this chapter, you will learn about F#’s wide range of data access options.
Robert Pickering

Chapter 10. Parallel programming

Recently parallel programming has moved from being a relatively obscure topic, practiced only by specialist developers, to a more mainstream endeavor. This is due to the increasing prevalence of multicore processors. At the time of writing, it is almost impossible buy a PC with a single core processor—the standard is dual core—and quad core processors are beginning to arrive in the shops. It is fully expect that this trend will continue in the years to come.
Robert Pickering

Chapter 11. Distributed Applications

Applications that use networks, called distributed applications, become more important every day. Fortunately, the .NET BCL and other libraries offer many constructs that make communicating over a network easy, which in turn makes creating distributed applications in F# is straightforward.
Robert Pickering

Chapter 12. Language-Oriented Programming

In this chapter, you will begin by taking a look at what I mean by language-oriented programming, a term that has been used by many people to mean different things. I’ll also briefly discuss its advantages and disadvantages. Next, you’ll look at several different approaches to language-oriented programming in F#. These techniques include using F# literals to create little languages and using F# quotations. You’ll spend the bulk of this chapter looking at examples where you create a language, then create an interpreter to execute that language. Finally, you’ll take a more detailed look at how languages are executed, including a performance comparison of interpreted or compiled execution techniques.
Robert Pickering

Chapter 13. Parsing Text

Structured text formats that are readable by both humans and machines have been popular almost since the beginning of computing. Programming languages are a good example of this, but there are many others. Parsing text is related to the previous chapter, language orient programming, because if you want to implement a language that is not embedded in F# then creating a parser for that format would be the first step. However, there are many reasons that you may want to parse an existing text format, so I did not want to limit this chapter to parsing languages.
Robert Pickering

Chapter 14. Compatibility and Advanced Interoperation

In this chapter, you will look at everything you need to make F# interoperate well with other languages, not just within the .NET Framework but also using unmanaged code from F# and using F# from unmanaged code.
Robert Pickering


Weitere Informationen

Premium Partner

BranchenIndex Online

Die B2B-Firmensuche für Industrie und Wirtschaft: Kostenfrei in Firmenprofilen nach Lieferanten, Herstellern, Dienstleistern und Händlern recherchieren.



Best Practices für die Mitarbeiter-Partizipation in der Produktentwicklung

Unternehmen haben das Innovationspotenzial der eigenen Mitarbeiter auch außerhalb der F&E-Abteilung erkannt. Viele Initiativen zur Partizipation scheitern in der Praxis jedoch häufig. Lesen Sie hier  - basierend auf einer qualitativ-explorativen Expertenstudie - mehr über die wesentlichen Problemfelder der mitarbeiterzentrierten Produktentwicklung und profitieren Sie von konkreten Handlungsempfehlungen aus der Praxis.
Jetzt gratis downloaden!