Skip to content

Commit

Permalink
Merge 12b64c7 into 036e0e6
Browse files Browse the repository at this point in the history
  • Loading branch information
ds300 committed May 2, 2016
2 parents 036e0e6 + 12b64c7 commit c8c9ee1
Show file tree
Hide file tree
Showing 46 changed files with 1,700 additions and 1,861 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "presets": ["es2015"] }
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"semi": 2,
"no-undef": 2,
"comma-dangle": [2, "only-multiline"]
},
"env": {
"node": true
}
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.*
!.gitignore
!.travis.yml
!.eslintrc.json
!.babelrc*
npm-debug.log
node_modules/
coverage/
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "5.1"
- "4.2"
- "0.12"
after_success: npm run report-coverage
224 changes: 0 additions & 224 deletions Gruntfile.js

This file was deleted.

12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">DerivableJS</h1>
<h3 align="center">Observable State done Right</h3>

[![Join the chat at https://gitter.im/ds300/derivablejs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ds300/derivablejs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://badge.fury.io/js/derivable.svg)](http://badge.fury.io/js/derivable)
[![Join the chat at https://gitter.im/ds300/derivablejs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ds300/derivablejs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://badge.fury.io/js/derivable.svg)](http://badge.fury.io/js/derivable) [![Build Status](https://travis-ci.org/ds300/derivablejs.svg?branch=new-algo)](https://travis-ci.org/ds300/derivablejs) [![Coverage Status](https://coveralls.io/repos/github/ds300/derivablejs/badge.svg?branch=new-algo)](https://coveralls.io/github/ds300/derivablejs?branch=new-algo)
---

DerivableJS is a JavaScript implementation of **Derivables**.
Expand Down Expand Up @@ -31,18 +31,16 @@ DerivableJS is a JavaScript implementation of **Derivables**.

## Derivables

Derivables make it trivial to maintain consistent (i.e. sense-making) state at all times without requiring that it be kept all in one place. This is a huge win for those of us who develop complex systems with lots of moving parts because it eradicates an entire class of subtle-but-devastating bugs along with all the incidental complexity they fed upon, allowing us to spend more quality time getting intimate with our problem domain.
This library satisfies the notion that **changes in state should not cascade over time**, i.e. if the value of state A depends on the value of state B, updates to B should atomically include updates to A—*they should be the same update*. We don't seem to have a handle on this issue, and it causes serious mess in our brains and code.

This library satisfies the notion that **changes in state should not cause state changes**, i.e. if the value of state A depends on the value of state B, updates to B should atomically include updates to A—*they should be the same update*. We don't seem to have a handle on this issue, and it causes serious mess in our brains and code.

Derivables clean that mess up by enabling you to make elegant declarative statements about how your bits of state are related. Then, when you update any bits of 'root' state, clever computer-sciency stuff happens in order to keep everything—*every goshdarn thing*—consistent 100% of the time.
Derivables clean that mess up by enabling you to make pure declarative statements about how your bits of state are related. Then, when you update any bits of 'root' state, clever computer-sciency stuff happens in order to make sure that all the relevant updates happen at the same time, keeping everything—*every goshdarn thing*—consistent. Always. And here's another bombshell: that's done *lazily* on a fine-grained basis, so you never need to worry about wasting precious CPU cycles.

There are two types of Derivable:

- **Atoms** are simple references to immutable values. They are the roots; the ground truth from which all else is derived.
- **Atoms** are simple references to immutable values. They are the 'root' state mentioned before: the ground truth from which all else is derived.
- **Derivations** represent pure (as in function) transformation of values held in atoms.

Changes in atoms or derivations can be monitored by **Reactors**, which do not encapsulate values and exist solely for executing side-effects in reaction to state changes. Reactors can also be stopped and restarted when appropriate, and offer lifecycle hooks for the sake of resource management.
State management is as much about managing state as it is about managing side effects. And so changes in atoms or derivations can be monitored by things called **Reactors**, which do not themselves have any kind of 'current value', but are more like independent agents which exist solely for executing side effects. They are, essentially, smart callbacks.

Let's have a look at a tiny example app which greets the user:

Expand Down
Loading

0 comments on commit c8c9ee1

Please sign in to comment.