reading-notes

My reading journal for Code Fellows.


Project maintained by mattlarkin8 Hosted on GitHub Pages — Theme by mattgraham

Functional Programming

Functional Programming Concepts

What is functional programming?

Functional programming is a style of building the structure and elements of programs. It treats computation as the evaluation of math functions and avoids changing-state and mutable data.

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

A pure function is one that returns the same result if given the same arguments and does not cause any observable side effects. A function is pure if it meets this definition.

What are the benefits of a pure function?

A benefit of pure functions is that they are easier to test.

What is immutability?

Immutability means that something does not change over time and that it cannot be changed. For data, this means that its state cannot be changed after it is created.

What is Referential transparency?

If a function consistently yields the same result for the same input it is referentially transparent.

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

What is a module?

Modules are similar to React Components. They are small pieces of code that serve a single purpose and are therefore reusable just like components. You can modularize your code to organize it the same way that you can componentize a React app.

What does the word ‘require’ do?

Require is like Import in React. It allows you to bring in code from another module.

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

You must require it by specifying the file path of the module you want to access.

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

You have to export what you want to send out of that module so that it can be accessed elsewhere via require.

Things I want to know more about

I am excited to get practice using Export and Require. Nesting components was a big way of organizing and reusing code in React and that seems to be the same case here with modules.