OffTopic: Do you think HTML + CSS + Webserver will be MVC?

These are just my perplexities, and I thought I would share them ...

Simply put, MVC is a pattern for separating content (model) from a view (view) and having a mechanism (controller) that determines how to collect both.

If you can already see where I am going, I am very interested to hear your opinion on this matter. Surely MVC is applicable to server mechanics and everything, but come up with out of the box here with me for a second.

"Visitors" to the Internet, both humans and robots / Google, are more likely to see HTML and what is associated with it. Writing structured and content-rich HTML, along with separating it from presentation using CSS, has become more important over the years, and future technologies such as HTML5 will contribute to this separation by offering a more content-oriented set of elements and mechanisms for working with pure visual presentation.

With all this in mind, I was wondering if it would be correct to say that the MVC paradigm applies to interface as well, where:

  • The model will be HTML as in pure httpwise content which became
  • Presentation - CSS; it makes your content appear in a certain way.
  • The controller being the web server and everything underneath is what collects and separates the model and the view and makes all the decisions.

Has the meaning? Not?

Thank,

Martin

Update: VonC pointed me to an article that definitely changed my thoughts on the controller part. The browser also takes up most of the controller because it handles a lot of user interactions and how models and views work together.

+1


source to share


5 answers


I would agree, although one can argue about the controller.

Jeff illustrates that indicates in his report , ZenGarden

FROM

  • Model = HTML
  • View = CSS
  • Controller = Browser (which is more "front-end" than web server)

Actually, this is a valid perspective from the client side .



From the server side (the server is more complex than a simple server of html pages) the MVC will be different.

With ASP.Net for example ;

  • Model = all your application logic that is not contained in a view or controller. The model should contain all of your application business logic and database access logic. For example, if you are using LINQ to SQL to access your database, then you will create LINQ to SQL classes (your dbml file) in the Models folder
  • View = HTML markup and content sent to the browser plus scripts
  • Controller = is responsible for controlling how the user interacts with the MVC application. The controller determines which response to send back to the user when the user makes a browser request. A controller is just a class (like a Visual Basic or C # class).

This is an MVC perspective

+1


source


You can usually find MVC in all cases if you look complicated enough.



+4


source


No, I think...

Your HTML is also at your presentation layer (View), although your CSS should contain presentation features such as fonts, colors, etc.

Your model needs to contain your data + business logic, and I really don't hope you want to store it in HTML - for real programming languages, stored procedures and DBMS to process. And they need to be server side.

But to follow your line of thinking, I would suggest:

  • Model: server programs + DBMS
  • View: HTML + CSS
  • Controller: web server
+1


source


I can see your point, but I think I would describe HTML-CSS-Server / Browser more as Document-Viewer rather than MVC. If all content is static, then it's a model expression, true, but the model is embedded in the markup. Even though I can override it with CSS, CSS is just a filter on the main presentation described in HTML. HTML describes the presentation of the data as well as the data itself. For this, I can turn off the CSS and I still have a view of the data. This is not possible in MVC.

There is also a close relationship between your HTML and your CSS - both should be knowledgeable about the other. This violates the core MVC paradigm where components are loosely coupled. In particular, the view does not impose restrictions on the model (other than the restriction that the data can view). HTML developers are forced to work in the CSS domain or change the CSS to make it applicable to the HTML domain.

In addition, HTML does not have the ability to manipulate data for permanent changes. A key aspect of the model is the ability to enforce business rules. HTML doesn't do this with static content - web designer chooses HTML coding.

It doesn't make it bad, or useful. Not everything has to be MVC. MVC simply describes one specific way to organize your data and code. It has some special advantages over decoupled architecture and testability, but that does not mean that it is the only valid architectural pattern.

Static HTML content is in my opinion not MVC and shouldn't be.

[EDIT] I am not suggesting that you cannot use MVC in browser design or that MVC is not applicable to rendering static content in a browser. I am really looking at this from the point of view of a content provider, not a programmer. MVC can be a perfectly logical choice for browser design.

+1


source


CSS is definitely not a species. Rather, browser rendering (which combines HTML / DOM and CSS input into a 2d layout) is the view. The HTML / DOM model is a model. The controller is halfway built into the browser interface but can be extended with javascript.

It is true that CSS is considered the presentation layer when it comes to separating content / presentation - however it is a different (orthogonal) model.

In MVC, CSS is part of the model along with HTML / DOM, as it is the underlying data that can be displayed in different views. For example, a print layout is a separate view based on the same model.

0


source







All Articles