reading-notes

Reading notes for Code Fellows Courses

View project on GitHub

Notes on Functional Programming

Functional Programming Concepts

  • What is functional programming?

A programming style that avoid changing states or data, but rather evaluates functions to build out the structure and content of an application.

  • What is a pure function and how do we know if something is a pure function?

Strictly, if it meets two criteria. One, it is deterministic: always returns the same result give the same arguments/inputs. Two, no observed side effects are caused by its functioning.

  • What are the benefits of a pure function?

It is easier to test it with various inputs/parameters, and get the expected results.

  • What is immutability?

Not changing or changable over time after being created.

  • What is Referential transparency?

The quality of consistently yielding the same result given the same input. It is also the result of having pure functions working with immutable data: the functions are predictable, the data doesn’t change, so you always get the same results.

Node JS Tutorial for Beginners #6 - Modules and require()

  • What is a module?

Each piece of an app (additional JS file) that holds a different part of code with a particular functionality for the overall app, and they are called upon when needed.

  • What does the word ‘require’ do?

It helps to bring the functionality of a global object into another model, as long as the path is included in the () that follow the word require.

  • How do we bring another module into the file the we are working in?

It has to be exported from the module where it was created.

  • What do we have to do to make a module available?

create a new variable and set it equal to the require method with the path to the module.