Functional Programming Principles in Scala

开始时间: 04/22/2022 持续时间: 7 weeks

所在平台: CourseraArchive

课程类别: 计算机科学

大学或机构: École Polytechnique Fédérale de Lausanne(洛桑联邦理工学院)

授课老师: Martin Odersky

课程主页: https://www.coursera.org/course/progfun

课程评论: 7 个评论

评论课程        关注课程

课程详情

This course introduces the cornerstones of functional programming using the Scala programming language. Functional programming has become more and more popular in recent years because it promotes code that’s safe, concise, and elegant. Furthermore, functional programming makes it easier to write parallel code for today’s and tomorrow’s multiprocessors by replacing mutable variables and loops with powerful ways to define and compose functions.

Scala is a language that fuses functional and object-oriented programming in a practical package. It interoperates seamlessly with Java and its tools. Scala is now used in a rapidly increasing number of open source projects and companies. It provides the core infrastructure for sites such as Twitter, LinkedIn, Foursquare, Tumblr, and Klout.

In this course you will discover the elements of the functional programming style and learn how to apply them usefully in your daily programming tasks. You will also develop a solid foundation for reasoning about functional programs, by touching upon proofs of invariants and the tracing of execution symbolically.

The course is hands on; most units introduce short programs that serve as illustrations of important concepts and invite you to play with them, modifying and improving them. The course is complemented by a series of assignments, most of which are also programming projects.

课程大纲

Week One: Programming paradigms; overview of functional programming and the Scala programming language.
Week Two: Defining and using functions, recursion and non-termination, working with functions as values, reasoning by reduction. 
Week Three: Defining and using immutable objects, review of inheritance and dynamic binding.
Week Four: Types and Pattern Matching
Week Five: Working with Lists
Week Six: Collections and Combinatorial Search
Week Seven: Lazy Evaluation

课程评论(7条)

0

大吃一惊异 2014-06-06 12:16 0 票支持; 0 票反对

这课比较适合没学过FP的,讲的东西很基础。开始上了之后出于强迫症还是跟完了

1

超級現實的超現實理想主義者 2013-12-21 20:49 1 票支持; 0 票反对

轮次:
Sep 16th 2013

背景:
今年年初的时候挑战过一次,失败了,九月再战,这次成功了。这门课需要的背景我也不好说,感觉如果能够搞定Peter Norvig在 Udacity上的Design of Computer Programs(虽然我没上过,不过大致知道讲什么)的话搞定这门课的作业应该不成问题。

内容:
这门课的很多概念性的内容和UW的Programming Languages的前四个Section有很高的重合度,因为这两门课我是同时在上,所以感触很深。跟着讲师的讲解动手做,效果不错,而且这门课程还会提供一些免费的资料,其中一本 Scala By Example我觉得挺有用的。

作业:
这门课没有考试,全部都是PA。对我来说还是挺有难度的,因为主要的倒难点不在于函数式编程的概念,而在于想要解决的问题本身,这就是为什么我之前说搞定Peter Norvig那门课的话,这门课的作业应该会好解决一点。

社区:这门课的社区很活跃,帖子能发到60多页,鉴于这门课的开课频率目前来说挺高,这种活跃度还是很好的,也难怪Martin他们群发邮件吹嘘说他们是所有MOOC课程中拿到证书的人最多的一门课。另外值得一提的是这门课的TA,其中有个助教叫Pavel Lepin简直是活雷锋中的战斗机,超级给力!(我在上一轮Scala的时候也是他担任TA)而且他在UW的Programming Languages里面也担任助教。之前无意中在哥伦比亚的NLP中也看到过他的自我介绍,原来他是大学辍学,现在已经三十几岁了,MOOC重新定义了他的人生,励志啊!

总结:总体上非常不错的一门课程,对于习惯了指令式语言的朋友来说可能转换思路有点吃力,不过很锻炼思维

1

looluo 2013-12-16 12:03 1 票支持; 0 票反对

progfun是我跟的第一门MOOC课程,也是从这么课程开始了解MOOC的。

