A Partial Application is a function where some or all of the arguments are packed inside, ready to go and it’s just waiting for a few more before the main function is invoked. They’re like functions that have default arguments, but are pure functions with a fixed amount of parameters.
The following article and companion video playlist will cover what a partial application is and how it can be used for a more pure function option for default arguments. It’s assumed you know what pure functions are. We’ll cover:
Continue reading “What Are Partial Applications?”
- basic function arguments
- default arguments and how order can make them harder/easier to use
- function arity
- function currying with closures and show how the parameter order is reversed compared to default arguments
- building partial applications to show how to make using default arguments pure
- creating partial applications with no arguments
Next, Logging, and Conclusions
Welcome to Part 6, the final installment in this series. Below we cover unit testing the noop
next, how to create pure functions that wrap
noop so you can compose them, and finally using code coverage to strategically hit the last code that’s not covered.
Continue reading “Functional Programming Unit Testing in Node – Part 6”
Noops, Stub Soup, and Mountebank
Welcome to Part 5 where we cover more about noops with a utility to test them, the “stub soup” that can happen if you don’t create small pure functions, and how we can utilize stubs instead of mocks to unit test larger functions. The most important part, though, is setting up Mountebank to show how integration tests can show problems in your unit tests despite 100% coverage. We use wrapping
class instances as an example to show you the pitfalls Object Oriented Programming code can make for you.
Continue reading “Functional Programming Unit Testing in Node – Part 5”
Concurrency, Compose, and Coverage
Welcome to Part 4 where we show how to do concurrency which is a lot easier to get “for free” using pure functions, we compose both async and synchronous functions, we and utilize a test coverage report to where next to focus our refactoring and testing efforts.
Continue reading “Functional Programming Unit Testing in Node – Part 4”