📜 ⬆️ ⬇️

Incoding rapid development framework

image

A few words about myself - I work for Incoding Software, which has been successfully outsourcing for many years, carrying out Internet and Intranet projects in various fields (medicine, bulletin boards, social networks, and much more)

Incoding Framework is a client / server solution for developing web projects on the asp.net mvc platform.
')
Consists of three parts:

note: the Incoding Framework feature is that each part integrates with each other (IML uses MVD for AJAX, MVD executes CQRS, etc.), but allows using them separately (on Nuget 3 independent packages)

Since it’s impossible to consider each part of the framework in one article, the emphasis will be placed on the most interesting component of our library - this is IML. Why I singled out the client part, the fact is that CQRS, Event Broker and Unit Test have many analogues in the “world” .net and it is extremely difficult to interest (although we have a number of features), but IML is a tool that does not yet have direct analogues.

It has no analogues, how are tasks solved?


IML has no direct analogues, but of course there are indirect ones:


No javascript, don't build a web site

You have to deal with all the difficulties:


I did not hear, I have Jquery

With the advent of Jquery, web application development has become simpler, but with the increasing complexity of applications on the client side, the scripting approach to writing code has become unjustified due to the increasing level of dubbing, and such “features” of JavaScript as global functions and variables make it more difficult to support large projects. .

Ok, let's build the architecture on the UI

The MVVM or MVC architecture, built on JS, provides communication with the server, but when a client model appears on its own, you have to synchronize it with the one on the server side and this separates the developers at the front end and back end.
note: the idea of ​​dividing programmers into server and client programmers seems extremely unsuccessful because they have to coordinate their actions and always, someone works faster and someone slower, but if this is not done, the developer should know the particularities of development on each side .

In order not to build an architecture from scratch, you can use ready-made JavaScript framework, for example AngularJS, but then you need to write Controller, Routes and more, repeating the already existing code on asp.net mvc. The main problem, of all the javascript framework, is that You need to write JS code

Oh and if without js

In recent times, the trend of writing JavaScript using a typed interpreter or an alternative language has developed.
TypeScript is the ability to write JavaScript, but in C # with a similar syntax. What is the difference between TypeScript and IML:


Okay, so what can IML do?


IML offers a set of methods for writing any client scripts without JavaScript code. The browser works on the principle of an event model, and as practice has shown, there are not so many options for scenarios.
Let's look at the standard algorithm:
  1. An event is raised at the DOM element (on behalf of the user or programmatically)
  2. Action is executed (most often it is an Ajax request to the specified url)
  3. Callback on completion of Action, which launches a chain of actions (inserting received data, working with DOM, updating CSS, using jQuery plugin)


Show the code, everything will be clear right away.

Html.When(JqueryBind.InitIncoding) .Do() .AjaxGet(Url.Dispatcher().Query(GetCardsQuery { Client = Html.Selector.Name(r=>r.Client) })) .OnSuccess(dsl => dsl.Self().Core().Insert.WithTemplate(idTemplate.ToId()).Html()) .AsHtmlAttributes() .ToDiv() 


Better algorithm

IML is a declarative language, so its constructs can be easily described.
  1. When InitIncoding - when the event of the appearance of an element on the page
  2. Do - way to handle event behavior (Prevent Default, Stop Propagation)
  3. Action - ajax request to the specified url
    note: the example uses MVD to build the url, but it can be done in the old way Url.Action (“controller”, “action”, new {Client = Html.Selector.Name (r => r.Client)})
  4. On - upon successful completion of the Action, we perform a sequence of actions, for example, this is the insertion of data through the template
  5. AsHtmlAttributes - we pack our IML code in “warm and reliable” RouteValueDictionary
  6. ToDiv - declare on the page as a div (you can in any tag)


The easiest way to understand the structural scheme

image

What are the reasons for IML?

If we highlight the main advantages of IML, then:


Here, say we have C #

C # has probably the richest functionality and what's important is that all this can be used within your Razor page, that is, anonymous functions, lambda, and more, which allows you to refactor your application.


All right, right?


I will give a list of negative points Incoding Framework


Conclusion


At the beginning I wrote that our company is engaged in various projects, I stressed that the range of tasks that the Incoding Framework is facing is very large. Many will say that almost every company is developing its own framework for itself, but it seems to me that we have a tool that can be used by other teams.

PS Glad to hear feedback and comments

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


All Articles