第一次跟这个课的时候,课程已经开了一半。之前有Scala和函数式编程的基础,所以课还是跟上了。上了课才知道,之前根本没有能理解函数式编程的精髓,拿着Scala当指令式语言在用,上了这个课算是入了点门吧。

PA确实有点难度,作业做到深夜2点的有没有啊!最终还是把5个PA都提交,但是是中途跟的,有3个PA过了Hard DeadLine,没有拿到分书,最终没有拿到证书。
课程第二次开的时候又提交了一遍PA,拿到了证书。

现在在跟这门课的后续课程Principles of Reactive Programming,课程的组织感觉没有前一门有条理,PA也设计的不是很清晰,基本每个PA都要去论坛看作业内容的澄清。不过还剩最后一个PA,胜利在望。

0

AriesDevil 2013-11-27 10:23 0 票支持; 0 票反对

说是入门课程,其实还是有难度的,特别是第3,4周的作业,得多花点心思。
后续课程已经放弃了(第一周就讲Monads,好(坑)赞(爹)啊),总之,只要坚持,这门课程还是能拿下的,后续课程还是好好学好scala和functional programming相关知识再学吧

2

超級現實的超現實理想主義者 2013-08-08 17:29 2 票支持; 0 票反对

上这门课的时候是今年3月份左右,那时候才刚刚学会一点编程就想直接挑战一下函数式编程。后果也很容易猜到:没有能力上完,但是这段经历给我留下了很深的印象。

整门课总共有5个Lab,我坚持到Lab3的第一题,到后面实在做不下去,于是放弃了。但是在做前面几个Lab的时候发现,原本一个指令式(imperative)语言,例如C或者Java需要十几行甚至更多才能解决的问题,函数式(functional)语言只需要短短几行。以往写代码可能是一边试验一边写(凑代码),而面对函数式编程,你可能需要对着电脑屏幕思索半天无法下手,但一旦下手几行就能解决问题,并且不容易出bug。

这就是这门课的老师,Scala语言的发明人Martin Odersky在课里反复强调的:抽象,抽象,尽可能的抽象。将你的方法尽可能的抽象,剩下的放心交给编译器或解释器解决,这就是函数式语言的基本思想。

看过Paul Graham的《黑客与画家》的朋友应该知道这个故事:Paul Graham在与朋友创业的时候用的是LISP语言,由于LISP的抽象性,导致开发速度非常高效。甚至竞争对手在新闻里提高过某个功能,他们就能在几天内迅速实现,以至于一段时间内没有人知道他们究竟是如何做到这样的。

这门Scala的课程借鉴了很多SICP(Structure and Interpretation of Computer Programs)的内容,熟悉SICP的朋友对于这门课应该会感觉很熟悉。

想要了解函数式编程的朋友不妨学一下这门课,或者Coursera上的另一门课程Programming Languages

0

wzyer 2013-05-17 08:55 0 票支持; 0 票反对

大赞的一门课!特别是对于我这种对函数式编程知之甚少的人来说。Martin大叔讲课也很好,作业难度适中,更难得的是代码量都不大。无比期待part II。

1

yongsun 2013-05-13 13:02 2 票支持; 1 票反对

scala的入门课程,其创始人亲自讲解,开拓眼界的好课程。PA题目也都很有趣,如果你完成PA写的代码超过5行,你都不要意思和别的同学打招呼。期待Part II!

课程简介

Learn about functional programming, and how it can be effectively combined with object-oriented programming. Gain practice in writing clean functional code, using the Scala programming language.

课程标签

Scala Scala入门 函数式编程 函数式语言 函数式编程入门 函数式 EPFL Martin Programming functional Odersky Scala公开课 洛桑联邦理工学院

69人关注该课程

主题相关的课程

Programming Languages 关注

Creative, Serious and Playful Science of Android Apps 关注

Ruby 关注

关注

High Performance Scientific Computing 关注

Learn to Program: The Fundamentals 关注

Coding the Matrix: Linear Algebra through Computer Science Applications 关注

Introduction to Computer Science 关注

Computer Architecture 关注

Heterogeneous Parallel Programming 关注