Skip to content

Instantly share code, notes, and snippets.

@veremey
Forked from oleksiilevzhynskyi/grammarly_web_frontend_resources.md
Created November 23, 2021 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veremey/10ea3246674c39d375b678cb5bcd9fad to your computer and use it in GitHub Desktop.
Save veremey/10ea3246674c39d375b678cb5bcd9fad to your computer and use it in GitHub Desktop.
FP+FRP
  1. Software Design
  2. Functional Programming
  3. FRP
  4. Embrace

Software Design

Read "Code Complete 2" by Steve McConnell to know/refresh common architecture practices. It's widely considered book of the best practical guides to programming for more than a decade. Then read "Domain-driven design" by Eric J. Evans to get familiar with one more approach to thinking about applications. Btw, we believe there is always a reason to follow SOLID or its modern interpretation if it.

Functional Programming

To get a brief overview of how to start thinking in FP-way, read Mostly adequate guide to FP. It's light and full of examples on JS. To get deep knowledge and level-up read Functional Programming in Scala (or gitbook). It's a serious tutorial for programmers looking to learn FP and apply it to the everyday business of coding. The book guides readers from basic techniques to advanced topics in a logical, concise, and clear progression.

We're using fp-ts on production. To get familiar with it, walk through the guide below:

Functional programming with fp-ts by its author Giulio Canti and others

Below are the most common patterns that are used in FDD. Learn them to get the most of your monads!

"Patterns" to use:

FRP

Start with A General Theory of Reactivity to get the concept of reactivity and how it could be mapped to your existing experiences. To bootstrap and start writhing FRP code right-away read The introduction to Reactive Programming you've been missing (by @andrestaltz). For more fundamental knowledge in building software in FRP way read Functional Reactive Programming. Stephen Blackheath and Anthony Jones or Front-End Reactive Architectures by Luca Mezzalira. Both books are pretty short, but provides a required base to start getting benefits from using reactive manifesto in your applications.

RxJS

In practive, we're using RxJS. Before writing own operator, search in this reference, there is always something suitable. To get the difference between all kinds of map, read "Comprehensive Guide to Higher-Order RxJs Mapping Operators: switchMap, mergeMap, concatMap (and exhaustMap)"

Focal

@grammarly/focal is type-safe, expressive, and composable state management for React applications. It based on calmm-js ideas. Read the introduction here: https://github.com/grammarly/focal/blob/master/README.md

Lenses and Optics

Focal uses conceprt of Lenses. There are two useful articles about lenses: one with js examples and one about "More Intuition on Optics"

Embrace

The complex projects require us to find new ways to build the front-end. That's why at some point, we decided to go even further and built a typesafe, declarative, and composable UI engine on top of React and Focal. Embrace makes UI representation truly declarative: It treats UI components as data, which can be traversed, modified, logged, and more. Check out a great article about reasons why we made it and try out Embrace for yourself.


TODO:

  • covariance and contravariance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment