About this book

Source: Internet
Author: User

About this book

 

If you have already developed. net programs, are familiar with object-oriented technology, and want to know new content about functional programming and how we can benefit from it, this book is definitely suitable for you.

This book is especially suitable for developers who already have Object-Oriented Programming and C #2.0 knowledge. Of course, you are generally not required to have the knowledge of function programming, but do not need to know F #. In fact, if you used to think about problems in the object-oriented way, it would be more difficult to learn functional programming, because many functional ideas are unfamiliar to you. We have already written this book for ideological consideration. We usually pay attention to your intuition and compare object-oriented and functional programming to explain specific topics.

If you have used other object-oriented languages and tools (such as Java, Python, or Ruby) and have the ability to quickly understand the language, you can also benefit from this book. We use the C # example. Most of them are similar to other object-oriented languages. The new functions in C #3.0, which are not available in other languages, are briefly introduced. Therefore, you don't have to worry.

This book does not focus on the academic aspects of functional programming. However, if you are a computer student and have studied this course, you can read this book to learn useful functional concepts.

 

Some in the book:

 

If you still want to know whether the book is suitable, let's take a look at the following content:

Function programming concepts. After reading the book, you will learn a new way of thinking. We will find that complex and object-oriented design patterns become a simple concept in functional programming. Functional thinking can be used in programming in any language. Therefore, this is useful no matter which language you are using.

The actual basic functional structure. C #3.0 has some structures. Therefore, you will find that many familiar C # code is very similar to the simple function f # implementation. We will also explain the new features in C #3.0 and Their Relationships with functional concepts. An in-depth understanding of these concepts will benefit from the new features.

Write practical F # code. Although this book is not about F #, I still want to teach you everything you need to get started. We will introduce the highlights of F #, including asynchronous programming and composite libraries.

We don't expect this book to be perfect for all purposes: computing is not a one-size-fits-all field. So we should still know what is not in this book to avoid disappointment.

 

Not found in the book:

 

This book is not a reference book. Therefore, if you have never been familiar with functional programming, the best way is to start from the beginning and read the book in the order of chapters, because this is our hypothetical reading method, the subsequent sections will reference the concepts mentioned above. If you start reading from the middle of the book, you will find it hard to understand.

This book is not a concise manual for F # programming. To become a good f # programmer, the only way is to understand the idea of functional programming. You may learn all the F # Words and use F # To rewrite C # code, but this is not good. If you want to write F # code that meets your habits, you must learn different ways of thinking before you can perform functional programming. This is exactly what you want to read. After learning to think in a functional style, you can learn more about F # from other books #.

The main purpose of writing books is to allow professional programmers to solve practical problems. However, this does not mean that we provide you with a solution that can be used at any time and can solve your specific problems immediately. On the contrary, we pay more attention to related concepts and technologies. We have used many examples to explain these principles, but it is impossible to cover all fields that F # and functional programming can apply.

 

Road Map

 

This book uses an iterative structure ). In the first part (Chapter 1 to chapter 4), we will explain some of the most important topics, so that we can understand the purpose of this book and the differences in function programming; the second part (Chapter 5 to Chapter 8) systematically discusses the basis of all functional programming; the third part (Chapter 9 to Chapter 12th), we will build these foundations, it also discusses the best practices of functional programming and optimization, as well as the advanced skills frequently used by most functional programmers. The fourth part (Chapter 1 to Chapter 2) describes more complex examples, demonstrate how to use functional programming to develop large-scale practical projects.

Chapter 1 discusses why functional programming is becoming more and more important. The example given uses a technology you may already know, benefiting from some aspects of functional programming, it also shows the first application written with F.

Chapter 2 introduces the concepts behind functional programming, does not show any details, and mostly uses C #, which helps you understand how these concepts are related to each other, and the meaning of the program structure.

Chapter 3 shows some actual functional code to demonstrate the data types used in F #, such as tuple and list ). We will see how to use these types in F #, and use the actual types in C # to explain their principles. This chapter introduces the concept of function as value, which is the core of functional programming.

Chapter 4 shows the first utility implemented with F. net and F # library to implement a pie chart program; You will also see how to efficiently use the tools provided by F # during the development process.

Chapter 5: Discussion values. Function programs are generally written as calculation forms, with values as parameters and return values as results. Therefore, we must start from a systematic understanding of function functions and discuss various types of values.

Chapter 6 discusses the most common method to use values, that is, using higher-order functions ). Using values directly usually requires a lot of repeated code. Therefore, this chapter shows how to design and implement reusable operations.

Chapter 7: focusing on the system, the structure of functional programs is determined by the data it processes. What we use to demonstrate this important principle is an application that operates and draws simple documents.

Chapter 8 will focus on the architecture of the application and be able to dynamically change its behavior at runtime. This can be achieved through the use of functions, because we will discuss in detail and will explain relevant topics, for example, closure ).

