# Introduction
This library provides reactive models classes for nosql models with optionally saving, rollback and live validations.
# Installation
# Why mixins?
The library provides tools to construct model classes by composing of a base model class and built-in or external custom mixins. A few worlds should be said about this strange solution.
# Classes
Classic class-based inheritance has a strict inheritance tree, which does not allow to append an optional independent functionality.
For example:
If we want to use both the print()
and add()
methods, everything is fine, but if we need only add()
method, our class will still contain the useless digits
field and the print()
method. If we inherit class C
directly from class A
, we cannot inherit MyClass
from both classes B
and C
to take full advantage of their features.
# Functions
Yet another method is composing a final object by functions.
Example:
# Prototypes
Everything works as expected, but each object such my
contains its own copies of methods. This problem can be worked around using prototype
.
Doesn't look clear, right? A few years ago, this was the only way to imitate classes in JavaScript.
# Mixins
But for now we have native classes and mixins.
Modern solution:
But the simpleness melts away when we try to use a generic base class.
Of course, there is no ideal solution, but we hope you agree with us - mixins are the most optimal solution for the task.
← Core Base model →