|
所在平台: Coursera |
课程主页: https://www.coursera.org/learn/scala2-functional-program-design
课程评论:没有评论
课程名称:Scala中的函数式程序设计(Scala 2版) 课程概述:在本课程中,您将学习如何在更大的Scala应用程序设计中应用函数式编程风格。您将了解重要的函数式编程概念,从惰性求值到使用单子构建库的结构。课程将涵盖更大且更复杂的示例,包括状态空间探索、随机测试和离散电路模拟器。您还将学习如何在实际工作中编写良好的Scala代码的最佳实践。此外,您将学习如何利用编译器根据类型推断值的能力。 课程中有多个部分涉及函数式编程与可变状态的相互作用。我们将探索函数与状态结合的后果,并研究使用无限数据结构或函数式响应式编程的纯函数替代方案。 推荐背景:您应具备至少一年的编程经验。对Java或C#的熟练掌握最佳,但具有C/C++、Python、JavaScript或Ruby等其他语言的经验也足够。您应对使用命令行有一定的了解。本课程建议在完成《Scala中的函数式编程原理》后进行学习。 课程大纲: 第一部分:for表达式和单子 - 我们将回顾在Scala函数式编程原理中学到的一些概念,包括集合、模式匹配和函数。接着介绍for-comprehensions,Scala中遍历列表、处理并返回新列表的强大方法。我们还将了解如何用for-comprehensions进行查询,以及Scala编译器如何将其“去糖化”为高阶函数的调用。最后,我们将讨论什么是单子,如何验证多个示例的单子法则是否得到满足。 第二部分:惰性求值 - 本周我们将重新审视组合搜索带来的性能问题,发现函数式编程中一个重要的概念——惰性求值,这可以解决这些问题。我们还将学习一些关于树的证明,特别是如何将结构归纳推广到树。 第三部分:类型导向程序设计 - 本周,我们将学习如何让编译器为我们编写程序!我们将看到编译器如何根据类型召唤程序片段,以及如何利用这一机制实现新的多态形式(类型类)。 第四部分:函数与状态 - 本周,我们将学习状态和副作用。通过丰富的示例,我们将学习管理大型程序中状态的编程模式。我们还将了解Scala中的for循环和while循环。 第五部分:及时效果 - 本周,我们将通过示例学习多个重要的编程模式,首先是观察者模式,然后是函数式响应式编程。 通过本课程,您将掌握Scala中的函数式编程的实践技巧,提升您在实际应用中的编程能力。
Part: 1
Title:For Expressions and Monads
Description:We'll start by revisiting some concepts that we have learned from Principles of Functional Programming in Scala; collections, pattern matching, and functions. We'll then touch on for-comprehensions, a powerful way in Scala to traverse a list, process it, and return a new list. We'll see how to do queries with for-comprehensions as well as how the for-comprehension is "desugared" into calls to higher-order functions by the Scala compiler. Finally, we'll discuss what monads are, and how to verify that the monad laws are satisfied for a number of examples.
Part: 2
Title:Lazy Evaluation
Description:This week we'll revisit performance issues caused by combinatorial search, and we'll discover an important concept in functional programming that can address these issues: laziness. We'll also learn a little bit about proofs on trees; in particular, we'll see how to extend structural induction to trees.
Part: 3
Title:Type-Directed Programming
Description:This week, we’ll learn how to make the compiler write programs for us! We’ll see how the compiler can summon program fragments based on their type and how this mechanism can be used to implement a new form of polymorphism (type classes).
Part: 4
Title:Functions and State
Description:This week, we'll learn about state and side-effects. Through a rich example, we'll learn programming patterns for managing state in larger programs. We'll also learn about for-loops and while-loops in Scala.
Part: 5
Title:Timely Effects
Description:This week we'll learn a number of important programming patterns via examples, starting with the observer pattern, and then going on to functional reactive programming.
In this course you will learn how to apply the functional programming style in the design of larger Scala applications. You'll get to know important new functional programming concepts, from lazy evaluation to structuring your libraries using monads. We'll work on larger and more involved examples, from state space exploration to random testing to discrete circuit simulators. You’ll also learn some best practices on how to write good Scala code in the real world. Finally, you will learn how to leverage the ability of the compiler to infer values from types. Several parts of this course deal with the question how functional programming interacts with mutable state. We will explore the consequences of combining functions and state. We will also look at purely functional alternatives to mutable state, using infinite data structures or functional reactive programming. Recommended background: You should have at least one year programming experience. Proficiency with Java or C# is ideal, but experience with other languages such as C/C++, Python, Javascript or Ruby is also sufficient. You should have some familiarity with using the command line. This course is intended to be taken after Functional Programming Principles in Scala: https://www.coursera.org/learn/scala2-functional-programming.