Chapter 9 shows how to use the object-oriented and functional style in F #. It demonstrates how to use functional functions, such as non-variability and object-oriented concepts, such as encapsulation ), write the function.. Net Library.

Chapter 10 focuses on correctness and efficiency. We will see how to write a dataset of any size and How to Write efficient functions. We will also learn how to use imperative structures, such as arrays to optimize code.

Chapter 2 discusses refactoring, testing, and laziness ). We will explain how functional programming makes it easier to understand and improve existing code. We will also discuss unit testing, and we can see that due to composability and strictness ), some types of tests are optional.

Chapter 2, first choice to show how to process data sets, will introduce the sequence expression of F #, which is designed for this purpose; we will also see that this is not a built-in function, unlike the most similar function in C #, it is more common to be able to change the meaning of code.

Chapter 2: This is the most common scenario for data processing in F. Download data using a public web service, parse the data into a structured format, and use Excel to visualize the emerging part.

Chapter 2 demonstrates the use of functional concepts to easily construct parallelize applications, use an image processing program, and simulate animals and predators to hunt animals,

Chapter 2 describes how to build a declarative functional library ). Well-designed libraries can be beautifully combined, such as creating libraries that generate animations and libraries that represent financial contracts.

Chapter 2 shows how to build a graphical application. More generally, the program is driven by external events. Implementing a control flow like this is quite difficult in other languages, so let's take a look at how f # makes it easier.

 

Printing conventions

 

This book contains a large amount of sample code that uses a fixed-width font layout. Longer examples are placed in a title list. Since the book is mixed with C # And F #, In the list side by side, the title also indicates the language in use. When the F # code is displayed, the list is divided into two forms. The Code marked as "F #" is the real source code and can be compiled in general; the list marked as "F # interactive" is the code segment entered in the F # interaction environment, and its output is in italic format. The bold font width is used to emphasize the keywords in the C # And F # lists.

 

Naming Conventions

 

In this book, we not only mix two languages, but also functional programming and object-oriented. We want to use the natural style of the two languages. Therefore, F # And C # must follow different conventions.

In C #, follow the common.. net Language access, without exception, also use this mark; however, if F # is only a private implementation, we will follow the functional naming style. Most clearly, we use camelcase for variable and function names, which is the most common style in F #, because, function declaration and variable Declaration are essentially the same thing.

Occasionally, we use shorter names and abbreviations for two reasons: first, function programmers often use this style. Because we have a better development environment, there is almost no reason to use this style, so we should try to use it as little as possible. However, in some cases, short names have become common in functional programming and we keep them. Second, sometimes we have two examples side by side. In this way, we must try to use a simpler code style; otherwise, except for the few examples discussed in this article, most of the others conform to the. NET style.

 

Stylecop and fxcop

 

If you are familiar with code analysis tools, such as stylecop and fxcop, you may want to know whether the code in this book meets the rules required by these tools. Most of them comply with common. Net rules, but not all of them. If you use these tools to run code, there will be a lot of warnings for two main reasons:

First, code analysis tools are developed for object-oriented languages. The naming and style used are all object-oriented rules. As you will learn in this book, functional programming is different in many ways, so it won't simply follow all object-oriented rules. F # language is successful because it is completely different from C # and Visual Basic. It not only shows the popular language keywords, but also the programming style. In some aspects, naming rules also make the code more concise.

Second, it is limited by the length of this book. The source code example we use only demonstrates important concepts, but it is not important for the discussion. It requires the code to follow the rules and we do not want to include these noises.

 

Source code download

 

The source code of this example can be downloaded from the publisher's website.

 

Author online

 

After purchasing "practical function programming", you can freely access the private website Forum operated by manning press. Here, you can comment on this book, ask technical questions, and get help from the author and other users. Visit the Forum and subscribe to the address, Region.

Manning has the responsibility to provide a meaningful platform for readers to communicate with each other. However, Manning does not assume the responsibility of the author, the contribution to this book forum is voluntary (not paid ). We recommend that you ask them some challenging questions to avoid their loss.

As long as the book is published, the author's online forum and the documents discussed earlier can be accessed from the publisher's website.

 

Other online resources

 

In addition to Manning's website (http://www.manning.com/Real-WorldFunctionalProgramming), we also created a website for this book that contains some useful content with the source code for each chapter, there are also some materials that are not suitable for books. The website can also link to the latest article on function programming, so you can learn more here.

If you are interested in F #, you can also take a look at the official Microsoft Developer Center (Microsoft's Developer Center), http://msdn.microsoft.com/fsharp, which includes the latest F # language content, and links to articles, videos, and other F # resources. If you want to ask questions about F # And make sure you can get a satisfactory answer, you can visit F # Community Forum, http://cs.hubfs.net.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.