Skip to content

Commit 771216e

Browse files
author
Vlad Balin
committed
docs
1 parent 98f5b0e commit 771216e

File tree

1 file changed

+41
-44
lines changed

1 file changed

+41
-44
lines changed

docs/index.html

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -79,90 +79,87 @@ <h1 id="getting-started">Getting started</h1>
7979
<li>Ordered <em>collections</em> of records.</li>
8080
<li><em>Stores</em> to hold collections used to resolve id-references in JSON.</li>
8181
</ul>
82-
<p>The state defined with Type-R classes is deeply observable and serializable by default. While being an advanced JSON serialization engine handling sophisticated scenarios (like cross-collections many-to-many relationships), Type-R is completely unopinionated on the client-server communication protocol.</p>
82+
<p>The state defined with Type-R classes is deeply observable and serializable by default. While being an advanced JSON serialization engine handling sophisticated scenarios (like cross-collections many-to-many relationships), Type-R is completely unopinionated on the client-server transport protocol.</p>
8383
<p>Type-R is your perfect M and VM in MVVM and MVC architecture imposing no restrictions on V and C parts.</p>
84-
<h2 id="installation-and-requirements">Installation and Requirements</h2>
85-
<p>Is packed as UMD and ES6 module. No peer dependencies are required.</p>
86-
<p><code>npm install type-r --save-dev</code></p>
87-
<aside class="success">IE10+, Edge, Safari, Chrome, and Firefox are supported</aside>
88-
89-
<aside class="warning">IE9 and Opera may work but has not been tested. IE8 won't work.</aside>
90-
9184
<h2 id="how-the-type-r-compares-with-x-">How the Type-R compares with X?</h2>
92-
<p>The closest things to the Type-R are <a href="https://guides.emberjs.com/v2.2.0/models/">Ember Data</a>, <a href="http://backbonejs.org/#Model">BackboneJS models and collections</a>, and <a href="https://github.com/mobxjs/mobx">mobx</a>. It has an API resembling the one in BackboneJS, it supports transactional observable changes in the way close to mobx, and it has powerful serialization and validation capabilities as Ember Data.</p>
85+
<p>Type-R started to develop in 2014 as the modern substitution for BackboneJS, which would retain the spirit of the BackboneJS simplicity but would be superior to Ember Data in its capabilities and an order of magnitude faster than Backbone.</p>
86+
<p>The closest things to the Type-R are <a href="https://guides.emberjs.com/v2.2.0/models/">Ember Data</a>, <a href="http://backbonejs.org/#Model">BackboneJS models and collections</a>, and <a href="https://github.com/mobxjs/mobx">mobx</a>. </p>
87+
<p>There are a lot of similarities:</p>
9388
<ul>
94-
<li><p>Records attributes are typed at run-time. They are protected from assignment of incompatible types with run-time type assertions and conversions. Which means that the client-server protocol is protected agains errors from both ends. There are no </p>
95-
</li>
96-
<li><p>Records distinguish <a href="06_API_by_feature/01_Aggregation_tree.md">aggregated attributes</a> and those which are <a href="06_API_by_feature/04_Shared_objects.md">references to shared objects</a>. Aggregated attributes are serialized as nested JSON, while references might be <a href="06_API_by_feature/05_id-references_and_Stores.md">serialized as ids</a>. Operations like <code>clone()</code>, <code>dispose()</code>, and <code>toJSON()</code> are performed recursively on elements of aggregation tree.</p>
97-
</li>
98-
<li>Type-R features declarative <a href="06_API_by_feature/03_Validation.md">validation</a> with attribute-level rules. Validation is transparent and lazily evaluated.</li>
99-
<li>Architecture does not depend on stores and singletons. <a href="05_API_by_feature/05_id-references_and_Stores.md">Stores</a> are optional and used for shared data only. There might be as many stores as you need, and they can be created and disposed dynamically.</li>
100-
<li>Type-R data structures are pretty efficient. They are about 10 times faster in real-world data scenarios than BackboneJS.</li>
89+
<li>All that things can be used to manage an application&#39;s state.</li>
90+
<li>Type-R handles observable transactional changes in the way more or less similar to mobx (however, it&#39;s heavily optimized for the case of large aggregated object trees).</li>
91+
<li>Type-R id-relationships and validation capabilities are comparable to ones in <a href="https://guides.emberjs.com/v2.2.0/models/relationships/">Ember Data</a>, which was used a source of inspiration.</li>
92+
<li>Type-R has a lot of common in some API parts with BackboneJS models and collections. For instance, it uses the close API for the <a href="#update">collection updates</a> and the <a href="#built-in-events">similar event model</a> for the changes (however, it&#39;s generalized for the case of transactions on the nested records and collections).</li>
93+
</ul>
94+
<p>Speaking of the distinguishing differences,</p>
95+
<ul>
96+
<li>Type-R&#39;s records are not key-value pairs but <em>classes</em> with typed attributes. They are protected from improper assignment with run-time type assertions and conversions. Which means that the client-server protocol is protected again errors from both ends.</li>
97+
<li>Type-R distinguishes aggregation and the plain association operating with <em>aggregation trees</em> formed by nested records and collections. Aggregation tree is serialized as nested JSON. Operations like <code>clone()</code>, <code>dispose()</code>, <code>isValid()</code> and <code>toJSON()</code> are performed recursively on elements of aggregation tree gracefully handling the references to shared objects.</li>
98+
<li>Type-R relies on <em>layered application state</em> instead of the global singleton store. In Type-R, the stores are the special kind of records which can participate in dynamically configured lookup chains. There might be as many dynamically created and disposed stores as you need, starting with no stores at all.</li>
99+
<li>Type-R features automatic lazily evaluated <a href="#validation">validation</a> with declarative attribute-level rules. Validation checks are the part of the attribute type; they are evaluated in the moment they needed and never performed twice on the unchanged data. </li>
100+
<li>Type-R is really fast. It&#39;s capable of handling collections of 10K elements with real-time response and is about 10 times faster than BackboneJS.</li>
101101
</ul>
102-
<p>Type-R is designed to be the substitution for BackboneJS, which was used extensively 3 years ago in Volicon/Verizon Observer products. While it largely backward compatible by its API with BackboneJS (for Events and Collections), it&#39;s entirely different internally.</p>
103-
<p>In its core, it&#39;s an engine for managing the <em>aggregation trees</em> composed of nested Records and Collections. It contains no View, Router, REST, and jQuery/Underscore dependencies.</p>
104102
<table>
105103
<thead>
106104
<tr>
107105
<th>Feature</th>
108106
<th>Type-R</th>
109-
<th>BackboneJS</th>
110-
<th>EmberJS</th>
107+
<th>Backbone Models</th>
108+
<th>Ember Data</th>
111109
<th>mobx</th>
112110
</tr>
113111
</thead>
114112
<tbody>
115113
<tr>
116-
<td>View and Router</td>
117-
<td>-</td>
118-
<td></td>
114+
<td>Observable changes in object graph</td>
119115
<td></td>
120116
<td>-</td>
117+
<td>-</td>
118+
<td></td>
121119
</tr>
122120
<tr>
123-
<td>Models</td>
121+
<td>JSON Serialization</td>
124122
<td></td>
125123
<td></td>
126124
<td></td>
127-
<td>Objects as models</td>
125+
<td>-</td>
128126
</tr>
129127
<tr>
130-
<td>Collections</td>
128+
<td>Validation</td>
129+
<td></td>
131130
<td></td>
132131
<td></td>
133-
<td>modeled as relations</td>
134-
<td>Arrays as collections</td>
135-
</tr>
136-
<tr>
137-
<td>Nested Data Strictures</td>
138-
<td>as aggregation trees and relations</td>
139132
<td>-</td>
140-
<td>as relations</td>
141-
<td>as object graph</td>
142133
</tr>
143134
<tr>
144-
<td>Relations by id</td>
145-
<td>resolved agains the chain of dynamic stores</td>
135+
<td>Dynamic Type Safety</td>
136+
<td></td>
137+
<td>-</td>
138+
<td>For serialization only</td>
146139
<td>-</td>
147-
<td>resolved agains the global store</td>
148-
<td>- </td>
149140
</tr>
150141
<tr>
151-
<td>JSON Serialization</td>
152-
<td></td>
153-
<td></td>
142+
<td>Aggregation</td>
154143
<td></td>
155144
<td>-</td>
145+
<td>-</td>
146+
<td>-</td>
156147
</tr>
157148
<tr>
158-
<td>Validation</td>
159-
<td></td>
160-
<td></td>
149+
<td>Relations by id</td>
161150
<td></td>
162151
<td>-</td>
152+
<td></td>
153+
<td>- </td>
163154
</tr>
164155
</tbody>
165156
</table>
157+
<h2 id="installation-and-requirements">Installation and requirements</h2>
158+
<p>Is packed as UMD and ES6 module. No peer dependencies are required.</p>
159+
<p><code>npm install type-r --save-dev</code></p>
160+
<aside class="success">IE10+, Edge, Safari, Chrome, and Firefox are supported</aside>
161+
162+
<aside class="warning">IE9 and Opera may work but has not been tested. IE8 won't work.</aside>
166163

167164
<h1 id="events">Events</h1>
168165
<p>Type-R uses an efficient synchronous events implementation which is backward compatible with Backbone 1.1 Events API but is about twice faster in all major browsers. It comes in form of <code>Events</code> mixin and the <code>Messenger</code> base class.</p>

0 commit comments

Comments
 (0)