In continuing this series of posts about functional JavaScript (one, two), I whimsically wondered if we could apply the SOLID principles of object-oriented programming. We took a look at S last time (the Single Responsibility Principle), and were fairly successful. The principle I introduced there was not only that the functions we write should do one thing and do it well. If we can embrace global immutability, so much the better (in other words, the function should not have side effects). Small functions of this type are also well worth writing since they help document the code via their names. It’s now time to look at O, the Open/Closed Principle. […]
READ MORE