📜 ⬆️ ⬇️

(Archive) 10 reasons to try Matryoshka

image

1. Pure JavaScript and HTML


Many frameworks try to fix the web by creating their own programming language. The idea of ​​the Matryoshka is simple: everything is fine with the web. All the logic that the programmer writes is, as it should, in JavaScript files, and HTML remains the hypertext markup language. The joke about the HTML programmer should remain a joke.

2. Minimum entities


Matryoshka does not require the creation of redundant entities. Thanks to the simple syntax of bindings, the relationship between JavaScript and HTML can be described in the same place as logic. The programmer is not required to think about several things at once, reflecting on the balance of powers of objects. The question of where to register the handler: in the "view" or in the controller disappears by itself. Although, no one forbids sharing data and the controller by placing them in different JS files.

3. Work with data, forget about the presentation.


Having tried the popular (but inferior to the onslaught of more modern products) Backbone framework, you face a serious inconvenience: declaring data that depends on the UI and UI that depends on the data, you usually need to create two event handlers. One catches data changes, the second catches user actions. The problem is further supported by the fact that HTML elements are usually completely identical within the application: input, select, custom widgets from the jQuery UI can be repeatedly found on the page. A programmer who implements another application “unit” (for example, a form) has to use copy-paste.
')
Matryoshka is much easier. You only need to declare the binding once (in one place, not in two), then work with the data (as with regular JavaScript objects), forgetting that we have a view at all.

4. Flexibility


For a beginner, it is often not clear how to switch to a new architecture. Sometimes, in order to add a third-party widget, you need to put a lot of effort into studying adapters, directives, etc.

Asking how to screw this or that script (for example, some jQuery plugin), the correct answer is, among other things, “I'll do as I know.” The output of a widget, be it Google Maps or one of the many galleries, is done as indicated in the official documentation for the widget. Matryoshka created with love for VanillaJS.

5. Unobtrusive architecture


Most popular frameworks lay down the principles of code structuring, limiting the creativity of the programmer as a software architect. I do not think that this is very bad, although you often ask yourself the question “why should it be done like this”? ..

The nested doll does not force to use a certain code structure, and does not force to use good, but, perhaps, not the most successful solutions. You choose the patterns for designing and structuring the application. Although the Matryoshka is positioned as a framework, but rather it’s a library that reduces the amount of work to be done.

6. Less code


The most important task that was set during the development of the framework was to solve as many tasks as possible (within reasonable limits). Therefore, the resulting code, as a rule, looks quite compact, especially with ECMAScript 6.

7. Easy to understand what is going on.


Due to the unobtrusive recommendations and the absence of strict regulation, anyone who is not familiar with the framework, but knows JavaScript well, is likely to understand your code (if you are, of course, a good programmer :). When creating methods, one of the important priorities was the obviousness of their functionality.

8. Easy to get started.


In order to start working with Matryoshka, you just need to know the purpose of the three classes and several methods. The rest is syntactic sugar. In the documentation, they are marked with a red flag to make it easier to navigate.

9. Small size


The nested doll is compact enough for the framework. At the time of this writing, the matryoshka weighs less than 38K / 12K zazipovano.

10. Supports ECMAScript 6 syntax


Support for next-generation JavaScript is one of the top priorities. Today, Matryoshka, besides the basic features of ECMAScript 6, supports for..of classes and loops. In the future, with the development of the language, new features will be added first.

11. Documentation (bonus reason)


Everyone knows that the programmer must know English, since most of the relevant materials and articles, first of all, are published in English. But I am sure that most people who read this article, despite their knowledge of English (from mediocre to excellent), will prefer Russian-language materials.

Documentation, starting from this year will be published in two languages: in Russian and English. Moreover, both versions, being official versions, will always remain relevant.

Here is a short post turned out. Friday everyone!

Source: https://habr.com/ru/post/254927/


All Articles