Reading-Notes

Reading Notes

Functional Programming Concepts

What is functional programming?

Functional programming is a declarative programming paradigm where programs are created by applying sequential functions rather than statements.

Each function takes in an input value and returns a consistent output value without altering or being affected by the program state.

These functions complete a single operation and can be composed in sequence to complete complex operations. The functional paradigm results in highly modular code, since functions can be reused across the program and can be called, passed as parameters, or returned. https://www.educative.io/blog/what-is-functional-programming-python-js-java

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

It returns the same if given the same arguements. They also produce no side effects and do not depend on global veriables or states.

What are the benefits of a pure function?

What is immutability?

The state cannot be changed after it is created.

What is Referential transparency?

In functional programming, referential transparency is generally defined as the fact that an expression, in a program, may be replaced by its value (or anything having the same value) without changing the result of the program. This implies that methods should always return the same value for a given argument, without having any other effect. This functional programming concept also applies to imperative programming, though, and can help you make your code clearer. https://www.sitepoint.com/what-is-referential-transparency/

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

What is a module?

Essentially another javascript file.

What does the word ‘require’ do?

It creates a path to the other modules to be able to use the variable globally.

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

module.exports = (whatever function you want to pull in); with a require in the other module

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

This seems like like the same answer, but by specifying a path and which function you want it should pull through.