Introduction - Thinking in LINQ: Harnessing the power of functional programing in .NET applications (2014)

Thinking in LINQ: Harnessing the power of functional programing in .NET applications (2014)

Introduction

This book won’t teach you the basics of LINQ. It will teach you how to use it appropriately. Having a jackhammer is great only if you know how to use it properly; otherwise, you are not much better off than someone with a hammer. LINQ is powerful. Powerful beyond measure. I hope you will see some of that power by following the examples in the book.

Here is a brief walk-through of the chapters:

· Chapter 1: Thinking Functionally

Our generation of programmers has been raised with object-oriented programming ideas. This initial chapter is dedicated to showing how functional programming is different from object-oriented programming. This chapter sets the context for the rest of the book.

· Chapter 2: Series Generation

This chapter has recipes for generating several series using LINQ. For example, it shows how to generate recursive patterns and mathematical series.

· Chapter 3: Text Processing

Text processing is a blanket term used to cover a range of tasks, from generation of text to spell-checking. This chapter shows how to use LINQ to perform several text-processing tasks that are seemingly commonplace.

· Chapter 4: Refactoring with LINQ

Legacy code bases grow, and grow fast—faster than you might think they would. Maintaining such huge code blocks can become a nightmare. When is the last time you had trouble understanding what some complex loop code does? This chapter shows how to refactor your legacy loops to LINQ.

· Chapter 5: Refactoring with MoreLINQ

MoreLINQ is an open source LINQ API that has several methods for slicing and dicing data. Some of these operators are easily composable using other LINQ operators. But some are also truly helpful in minimizing the total number of code lines. This chapter shows how you can benefit from using MoreLINQ.

· Chapter 6: Creating Domain-Specific Languages Using LINQ

Domain-specific languages (DSLs) are gaining in popularity because they convey the intent of the programmer very nicely. This chapter shows how to create several DSLs.

· Chapter 7: Static Code Analysis

LINQ treats everything as data. Code is also data. This chapter shows how, by using LINQ-to-Reflection, you can do a lot of meta programming in .NET.

· Chapter 8: Exploratory Data Analysis

This chapter shows how you can use LINQ to solve several data analysis tasks. I hope you find this chapter enjoyable, because the examples are really interesting.

· Chapter 9: Interaction with the File System

I have always wished that Windows Explorer included better features for querying the file system. However, by using LINQ, you can build your own custom queries quickly. This chapter shows you some examples that can be useful in the real world.

· Appendix A: Lean LINQ Tips

LINQ is an API that provides several operators to express your intent. Although that is super powerful, it comes with a price. If you don’t know how these operators work internally, you might end up using a combination that results in slower code. This appendix provides some hard-earned knowledge about how to glue LINQ operators together for optimum performance.

· Appendix B: Taming Streaming Data with Rx.NET

Being reactive is important when dealing with streaming data. Microsoft’s über-cool framework, Rx.NET, is a fantastic API for dealing with streaming data and async operations. This appendix shows how to use Rx.NET to tackle streaming data.