Программа курса и материалы по Scala
Добрый день.
Меня зовут Головач Иван, я практикующий Java Tech Lead, который перешел на Scala (Senior Scala Developer) с опытом в программировании 10+ лет.
Я подготовил и прочитал как обычные курсы по программированию (Java Core + Junior Java Developer), так и спецкурсы (Multicore Programming for JVM (раз и два)).
В данный момент я стартую спецкурс по Scala (программу можно найти в конце поста) и в этом топике я хочу поделиться материалами, которые я нашел наиболее интересными/информативными (курс готовился более года).
Программа курса
Материалы: “Разное”
Материалы: Object Oriented Programming
Материалы: Functional Programming
Материалы: Dependent Types
Материалы: Higher kinded types
Материалы: Parser combinators
Материалы: Metaprogramming / Reflection + Macros
Материалы: Metaprogramming / Macroses
Материалы: Scalaz
Материалы: Shapeless
Материалы: Algebird
Материалы: Netty
Материалы: Akka
Материалы: Finagle
Материалы: Zookeeper
Материалы: Использование FP в финансовой отрасли
Программа курса
- Модуль #1 (4 лекции): Базовая Scala
Задача модуля — рассмотреть синтаксис и пути решения “бытовых” задач на Scala- “Разное”
- Local Type Inference, unified types
- Structural types, tuples
- Generics: variance, upper/lower bounds, existential types
- Lazy values, DelayedInit trait, App / Application
- Implicits, view, view bounds
- Sequence сomprehensions
- Annotations, Exceptions
- Work with XML
- Scala’s Collections Library, Arrays
- Object Oriented Programming
- Classes, objects, traits
- Type members, abstract types
- Explicitly Typed Self References
- Mixin class composition, compound types, hierarchy linearization
- Cake Pattern
- Functional Programming
- Functional types, anonymous functions, nested functions, curring, partial application
- Methods / Functions, Operators (prefix, infix, postfix; associativity), бесскобочная + бесточечная запись
- Call-by-name / call-by-value, named and default params
- Pattern matching, case classes, extractor objects
- “Разное”
- Модуль #2 (4 лекции): Продвинутая Scala
Задача модуля — детально рассмотреть возможности Scala, которых нет в Java.- Dependent Types
- Higher kinded types
- Parser combinators
- Metaprogramming = Reflection + Macros
- Модуль #3 (4 лекции): Type-acrobatic libraries in Scala
Задача модуля рассмотреть наиболее продвинутые библиотеки (в смысле использования системы типов и возможностей языка), как они написаны, что на них можно сделать.- Scalaz — немного теории категорий (монада, апликативный функтор, катаморфизм, ...)
- Shapeless — a type class and dependent type based generic programming library
- Algebird — или как в Twitter используют алгебру (моноид, группа, полукольцо, ...)
- Модуль #4 (4 лекции): Многопоточное, сетевое и распределенное программирование
Задача модуля рассмотреть наиболее популярные для JVM сетевые библиотеки, которые чаще всего являются “строительными блоками” больших распределенных систем. Разобраться, почему Twitter пишут на Scala.- Netty
- Akka
- Finagle
- Zookeeper
- A Tour of the Scala Programming Language“, Odersky + ...
- “An Overview of the Scala Programming Language”, 2ed, Odersky + ...
- “A Scala Tutorial for Java programmers”, Michel Schinz, Philipp Haller
- “Scalable Component Abstractions”, Odersky + ... . We identify three programming language abstractions for the construction of reusable components: abstract type members, explicit selftypes and modular mixin composition. Together, these abstractions enable us to transform an arbitrary assembly of static program parts with hard references between them into a system of reusable components. ... We demonstrate this approach in two case studies, a subject/observer framework and a compiler front-end.
- “Type classes as objects and implicits”, Odersky + ... , Type classes were originally developed in Haskell as a disciplined alternative to ad-hoc polymorphism. Type classes have been shown to provide a type-safe solution to important challenges in software engineering and programming languages such as, for example, retroactive extension of programs. They are also recognized as a good mechanism for concept-based generic programming and, more recently, have evolved into a mechanism for type-level computation. This paper presents a lightweight approach to type classes in object-oriented (OO) languages with generics using the CONCEPT pattern and implicits (a type-directed implicit parameter passing mechanism).
- “Matching Objects With Patterns”, Odersky + ..., Pattern Matching во всей красе с Case classes / Extractors + сравнение с более классическими решениями (Visitor, Type-Test/Type-Cast, ...)
- “Fighting Bit Rot with Types”, Odersky + ... — описан рефакторинг коллекций Scala для версии 2.8 с хорошим погружением в higher-kind types, implicit parameters и implicit conversions
- “Independently Extensible Solutions to the Expression Problem”, Odersky + ... . Предлагается Scala-решение для “классической” Expression Problem. Частично решениями этой проблемы являются наследование (расширение сущностей) и шаблон Visitor (расширение операций), однако Одерский решает более интересную проблему — компоновка независимых расширений и сущностей и операций одновременно.
- “Scala’s Selfless Trait Pattern”, Bill Venners — просто именованный шаблон работы с наследование в Scala
- “Scala’s Stackable Trait Pattern”, Bill Venners — просто именованный шаблон работы с наследование в Scala
- Twitter.com: Effective Scala
- Twitter.com: Scala School!
- Odersky + Coursera = “Functional Programming Principles in Scala”
- Odersky + Coursera = “Principles of Reactive Programming”
- “Programming in Scala. 2ed” — книга от Одерского, классика, обязательна к прочтению
- “Scala for the Impatient” — товарищ Хорстман и тут успел. Если Вам понравился его двухтомник по Java, возможно, стоит попробовать и это
- “Scala in Depth” — хороший охват: от основ до вершин
- “Functional Programming in Scala” — сильная книга от одного из контрибюторов в Scalaz
- “Parser Combinators in Scala”, Odersky + ..., - в статье постепенно пишется своя библиотека Parser Combinators и сравнивается с scala.util.parsing. Строятся парсеры для simple arithmetic expressions, xml, lambda calculus that tracks variable binding
- “Combinator Parsing, Chapter 31 of Programming in Scala, First Edition” — базовый учебник от Martin Odersky, Lex Spoon, and Bill Venners. Строятся парсеры для arithmetic expressions, json, . Есть второе издание, но оно не доступно в свободном доступе.
- “???” - ???
- “???” - ???
- “Monadic Parser Combinators”, Hutton + Meijer
— одна из статей, на которую опирался Одерский с товарищами при проектировании parser combinators для Scala - “How to replace failure by a list of successes: A method for exception handling, backtracking, and pattern matching in lazy functional languages, Wadler — ???
- “Higher-order functions for parsing”, Hutton — ???
- “Functional parsers”, Fokker — ???
- “Deterministic, Error-Correcting Combinator Parsers”, Swierstra + Duponcheel — ???
- “Parsec: Direct Style Monadic Parser Combinators: For The Real World” — ???
- “Packrat Parsing: Simple, Powerful, Lazy, Linear Time” — ???
- “Monadic Parsing in Haskell” — ???
- “Pickler Combinators (functional Pearl)” — pickler-ами в Haskell называют “сериализаторы”, специализированные функции для преобразования объектов в памяти в байтовые массивы. Предлагается построение picкler-ом для сложных структур данных получать как комбинации pickler-ов для базовых типов. This pearl was practically motivated: an SML version of the pickler library is used inside the SML.NET compiler. The essential new ingredient of pickler combinators is the tying together of the pickling and unpickling actions in a single value.
- “Instant Pickles: Generating Object-Oriented Pickler Combinators for Fast and Extensible Serialization” Miller, Haller, Burmako, Odersky — аналогичный подход (предыдущей статье) для Scala
- “Even Higher-Order Functions for Parsing or Why Would Anyone Ever Want To Use a Sixth-Order Function? (functional pearl)”, Chris Okasaki — парсер — это функция первого порядка, которая принимает входные данные, а возвращает результат разбора к каком-то формате. Комбинаторы парсеров — это функции второго порядка, которые принимают функции первого порядка (парсеры) и возвращают функции первого порядка (парсеры). Крис Окасаки смог найти разумную функцию шестого порядка связанную с парсерами.
- “scala-lang.org: Reflection: Overview” Miller, Burmako, Haller — ???
- “scala-lang.org: Reflection: Environment, Universes, and Mirrors” Miller, Burmako, Haller — ???
- “scala-lang.org: Reflection: Symbols, Trees, and Types” Miller, Burmako, Haller — ???
- “scala-lang.org: Reflection: Annotations, Names, Scopes, and More” Miller, Burmako, Haller — ???
- “scala-lang.org: Reflection: TypeTags and Manifests” Miller, Burmako, Haller — ???
- “???” - ???
- “???” - ???
- “???” - ???
- “???” - ???
- “???” - ???
- “scala-lang.org: Def Macros” Burmako — обзор макросов на scala-lang.org
- “scala-lang.org: Quasiquotes” Shabalin — обзор “квазицитат”
- “scala-lang.org: Macro Bundles” Burmako — обзор macro bundles
- “Scala Macros, a Technical Report”, Burmako + Odersky — ???
- “What Are Macros Good For?”, Burmako — макросы хороши для Code generation, Static checks, Domain-specific languages
- “???” - ???
- “???” - ???
- “Scala Macros: Let Our Powers Combine! On How Rich Syntax and Static Types Work with Metaprogramming” Burmako — ???
- “Scala Macros, a Technical Report” Burmako, Odersky — ???
- “Quasiquotes for Scala, a Technical Report” Shabalin, Burmako, Odersky — introduce quasiquotes for the Scala programming language, which solve the problem of manual tree construction and deconstruction. Included case studies show that quasiquotes indeed are easier to work with than existing tools for tree construction. When limitations of current implementation are lifted quasiquotes will become the ultimate tool for the tree manipulation.
- “Yin-Yang: Concealing the Deep Embedding of DSLs” Jovanovic, Shaikhha, Stucki, Koch, Odersky, Nikolaev — описание библиотеки Yin-Yang, представляющей собой инструмент для построения “deeply embedded domain-specific languages” благодаря использованию макросов
- “learning Scalaz” — отличный online-учебник из 22 уроков.
- “Scalaz — Resources For Beginners” — большая подборка ссылок по Scalaz
- “Introduction to Category Theory in Scala”
- “Applicatives are generalized functors”
- Apocalisp blog — OLD blog of “Functional Programming Scala” author
- Higher Order. Philosophy and functional programming. — NEW blog of “Functional Programming Scala” author
- “Scalaz: For the Rest of Us” — что можно делать на Scalaz БЕЗ понимания теории категорий
- Full code of example: io.netty.example.echo.* — простые echo-клиент и echo-сервер на Netty
- Full code of example: io.netty.example.telnet.* — простые telnet-клиент и telnet-сервер на Netty
- Full code of example: io.netty.example.factorial.*
- Full code of example: io.netty.example.http.* — простые http-клиент и http-сервер на Netty
- Full code of example: io.netty.example.socksproxy.* — простой SOCKS5-прокси на Netty
- “Netty Best Practices” — советы от автора “Netty in Action”
- Netty 4 at Twitter: Reduced GC Overhead
- Related articles — список из более чем 100 статей, рекомендуемых авторами Netty
- Terminology, Concepts — Concurrency vs. Parallelism, Asynchronous vs. Synchronous, Non-blocking vs. Blocking, Deadlock vs. Starvation vs. Live-lock, Race Condition, Non-blocking Guarantees (Progress Conditions)
- Actor Systems — Hierarchical Structure, Configuration Container, Actor Best Practices
- What is an Actor? — Actor Reference, State, Behavior, Mailbox, Children, Supervisor Strategy
- Supervision and Monitoring
- Actor References, Paths and Addresses
- Akka and the Java Memory Model — The Java Memory Model, Actors and the Java Memory Model, Futures and the Java Memory Model, STM and the Java Memory Model, Actors and shared mutable state
- Message Delivery Guarantees
- Scala API: Actors
- Scala API: Typed Actors
- Scala API: Event Bus
- Scala API: Scheduler
- Scala API: Futures
- Scala API: Dataflow Concurrency
- Scala API: Fault Tolerance
- Краткое описание компонентов Finagle: — Protocols, Futures, Services & Filters, Servers, Clients, Names, Metrics
- “Finagle: A Protocol-Agnostic RPC System” — пост от команды Twitter-а о Finagle
- “How to build a simple distributed search engine using Scala and Finagle framework” — лекция в рамках проекта Twitter.com / Scala school.
- “Thrift: Scalable Cross-Language Services Implementation” — опорная статья по протоколу Thrift. Этот протокол является самым популярным “несущим протоколом” для Finagle
- “ZooKeeper Programmer’s Guide” — хорошее описание (Data Model, Sessions, Watches, access control, Consistency Guarantees, Common Problems and Troubleshooting).
- “Programming with ZooKeeper — A basic tutorial” — примеры реализации барьеров и архитектуры производитель-потребитель.
- “ZooKeeper Internals” — Atomic Broadcast, Leader Activation, Quorums
- “ZooKeeper Recipes and Solutions” — создаем на основе Zookeeper распределенные барьер, очередь, блокировку. Делаем two-phase-commit и leader election.
- “The Chubby lock service for loosely coupled distributed systems” — описание библиотеки от Google. Zookeeper делался опираясь на его архитектуру, почерпнутую, в том числе, из этой статьи.
- “Zab: High-performance broadcast for primary-backup systems” — описание протокола Zab, который лежит в основе Zookeeper.
- “ZooKeeper: Wait-free Coordination for Internet-scale Systems.” — базовая статья от Yahoo (а Zookeeper был разработан там для координации HDFS/Hadoop-кластера).
- “ZooKeeper — A Reliable, Scalable Distributed Coordination System” — статья на infoq.com
- “Composing Contracts: An Adventure in Financial Engineering”, Simon Peyton Jones + ... — базовая статья от автора Haskell на представление финансовых контрактов на Haskell.
- “Commercial Uses: Going functional on exotic trades” — описание DSL используемого в Barclays для работы с финансовыми инструментами (Haskell)
- “Financial Domain-Specific Language Listing - большая подборка API / DSL для работы с финансами
- “Scala at EDF Trading. Implementing a Domain-Specific Language for Derivative Pricing with Scala.”
- “Compositional specification of commercial contracts”
- “Generics of a Higher Kind”, Odersky + ... — детально описание higher-kind types от авторов
- “???” ??? — ???
- “???” ??? — ???
- “???” ??? — ???
- “???” ??? — ???
- “Internals of Scala Annotations” Lukas Rytz
— This document desribes the internals of annotations in the Scala compiler. It explains how symbol and type annotations are represented at different phases of the compiler, how annotations are saved to bytecode and how compatibility with java annotations is achieved. - “The Scala Language Specification Version 2.9”, Chapter 11 “User-Defined Annotations” — lists all pre-defined annotations and explains their behavior. Java Platform Annotations = @transient, @volatile, @SerialVersionUID, @throws. Java Beans Annotations = @scala.beans.BeanProperty, @scala.beans.BooleanBeanProperty. Deprecation Annotations = @deprecated, @deprecatedName. Scala Compiler Annotations = @unchecked, @uncheckedStable, @specialized.
- “???” ??? — ???
- “???” ??? — ???
- “???” ??? — ???
- “The Mystery Of The Parameterized Array” Matt Malone — ???
- “Scala arrays” David R. MacIver — ???
- http://?? — ???
- http://?? — ???
- “Scala 2.8 Arrays” Odersky — This document describes the new scheme of handling arrays in Scala 2.8. Instead of boxing/unboxing and other compiler magic the scheme relies on implicit conversions and manifests to integrate arrays into the Scala 2.8 collection library.
- http://?? — ???
- http://?? — ???
- http://?? — ???
- http://?? — ???
28 коментарів
Додати коментар Підписатись на коментаріВідписатись від коментарів