10 reasons to try Matreshka

Andrey Gubanov
3 min readDec 2, 2015

--

This article is also posted on Github Wiki

Website, Repo on Github

1. Clean JavaScript and HTML

Most frameworks try to fix the web creating their own programming language. The idea of Matreshka is simple: everything is OK with the web. All logic a programmer writes is in JavaScript files as it should be, and HTML remains the hypertext markup language. The joke about HTML programmer must remain a joke.

2. Entity minimum

Matreshka doesn’t require creating redundant entities. Thanks to the simple syntax of bindings, the connection between JavaScript and HTML can be described in the same place as logic. A programmer doesn’t have to think about several things at a time, pondering about the balance of object authorities. The question where to write a handler: either in a “view” or in a controller falls down by itself. Although nobody forbids to separate data and the controller, having placed them in different JS files.

3. Work with data, forget about representation

Having tried a popular (but giving place to more modern products) Backbone framework, we face a serious inconvenience: while declaring data that depend on UI and UI that depends on data, as a rule, you have to create two event handlers. One catches data changing and the other catches custom actions. The problem is supported by the fact that HTML elements, as a rule, are completely identical within an application: input, select, custom widgets from jQuery UI can be frequently found on the page. A programmer who implements another application “unit” (for example, a form), has to use “copy-paste”.

Everything is a lot simpler with Matreshka. You just need to declare a binding once (in one place instead of two places), next work with data (like with ordinary JavaScript objects), having completely forgotten about the view.

4. Flexibility

A beginner is often at a loss how to use a new architecture. Sometimes it’s necessary to make a lot of efforts studying adapters, directives and the like just to add a third-party widget.

Wondering how to add some script (for example, some jQuery plugin), one of the best answers will be «I’ll do it the way I know it». The output of a widget, either Google Maps or one of the numerous galleries, is performed as it’s stated in the official documentation to the widget. Matreshka has been created with love to VanillaJS.

5. Non-intrusive architecture

Most popular frameworks lay the foundations of structuring code, restricting a programmer’s creativity as a software architect. I don’t think it’s very bad, although I often ask myself a question «why do I have to do it this way only»?..

Matreshka doesn’t make you use a definite code structure and it doesn’t force to use good but possibly not very successful solutions. You choose designing and structuring patterns of the application by yourself. Though Matreshka is positioned as a framework, I’d rather say it’s a library which reduces the amount of the work to be done.

6. Less code

The most important goal which has been set during the framework development is to solve a maximum number of tasks (within due limits). That’s why, as a rule, the resulting code looks quite compact, especially when using the help of ECMAScript 2015.

7. It’s easy to understand what’s happening

Because of subtle recommendations and the absence of strict regulations, anyone who isn’t familiar to the framework but is good at JavaScript, will surely understand your code (if you are a good programmer yourself, of course :). While creating methods, one of the most important priorities was obviousness of their functionality.

8. It’s easy to start with

In order to start working with Matreshka, you just need to know the purpose of three classes and several methods. The rest is syntactic sugar. In the documentation they are marked with a red chevron so as to be better guided.

9. A small size

Matreshka is quite compact for a framework. At the time of this writing Matreshka is less than 16K gzipped.

10. The support of ECMAScript 2015+ syntax

The support of the next generation JavaScript is one of the most top-priority tasks. For the time being, Matreshka supports for..of cycles and classes, besides basic capabilities of ECMAScript 2015. In future, during the language evolution, new capabilities will be added on a first priority basis.

--

--