I didn’t like it, at first

When I initially learned functional programming I wondered why a library would be written, filled with jargon, and expected to become my method of problem solving. What justifies adding a library to do something I can already do with normal JavaScript? I found the answer to that question after I learned functional programming without JavaScript.

Functional programming is not a JavaScript specific concept. It’s a paradigm. A style. A mindset. It changes the way you approach problem solving, from trying to figure out how the computer should achieve the solution, to deciding what operations/transformations to apply to your data structure to achieve a final result. The benefit is that you are at a much smaller risk of running into errors because a description of the operations is easier for your brain to create abstractions from than a sequence of instructions. …


Image for post
Interactive marble diagram from http://rxmarbles.com

When I first learned about observables I was sceptical about what value I would get from them. Many of the operations they provide are already available with `Array#functions` and ES6 `Promises`.

What could possibly be the benefit of adding this entire library and adding the extra cognitive load to do something I can already do with modern JavaScript? — Me, evaluating Observables

I usually use React when I write Single Page Apps, and add Redux when I need some sane state management. This works well when you have simple functions that make backend calls and update state when the result is received, however firebase uses WebSockets to give you realtime updates as your data changes. …


After learning about React and redux I found two barriers to my adoption of them:

  • Creating and maintaining a sane folder structure.
  • Managing large forms.

Like most people, I thoroughly enjoyed redux after learning it. I used it for every project until I grew tired of the amount of boilerplate involved. I started skipping it on some components, and eventually, entire projects. This quickly came back to bite me when I started to see inconsistent state in my applications.

It can also be really tedious to build forms with more than 3 inputs while trying to stay within the bounds of the advice you receive in the React community (don’t use refs, maintain a single source of truth for state etc). …


Deploying to Kubernetes

Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications

There are three key points to understand in Kubernetes:

  • Cluster — a set of VMs (called nodes) that will be used to run your containers
  • Deployment — an instance of your app. If your app does not need to expose any endpoints to the outside world then this will be all you need (e.g. your app only communicates with other containers in your cluster, only fetches data from another external API, or it connects to an amqp exchange and processes messages). …


Pushing to a container registy

Google Container Registry is a private registry for docker images. We want to push our images there after building them in wercker so that we can easily pull them when we want to use them (i.e. when we are running them in Kubernetes).

We create a push pipeline using one of wercker’s internal steps, internal/docker-push.

Note: you need to create a service account on your google cloud project, so that wercker can use it to upload your images to the registry. …


Wercker

Wercker is a platform for building and deploying your app using containers. It gives you a cli you can use to not only test your build locally, but also run a development container that watches your files and restarts automatically.

There are three key terms to understand in wercker:

  • Step: a single unit of work, a command that must be executed. For example echo node -v or npm install. You can use predefined steps available from wercker’s registry, you can also create your own steps, and you can specify any arbitrary bash commands in a `script` step.
  • Pipeline: defines a series of steps that must be executed in sequence. e.g. `build`. You write these in your wercker.yml in the root of your project. …

About

Alpha Shuro

Most of my life is spent on practical philosophy, coding, gaming, and living.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store