Code Monkey home page Code Monkey logo

pure-function-as-an-object's Introduction

Pure Function As An Object (PFAAO) Pattern Demonstration

This is a tiny project to demonstrate the PFAAO pattern. It converts a JSON document to an XML document. The accompanying article article is available here: http://www.rubypigeon.com/posts/the-pure-function-as-an-object-pfaao-pattern/

Running The Code

First, install the dependencies with:

bundle install

Then run the code with:

bundle exec ruby convert.rb

Acknowledgements

The input.json data set comes from JSON Studio website:

http://jsonstudio.com/resources/

This pattern is inspired and influenced by all of Rich Hickey's Clojure talks and Casey Muratori's API design talks.

pure-function-as-an-object's People

Contributors

tomdalling avatar

Stargazers

Nam Ho avatar Kyle Behrens avatar  avatar kb avatar Jason Hou avatar Mohamad Abras avatar Aboobacker MK avatar Aaron McAdam avatar Shane Delmore avatar Nicolò G. avatar

Watchers

 avatar Wolfgang avatar James Cloos avatar Mallikarjuna avatar

Forkers

eric1234

pure-function-as-an-object's Issues

Avoid calling private methods with `.send`

I like your whole approach and the way you structure your code.
There is only one thing that hurts me a bit. In .convert you call #send(:xml). With this you 'cheat' on your own implementation.
To get around this you could call #xml in your initializer. I don't know whether this is the right solution to the problem though :)

I would love to hear about your thoughts regarding this topic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.