Skip to main content
Version: v1.4

πŸ““ 3.1.0.1 Functional Programming with JavaScript Objectives

Up to this point, we have focused on object-oriented programming. However, there are other paradigms beyond object-oriented programming. One of the most useful and popular paradigms is functional programming. In this section, we will focus on learning how to program using a functional approach.

Having at least a basic understanding of functional programming is essential to progressing as a developer. Moreover, functional programming patterns are foundational to React.

Good news: you've already been doing some functional programming! Every time you've used map() or filter(), you were using FP techniques. This section will help you understand these patterns more deeply and use them intentionally.

In this course section, we'll cover the following:

ConceptWhat It MeansWhy It Matters
Pure functionsFunctions that always return the same output for the same inputEasier to test and debug
ImmutabilityNever modifying existing dataPrevent unexpected bugs
Array methodsmap(), filter(), reduce()Clean, readable data transformations
ClosuresFunctions that "remember" variables from their outer scopeFoundation for many patterns
Function factoriesFunctions that create other functionsReusable, configurable code
CompositionBuilding complex functionality from simple piecesFlexible alternative to inheritance
RecursionFunctions that call themselvesElegant solutions to certain problems

Some of these concepts can feel abstract at first. That's normal. You don't need to master everything immediately - focus on building familiarity and getting practice.

How This Differs from OOP​

Object-OrientedFunctional
Focuses on what things are (a User, a Game)Focuses on what things do (transform data, calculate values)
Organizes code into classes with methodsOrganizes code into small, reusable functions
Often mutates object stateAvoids mutation; creates new values
Uses inheritance to share behaviorUses composition to combine behaviors

Professional developers use both paradigms. The goal isn't to abandon OOPβ€”it's to add functional techniques to your toolkit and know when each approach fits best.

Testing​

You're expected to write tests for all your functions throughout this section. See A Note on Testing for details on what to expect and setup references if you need them.

Independent Project Objectives​


For this course section, the independent project will be different from previous weeks. You will spend your normally scheduled independent project time brainstorming and preparing an idea for your Capstone project. The Capstone project is a larger project that you'll spend a majority of the final course crafting, with the intention that you will be able to leverage this project to showcase your skills to employers, and explore ideas and concepts that you're interested in that haven't been covered in classes.

Keep in mind that you're not beholden to any ideas you come up with at this point. The main goal we have with this section is to get you thinking about project ideas early on, and teachers will be able to provide you with feedback and advice to help you approach your most successful ideas later on.

For this first Capstone exploration, the objectives are fairly simple:

  • An idea board(s) to show us your thought process and what other project ideas you considered
  • Includes a one page outline of capstone project.