From the course: Learning Functional Programming with JavaScript ES6+
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Separation of data and functions - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
Separation of data and functions
- [Instructor] The second main concept of functional programming is the separation of data and functions. This is a case where functional programming is directly in contrast with object-oriented programming, where data and functions are almost always grouped together. Let's see what this looks like. First of all for our purposes, let's discuss what data and functions actually are. For our purposes, data might be any values that a program contains, people's names, addresses, and social security numbers in a payroll program, the models, years, and colors of cars on a used car website, the positions, health levels and weapons of characters in a video game, anything. All of this is data. In object-oriented programming, this data is usually wrapped up inside objects as member variables, and the only way we can access it is using an object's methods. In functional programming on the other hand, this data is represented by simple arrays and hashes, or in this case, JavaScript objects. And a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
The goal of functional programming3m 38s
-
(Locked)
Declarative vs. imperative programming2m 46s
-
(Locked)
Immutability4m 18s
-
(Locked)
Separation of data and functions1m 47s
-
(Locked)
Object oriented to functional approach3m 29s
-
(Locked)
First-class functions2m 33s
-
(Locked)
Ensuring immutability: ESLint3m 14s
-
(Locked)
Ensuring immutability: Install ESLint1m 14s
-
(Locked)
Ensuring immutability: Finalize ESLint2m 27s
-
(Locked)
-
-
-
-
-