{"id":39831,"date":"2023-06-21T13:39:37","date_gmt":"2023-06-21T17:39:37","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=39831"},"modified":"2023-06-23T10:18:08","modified_gmt":"2023-06-23T14:18:08","slug":"mvc-isnt-mvc","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/06\/21\/mvc-isnt-mvc\/","title":{"rendered":"MVC Isn&rsquo;t MVC"},"content":{"rendered":"<p><a href=\"https:\/\/collindonnell.com\/mvc-isnt-mvc\">Collin Donnell<\/a> (<a href=\"https:\/\/ruby.social\/@collin\/110573305136820170\">Mastodon<\/a>, <a href=\"https:\/\/news.ycombinator.com\/item?id=36397058\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/collindonnell.com\/mvc-isnt-mvc\">\n<p>In December of 1979 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Trygve_Reenskaug\">Tyrgve Reenskaug<\/a>, an employee of <a href=\"https:\/\/en.wikipedia.org\/wiki\/PARC_(company)\">Xerox PARC<\/a>, published a paper called <a href=\"https:\/\/folk.universitetetioslo.no\/trygver\/1979\/mvc-2\/1979-12-MVC.pdf\">MODELS-VIEWS-CONTROLLERS<\/a> about a design pattern he had invented for developing applications with a graphical user interface.<\/p>\n<p>[&#8230;]<\/p>\n<p>In [Apple&rsquo;s] version, models and views got dumber and controllers handle a lot more.<\/p>\n<p>[&#8230;]<\/p>\n<p>In the late 1990s, Java developers writing for the web created a new variation of MVC to deal with the fact that web and desktop apps are different. It was called <a href=\"https:\/\/en.wikipedia.org\/wiki\/JSP_model_2_architecture\">Model-2<\/a>. [&#8230;] Rails used a Model-2 style architecture, but is generally just referred to as an MVC framework.<\/p>\n<p>[&#8230;]<\/p>\n<p>There are aspects of the original design that could be applied and might be useful &mdash; models notifying views of updates while remaining decoupled using <a href=\"https:\/\/developer.apple.com\/documentation\/swiftui\/managing-model-data-in-your-app\">observable objects with SwiftUI<\/a> in Swift or something like <a href=\"https:\/\/rubydoc.info\/github\/hotwired\/turbo-rails\/Turbo\/Streams\/Broadcasts\">Turbo Stream broadcasts<\/a> for Rails style web frameworks &mdash; but what is interesting to me is how an idea that could be described in a page and a half the year after Star Wars came out has managed to evolve and remain relevant in such different environments.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/news.ycombinator.com\/item?id=36402243\">danabrams<\/a>:<\/p>\n<blockquote cite=\"https:\/\/news.ycombinator.com\/item?id=36402243\">\n<p>The M in MVC has come to mean &ldquo;data model,&rdquo; but it originally referred to the &ldquo;mental model&rdquo; of the user. What kind of thing are we trying to manipulate and what is the user&rsquo;s mental model of such a thing?<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/news.ycombinator.com\/item?id=36401086\">Marcel Weiher<\/a>:<\/p>\n<blockquote cite=\"https:\/\/news.ycombinator.com\/item?id=36401086\"><p>The &ldquo;Model&rdquo; is an object that is the headless application. It implements and coordinates all the functionality. You put a thin GUI on top of that. Or a different GUI. Or an API. Or a WebUI. Or a CLI&#8230;.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@drahardja@sfba.social\/110573597568590862\">Dave Rahardja<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@drahardja@sfba.social\/110573597568590862\">\n<p>I would go even further that the &ldquo;controllers&rdquo; in the modern #AppKit \/ #UIKit world are even further away from the original conception of #MVC, and they&rsquo;re hardly &ldquo;controllers&rdquo; in the original sense any more.<\/p>\n<\/blockquote>\n\n<p>See also: Dave DeLong&rsquo;s <a href=\"https:\/\/davedelong.com\/blog\/tags\/a-better-mvc\/\">A Better MVC<\/a> and <a href=\"https:\/\/github.com\/davedelong\/MVCTodo\">MVC Todo<\/a>.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2017\/03\/15\/looking-at-model-view-controller-in-cocoa\/\">Looking at Model-View-Controller in Cocoa<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2015\/04\/03\/model-widget-controller-mwc-a-k-a-apple-mvc-is-not-mvc\/\">Model Widget Controller (MWC) a.k.a.: Apple &ldquo;MVC&rdquo; Is Not MVC<\/a><\/li>\n<\/ul>\n\n<p id=\"mvc-isnt-mvc-update-2023-06-23\">Update (2023-06-23): <a href=\"https:\/\/collindonnell.com\/mvc-discussion-on-the-rooftop-ruby-podcast?pk_campaign=rss-feed\">Collin Donnell<\/a>:<\/p>\n<blockquote cite=\"https:\/\/collindonnell.com\/mvc-discussion-on-the-rooftop-ruby-podcast?pk_campaign=rss-feed\"><p>If you enjoyed my <em><a href=\"https:\/\/collindonnell.com\/mvc-isnt-mvc\">MVC Isn&rsquo;t MVC<\/a><\/em> post from a couple of days ago, you might also be interested in the latest episode of the <a href=\"https:\/\/www.rooftopruby.com\/\">Rooftop Ruby podcast<\/a>. <a href=\"https:\/\/drapper.me\/\">Joel<\/a> and I discuss our thoughts on the post before getting into more detail on MVC, the forgotten editor controller, and how we might be able to implement something closer to the original MVC on the web using modern technologies like <a href=\"https:\/\/github.com\/patrick-steele-idem\/morphdom\">morphdom<\/a> and <a href=\"https:\/\/rubydoc.info\/github\/hotwired\/turbo-rails\/Turbo\/Streams\/Broadcasts\">Turbo Stream broadcasts<\/a>.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Collin Donnell (Mastodon, Hacker News): In December of 1979 Tyrgve Reenskaug, an employee of Xerox PARC, published a paper called MODELS-VIEWS-CONTROLLERS about a design pattern he had invented for developing applications with a graphical user interface. [&#8230;] In [Apple&rsquo;s] version, models and views got dumber and controllers handle a lot more. [&#8230;] In the late [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-06-21T17:39:39Z","apple_news_api_id":"81497f83-849a-4237-9b41-f050ddf40d27","apple_news_api_modified_at":"2023-06-23T14:18:11Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/AgUl_g4SaQjebQfBQ3fQNJw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,27,295,31,84,30,374,71,308,515,1812],"class_list":["post-39831","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-craft","tag-history","tag-ios","tag-java","tag-mac","tag-mvc","tag-programming","tag-rails","tag-smalltalk","tag-swiftui"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/39831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=39831"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/39831\/revisions"}],"predecessor-version":[{"id":39847,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/39831\/revisions\/39847"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=39831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=39831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=39831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}