From the course: Learning Functional Programming with JavaScript ES6+
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Object oriented to functional approach - JavaScript Tutorial
From the course: Learning Functional Programming with JavaScript ES6+
Object oriented to functional approach
- [Instructor] If you're coming from an object-oriented background, it may seem strange to you that functional programming places an emphasis on keeping data and functions separate, since one of the central concepts of object-oriented programming is that we put data and the functions related to that data together in objects. To understand why it makes sense to keep data and functions separate in functional programming, it might be helpful to think about why we keep them together in object-oriented programming in the first place. The main reason that it's useful to keep data and functions together in the same object is that this allows us to interact with the member variables of an object without touching them directly. What's wrong with touching variables directly? Well, if we give programmers direct access to variables, they can, and in my experience will, change them in ways that they're not supposed to. Consider the simple case of a Person object with publicly accessible properties…
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)
-
-
-
-
-