Monday 6 February 2017

Functional Rails API

A while back I wrote a library called rfunk. This library provides some functional programming concepts that you can give a try or contribute to if you like.

I know there are other libraries now out there and they might do a better job. Regardless I wanted to try it out to see how one might build an API that used these concepts.

Here you can find the controller that performs the action and the associated features to see it working. I think it clearly defines what a success case might be and what a failure is.

The whole repository is here if you want to check it out. Might add more features as I go along. I hope you enjoy it!

Sunday 5 February 2017

Cucumis

After getting tired of writing the same steps over and over in Cucumber I decided to start a gem. Currently in it's infancy though I plan to grow it as time goes on.

It currently supports the following:

  1. Checkin ActiveRecord models wiht the table provided.
  2. Checking a table matches a HTML table.
  3. Sets up all sorts of browsers so you can quickly switch between them (headless and real)
Check it out and contribute if you like. You can find it here.

KnockoutJS

Recently I had the opportunity to do some work with this awesome framework. Not like any other JS framework that I have used before.

In the past we all have had the obsession of usually writing two versions of an MVC application both in the front and the back.

Though for me this felt liberating (it just uses data-bind attributes). The front end was all seperate from the backend. Meaning I could replace the backed with whatever technology I wanted (I chose Ruby On Rails) and the application would still work. The caveat is that you generate the same HTML (which should not be an issue, until you redesign). The MVVM pattern is really exciting and can't wait to try it out on other technologies.

It does not lock you into any testing framework. Does not tell you how to get the data from the server (use Backbone or jQuery as examples). Doesn't tell you how to route (I chose Navigo). Having this flexibility for me was so good as I was learning and when I hit an issue I could not solve I could just replace it

The only downside that I found was with testing (as I do all my testing in Cucumber) was that it could not be used with a headless browser (webkit or poltergeist), so you have to use either Firefox or Chrome with selenium-webdriver. I am sure that this will get better.

Highly recommend learning it and it has great support online. If you get some time check it out KnockoutJS and its great tutorials.