TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How did Django land on such abomination of MVC naming scheme?

2 点作者 textread7 个月前
I am not satisfied with their official explanation at https:&#x2F;&#x2F;docs.djangoproject.com&#x2F;en&#x2F;dev&#x2F;faq&#x2F;general&#x2F;#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names<p>Was there a legacy reason why they are trapped with MTV naming scheme?<p>https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=OAVnOz7i-JA

3 条评论

PaulHoule7 个月前
MVC is itself a bad naming scheme. At least in the mid-2000s the thing web-based MVC had in common was that all your endpoints went through some function which could render a different template based on the circumstances: for instance re-draw the form with error messages or display a message saying the submit was successful.<p>(I’d be afraid a young dev would have no idea this is possible without using React or Vue)<p>That generation of “MVC” systems stole the name of a very different UI coding paradigm from Smalltalk more than a decade ago. It is common for a web MVC system to be missing one of the letters which is not a problem because they work fine, it’s just they still call it MVC.<p>And what is a model anyway? The “anemic domain model” is the industry standard, whether it is a POJO in Java or<p><pre><code> { customerId: 5, name: “Alice” } </code></pre> in JavaScript there is some piece of data describing a situation. It does not have to be an ‘object’ or adhere to any particular discipline because it can. In fact, there are disciplines around treating data as data in the abstract as opposed to a set of objects that provide affordances. SQL, Immutability, a defined set of operators such as “add a member to this list” which can be bound to events or sent over the wire or be done or not done on the digression of the system, etc.<p>The “view” is usually well defined but the “controller” is the balance-of-system and doesn’t have to have any particular structure at all.
评论 #41958573 未加载
rossdavidh7 个月前
There are, as the saying goes, only two truly hard problems in programming:<p>1) naming things<p>2) cache invalidation<p>3) off-by-one errors<p>It was, I&#x27;m sure, named hastily while they were in the earliest stages of development, thinking primarily about what the code would do and not much about what to name it. Renaming things later was never the highest priority, and then eventually far too much was built on it to change things.<p>The problem is, if you actually spend a lot of time at the beginning thinking about the name, you may not do much better, because software architecture often turns out to be somewhat different than the original plan. Naming things at the beginning fails for the same reason detailed product specs at the beginning often fails, but unlike functionality, names are rarely changed later once the situation is better understood.
评论 #41958604 未加载
isodev7 个月前
I think MVC is a general concept &#x2F; pattern and doesn&#x27;t need to be reflected exactly in order to be useful. In case of Django (and other frameworks like Phoenix), the &quot;view&quot; is not necessarily a template .. can be a JSON response, CBOR or something else entirely.<p>The notion of a &quot;controller&quot; is also quite flexible. It accommodates &quot;whatever logic we need to interpret the user&#x27;s request and respond with the right thing&quot;. Is everything part of the controller? Is there some kind of a domain&#x2F;business logic layer as well? All up to you really.
评论 #41958622 未加载