Giter Site home page Giter Site logo

iwoherka / fyra Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yanatan16/fyra

0.0 1.0 0.0 61 KB

Experimental framework based on Functional Relational (not Reactive!) Programming

License: MIT License

Clojure 96.48% JavaScript 2.82% HTML 0.71%

fyra's Introduction

fyra

A clojure implementation of Functional Relational Programming as introduced by Marks and Moseley in Out of the Tar Pit.

TLDR This project is basically an experiment to see if adding the Relational model to modern clojurescript web programming can improve it.

Background

Work in Progress

This is in a very early stage, as I am learning how to implement a relational query engine as well as exploring the design strategies of Functional Relational Programming, as well as designing a new DSL in clojure (and the macro funkiness to go along).

Eventually, I'd like to see if this paradigm can scale out to web application design, where shared definitions of relvars and views allow a react-based front-end and an RDBMS-backed server to communicate efficiently and stay in sync. All with the hopefulness of avoiding the complexity of state management.

Functional Relational Programming (FRP')

Functional Relational Programming (FRP') is not to be confused with Functional Reactive Programming, which is a different paradigm.

FRP' was introduced in Out of the Tar Pit, which is worth the read if you think all software is broken. In the paper, the authors suggest this new paradigm for writing programs.

FRP' is basically the following:

  • A set of relations (relvars) which comprise the essential state of the system
  • A set of views (relvars derived using relational algebra) which comprise the way a system will look at its essential state
    • These views can use pure functions to arbitrarily modify the relational values
  • A set of feeders, which input and change data in the system (insert/update/delete)
  • A set of observers, which update output to other systems/the user upon change of a monitored relvar.
  • A set of performance and optimizing "hints" that have nothing to do with the outcomes of the system

Why I'm experimenting

After reading about this, I wondered how a system like this could fit with a react framework, such as reagent. Reagent already provides much of the "observer" mechanism by monitoring Reagent atoms for changes and updating components as necessary. Feeders can be in on-click handlers and the like.

But there are still issues lingering in modern clojurescript web apps, especially because state, whilst encouraged to be kept in one place, is still user managed and often stores more than it needs. Additionally, I have never encountered a server sync abstraction that didn't leak, but perhaps this project might lead me to one that won't (doubt it :/).

FRP' encourages separation of all these issues: core state, how the app interacts with state, actual parts that do interactions, and most importantly: how state is managed and stored.

So I think there might be something here. I'm probably wrong, because its been almost 10 years since the paper came out and I couldn't find any popular FRP' libraries. But who knows.

Documentation

Currently, you'll have to read some code.

Examples

The real estate example from the original paper is reproduced here.

TODO

  • enable the example
  • add api for storage hints
  • implementation for cljs/reagent
  • implementation for postgres

License

See LICENSE file.

fyra's People

Contributors

yanatan16 avatar

Watchers

 avatar

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.