josh.code

Posts

Simple React Drag and Drop

Up until recently I haven’t had the need to use drag and drop in my React projects. Then I did have the need. My need was simple, a list that could be reordered. I went searching for an example and everything I found just felt too complicated. I wasn’t worried about making it work. I was worried about having way too much boilerplate to reorder a list. I decided on using react-beautiful-dnd.

Practical Functional JavaScript: Testing Video

This video series mirrors the blog post series on creating a functional application in JavaScript. This will map closely with the third post of that series. We will cover how easy it is to setup testing when the code is functional. Watch and enjoy!

Practical Functional JavaScript: Why React and Redux? Video

This video series mirrors the blog post series on creating a functional application in JavaScript. This will map closely with the second post of that series. We will cover putting our functional backend together with the DOM. This is where the application becomes a useful item and not just a bunch of functions. In addition to this, we will cover fundamentally why React and Redux are awesome. While we do not use the actual React and Redux libraries, we use the same thinking behind our render functions and state management.

More Posts to come

It seems that I make this post every so often. My last post was made all the way back in February. That was already 5 months ago. I don’t think that many people “follow” my posts, but I know there are some that use RSS. Ultimately my plan is, as always, to have quality content that people find informative. I just get sidetracked at times from making blog posts. I have a regular 9-5 development job that takes up most of my time.

Practical Functional JavaScript

I have made a video to go alongside my last post series. In that series, I focused on showing what it means to write practical functional Javascript. Just like all my other posts, this is done by building something, a Mad Libs generator. The problems that arise from building a Mad Libs generator are perfectly suited to solving in a functional manner. The series is broken up into three parts, first creating a functional backend, then rendering it to the page, and finally testing.

Testing Functional Mad Libs

Testing Testing is very important, but sometimes it gets left behind. This can be because it is not clear how or even what to test. Tightly coupled code is a testing nightmare. It is very hard to unwind specific units of code to test. In addition to this mocking can become a huge task where you have to recreate all the resources the application needs. This is where functional design comes in.

Functional Front End: Why React and Redux?

So, Why React? We will start with React as we need to show how to modify the DOM. Here is some simple code that we will discuss. const R = require('ramda'); const IO = require('monet').IO; //IO monad stuff let addChildren = (elements, root) => { R.forEach((el) => { root.appendChild(el); }, elements); }; module.exports.render = R.curry((root, elements) => { return IO(() => { while (root.

Functional Mad Libs

Which leads me to the focus of this post. I have built a functional Mad Libs site. This came from a joke filled conversation at work about Mad Libs. The great thing about Mad Libs is that it is a perfect functional problem. There is a list of words. Some of the words need to be replaced. Get new words. Then replace the old with the new. This is an easy computational problem.

I found a functional way to build Express middleware

Using functional design is the new cool thing. This is especially true when talking about JavaScript. Functional programming can make complex code much simpler and much shorter. I am going to highlight some code that I wrote for my Packt Publishing video course, The Complete Guide to Node.js. I want to note first that this is not a perfect apples to apples comparison. It is also not a judgment on the code written for Express.

The Secret of Functional Programming in JavaScript

I just finished an amazing book by Luis Atencio named Functional Programming in JavaScript. It is published by Manning and you can purchase it from Manning. If you have been reading my blog you will see that I have been trying to push myself further into the functional paradigm. I have been classically trained as an object oriented programmer, much like most of the programming world. The idea of functional programming initially just seemed weird and something that people talked about, but never really implemented.