📜 ⬆️ ⬇️

JavaScript application, or why do we need Razor in ASP.NET MVC?

image

I did not think I would write this, but JavaScript won. We stopped using Razor to create web applications. Instead, we implement the front-end in a separate project on JavaScript frameworks. From ASP.NET remained only WebAPI and the “engine”, where we write business logic and API for the user interface.


')

Universe JavaScript and CSS



Recently, we have seen the explosive development of web technologies. There were full-fledged IDE for working with HTML / CSS / JavaScript, projects like Grunt and hundreds of JavaScript frameworks. The infrastructure for creating a front-end has grown up.

Let's take a look at Github statistics. I found two sources of statistics on programming languages, in both JavaScript comes first.

The article Language Trends on GitHub considered using Linguist that JavaScript is in first place on GitHub in popularity among programming languages:

image

GitHut shows a similar situation:

image

Now I understand where new JavaScript frameworks come from every week. I can imagine the effort of the community of JavaScript programmers who put JavaScript in first place on github.

Cross Functionality Myth



We refuse to believe in the all-powerful full-stack web developers. Full-stack means that the programmer understands both .NET and JavaScript / CSS.

What does it mean to understand these two worlds? This means knowing the subtleties of working with browsers, knowing and practicing with new JavaScript frameworks, and at the same time knowing about new features in C #, changes in the .NET platform, keeping track of new versions of ASP.NET MVC and new databases. I last saw such an all-knowing full-stack web developer ... never. To embrace and become an expert in these two areas is beyond the power of a mortal. I'm not talking about people with an iron rod and an unlimited supply of free time, talking about ordinary people like me.

If you ask me, do I know javascript and css? I answer that I know. But do I know these technologies enough to create a high-quality solution on the front-end? No, my knowledge is not enough, I know these technologies superficially in comparison, for example, with the front-end developers of our company.

I came to the conclusion that a complex project could not be created by full-stack developers. If we are talking about a complex UI and a complex back-end, then specialization is necessary. Trusting full-stack projects to developers is more difficult than dragging a design on a CMS, setting up the interface in SharePoint or customizing Bootstrap is detrimental to the project.

A story from a nearby company. Lead .NET developer saw problems on the front-end. He decided that the UI project had the wrong architecture and technical debt, so he went to restore order there. As a result, it became even worse than it was, because he could not create a JavaScript application.

I think a similar situation could occur if a JavaScript developer had gotten into C #. The difference is that .NET developers believe that they will be able to correct JavaScript / CSS correctly, and front-end developers know that it’s better for them not to get into C # and they don’t climb.


Interaction scheme



At the start of the work we are doing two projects. The first traditional project is an ASP.NET Web API application in Visual Studio, the second project in Webstorm . Both projects are in the same repository, although it is not necessary.

image

Front-end developers coordinate with back-end API developers through which the two applications interact.

Work process



We create project teams, so developers, QA and other team members are part of a single project team. Including front-end and back-end developers are part of this team. A single team works with Impact Mapping, Customer Journey Mapping, User Story Mapping, which appear during the software creation process :

image

It is seen that from the point of view of the process of creating software, we do not separate the front-end and back-end parts. This is a deliberate step that helps make the delivery of business value.

Advantages and disadvantages



In the division of the front-end and back-end into two projects, I find both pros and cons:


Choice of approach



We choose an ASP.NET MVC application and render HTML via Razor, if we use CMS or write a small project without complex business logic. For example, this is the site of the company ByndyuSoft . We select the front-end as a JavaScript application in all other cases.

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


All Articles