Seperating presentation and code #164
Replies: 1 comment 3 replies
-
Thanks for bringing this up here, that's certainly something which needs discussion and - if we decide to do it - needs to be orchestrated so we end up having one PR which is exclusively just separating code and HTML without sneaking in any other changes.
The generally agreed rule is to separate presentation logic from "business" logic. But the code part of a .razor page/component is actually very much part of the presentation logic. AFAIK it cannot be run or even be tested separately. It is tightly coupled with the HTML part. My point to keep it together is the easier navigation between code and HTML. But I admit that this advantage is vanishing, the larger the file becomes. For example, would you actually want to split up something short like L1AccountLink.razor? If yes, I absolutely don't favour this. If no, then why have separate standards? That seems very subjective, split it up whenever you feel like it has become too big? |
Beta Was this translation helpful? Give feedback.
-
This goes back to my first PR which was humongous, but it had a nice feature; seperating presentation from code.
This is really a good idea, not just for seperating responsibilities, but also for viewability.
For me personally, have a codeblock within a razor page is just like having javascript directly in html pages.
I think this should be introduced, but this is not my decision to make. But i heavily suggest it.
Now.. discuss :)
Beta Was this translation helpful? Give feedback.
All reactions