"Why should I learn Functional Programming?"
Most software written today, is
difficult to understand,
challenging to test,
hard to change and
filled with hard find
Ouch! So how do we end up with these problems?
Here’s a few of the many reasons:
- Not using the simplest building blocks possible… If you start with something complicated, you’ll end up with something even more complicated.
- Programming in a style that is more susceptible to complex bugs
- Not properly respecting and handling Side effects(talking to servers, input / output, etc)
- “Sprinkling” Application State all throughout codebases
- Unnecessarily mutating data
- Code Duplication (particularly sneaky ones, like similar class methods in Object Oriented Programming )
- Writing more code than necessary
These are just a few of the many problems that lead to frustrating jobs, working on codebases that are hard to maintain and add features to.
Functional programming addresses the above problems in the following ways:
- Simpler apps, because functional programming uses the simplest building blocks possible, just plain old data and pure functions to transform the data (easier to understand and work with)
- Uses code styles that are simpler and less prone to complicated bugs (more time doing productive work)
- Eliminating Side Effects, as much as possible and controlling them when they are needed (reduces bugs)
- Avoids data mutation as much as possible (reduces bugs)
- Uses pure functions, that can work with many different types of data (improved code reuse)
- Uses generalized functions, that can be specialized to suit different needs (less code, same functionality)
- Creating new functions, without adding any new logic, using function composition (more functionality, no code added)
Functional programming, in my experience, is
more productive than Object Oriented Programming because there are fewer things to think about, so you don’t
overwhelm your working memory. Usually your just thinking about plain old data, and data transformations, using functions.
Additionally, in Functional Programming, there aren’t tons of competing ways of doing the same thing, so you
don’t have to
think about unnecessary things. Functional Programming is constraining, and thats a good thing. You’re
able to better focus, on the problem you’re solving, rather than the tools you’re using to solve the problem.
In Object Oriented Programming, you have to think about many different types of complicated, stateful objects that can be interacted with in different ways. You’ve got to think about more than just data, and data transformation… You’ve got to think about things like State and Side Effects, far more than you do in Functional Programming.
“What will I learn in this course?”
You'll learn how to create front end web applications in a Functional Programming Style, through hands on learning. You'll be building 5 significant web applications in this course, from the ground up. At the end of this course, you'll understand and appreciate the things that are important to Functional Programmers and odds are, you'll fundamentally change how you write programs.
“What frontend framework will I learn?”
We won't be using any frameworks, but we will use a few helper libraries where it makes sense as described below.
The main focus of this course is teaching you Functional Programming concepts. Manually writing everything from scratch, could very well distract from the core concepts, so to stay focused, we'll use a few libraries where it makes sense.
- Hyperscript - We'll use the hyperscript library to generate html and css. For example, we'll call hyperscripts 'div' function to generate html divs. ie div('hello') => <div>hello</div>
- Tachyons - This is a css framework that embraces Functional Programming concepts like composition.
- Webpack/Babel - We'll setup a minimal build system using webpack, babel and a few related plugins. This is a onetime setup step.
- Virtual-Dom - We'll use a virtual dom library to efficiently update webpages. This is the technology used by modern frameworks like React and Vuejs. This is a onetime setup step.
“I'm a backend developer, but I'd like to learn Functional Programming... Should I take this course?”
“Isn’t Functional Programming just a small niche in Computer Science?”
This used to be true, but not anymore. For decades Object Oriented Programming was the dominant force in software development, but in the last few years Functional Programming has had huge growth, and it’s used in big companies like Facebook, Twitter and even Walmart. But it’s not just the big companies that are using Functional Programming, small and medium sized companies all over the world are turning to Functional Programming.
In December 2017, Forrester research released a study titled “The New Dawn Of Functional Programming”, which asserts “Functional Programming is beginning to hit the mainstage… the software development world is outgrowing stateful, object-oriented development”.
It always makes sense to learn upward trending technologies, and Functional Programming is an excellent choice for this reason and many more.
“Don’t I have to be a Math genius to understand Functional Programming?”
Absolutely Not! For decades the primary adopters of Functional Programming, were largely academics and people interested in specialized areas of Math. During that time, most working programmers (myself included) didn’t really understand Functional Programming, and the people who did understand Functional Programming, didn’t do a great job explaining what it was, what the benefits were, how to do it… etc.
The truth is, you don’t need to be a Math genius to understand Functional Programming. The essence of Functional Programming, has little to do with Math, which you’ll see in this course.
“Won’t I have to learn a whole new vocabulary to understand Functional Programming?”
No! I won’t bombard you with unneeded technical Jargon, in fact I avoid it as much as possible, and when I do use new Functional Programming vocabulary, it’s usually just to associate a name, to something you already learned with plain old spoken english.
“Will the knowledge I gain in this course be obsolete in a year or two, just like my Angular 1 knowledge is?”
No! What you’ll learn in this course will be relevant and useful for years and probably decades.
“How is that possible?”
Because, I’m not teaching you functional programming in the context of particular framework like React or Vue.js. Frameworks come and go, but the skills you’ll learn in this course transcend the popular framework of the day.
“How is it that Code written in a functional programming style, is less prone to have hard to find bugs?”
The most difficult to find and fix bugs, are related to code that allows Side Effects (talking to servers, state changes etc). Functional Programming puts a significant emphasis on Eliminating and Controlling Side Effects... So, it would make sense that eliminating Side Effects where possible, and tightly controlling side effects when they are needed would result in fewer complicated bugs.
“You say Functional Programming is simple, but I’ve tried Functional Programming and it was hard!?”
Ah, I didn’t say it was easy, I said it was simple. Writing simple code, isn’t easy, often it’s difficult. But sophisticated software built with a simple codebase is a thing of beauty, and it’s totally worth it.
If you know and love Object Oriented Programming, you may be in for a challenge. Much of what you know about programming, must be re-evaluated and often disregarded. I suspect, it might be easier for a new programmer to learn functional programming vs an experienced Object Oriented Programmer, because Functional Programming is so different from Object Oriented Programming… But again, it’s totally worth it :)
“I don't understand some of the things your talking about like 'side effects' and 'pure functions'?”
Don't worry, in this course I start with the very basics, so you should have no problem following along. Additionally, I offer some very unique, free options for getting help, which I describe in the video, on how to get help.
“Is this course for me?”
This course is meant for 2 types of students:
- New programmers who have taken an introductory programming course
- Experienced programmers who are interested in learning Functional Programming *
* There might be a couple videos the Experienced programmer could skip, but I suggest re-familiarizing yourself with the basics, as they are presented from a Functional Programming Perspective.
If you’re not sure if this course is right for you, remember there is virtually no risk to you as you’ll have 30 days to return the course for a refund.
“Why should I take this course from you?”
My courses are different from most Instructors. I don’t believe a course should cover every single part of a language or technology.
I’ll explain why with an
Imagine you wanted to learn Spanish. One approach to learning Spanish would be to learn every single Spanish word. There are around 100,000 words in a Spanish dictionary... ouch!
Here’s the thing, 1,000 Spanish words that make up 80% of all spoken Spanish… 2,000 words makeup 95% of all spoken words.
Wouldn’t it be better to focus on learning the 1,000 or 2,000 most used Spanish words? You’d be fluent much quicker… In fact, trying to learn all 100,000 Spanish words, kind of sounds ridiculous, when you realize most of them are never used.
These same principles apply to Programming Languages and Technologies. Many instructors make 10, 20 and +30 hour
courses, jam packed full of stuff you could just avoid!
James discovered the joy of software development while submerged hundreds of feet deep in the pacific ocean. He liked it so much, he left his career as Navy Nuclear Submariner to learn everything he could about creating software. As a nuclear trained engineer, he figured out how to learn things quickly, which has helped in a career where the learning never stops. Currently he’s an independent software developer, consultant and trainer.