Reading Journal
Understanding functional programming concepts teaches me to write code in a way that’s predictable and easier to test, improving overall performance and through the use of modules. Learning about modules and using require in Node.js allows me to reuse code effectively, improving maintainability in our projects. These concepts are critical in building scalable software solutions and building essential skills.
Reading
Functional Programming Concepts
1. What is functional programming?
- It’s a programming method that focuses on functions as the primary building blocks of software and focuses on constructing code to avoid any unwanted side effects.
2. What is a pure function and how do we know if something is a pure function?
- A pure function is a function that always produces the same output for the same input and doesn’t cause any unwanted side effects.
3. What are the benefits of a pure function?
- Predictability, testability, performance, modular composition.
4. What is immutability?
- Immutability refers to the data that is created becoming consistent throughout the program’s lifecycle.
5. What is Referential transparency?
- It means that you can swap out a piece of code and its result, and in doing so, the program will still work the same.
Videos
Node JS Tutorial for Beginners #6 - Modules and require()
1. What is a module?
- It’s very similar to components in React.js. Modules are reusable pieces of code that can be easily imported into other parts of a program.
2. What does the word ‘require’ do?
- It is a module bundler that is used to import other modules into your existing code for use.
3. How do we bring another module into the file that we are working in?
- We would use the
require function. It could be written like this, const moduleName = require(module-name);
4. What do we have to do to make a module available?
- First you have to define the variable or function you want to share, then you export them using
module.exports.
Things I want to know more about.
I would really like to be more comfortable with the terminology that is presented in this section. I get it when I look it up, but off memory…it’s a little confusing.