Elektrine lite

← Feed

@crocodisle@woof.tech

Post #2073739

2026-05-06 10:06 UTC

The things people agree on: - A Model should hold business logic/information for processing - A View should present the user with interactivity and handle how it responds to things What no one seems to agree on: - Where a Controller sits in the stack, or what it actually does. - Whether it interfaces with just the database, just between the View and Model, or both.

Replies (1)

  • @crocodisle@woof.tech 2026-05-06 10:17

    Starting with seperation of concerns, the view should be code that handles presentation of elements of a page, perhaps moving HTML around either based on user information or info from deeper in the stack. I imagine view code could be largely client side without too many issues (unless templating is involved, in which case i've been made aware templating can introduce potential vulnerabilities). The model should be responsible for operating on information the user inputs from the view or incoming data from the database. It may not interface with the database directly, and it probably shouldn't, given that if the model is client-side, I imagine tampering could leave the database vulnerable. I'm not sure if it makes sense for the model to be server-side at all. The controller is a (probably) server-side application that interfaces between the front end and the database. It sanitizes input before db operations are done and packages db information into json or something that can be sent to the frontend for processing, most likely the model since that's what the model does.

    Open ##2074139