News for hackers. Stuff that matters.
Re:What web developers thought of in the noughties as being ... by DonHopkins on Friday May 16, 2014 @10:50AM (#7755759)
I asked Alan Kay about his thoughts on MVC:

From: Don Hopkins

I'm interested in knowing more about the evolution of MVC and Morphic, and any other approaches that people have taken to user interface programming that you think are important. I've heard about Morphic, but I haven't been able to find out too much about it on the web. My understanding is that it was originally written for Self, then ported to Smalltalk. Is it still in development, or has it morphed into something else? I don't know much about how it works or the ideas behind its design. What makes it unique and interesting?

There was a discussion on Reddit about "Is MVC the best pattern for web development", which is something I have strong opinions about and like to discuss!

I've drawn a lot of my opinions from this fascinating discussion on C2: http://c2.com/cgi/wiki?WhatsaControllerAnyway

Here's the reddit discussion, which is about how MVC applies to web development: http://www.reddit.com/r/programming/comments/lovjq/is_mvc_th...

The article: http://feedmyconstraint.wordpress.com/2011/10/24/is-mvc-the-...

I posted a comment whose TLDR summary was "Fuck MVC!" -- It has a totally different meaning for web server programming, and in the 32 years since the term was coined, there have been better ideas.

http://www.reddit.com/r/programming/comments/lovjq/is_mvc_th...

There are two different meanings that MVC has these days: user interface MVC, and web server MVC. User interface MVC has its own problems, the least of which is being 32 years old. And nobody can agree on what a controller is, anyway, except that it's the dumping ground for all the brittle junk and dependencies that none of the other well defined classes wanted.

From: Alan Kay

Things seem to hang on in computing just because they work a little bit.

MVC was originally done at PARC almost 40 years ago. The good part was philosophical -- the idea to adapt the notion of "cameras" and "worlds" in the original 3D graphics stuff I participated in at Utah 45 years ago. The bad part of MVC was how we implemented it -- much too much machinery, etc.

We (my various groups since then, including Viewpoints Research) have not thought about MVC since, but have used and devised various viewing methods over the last 20+ years. I like to do views as "watchers" which do not affect what they are viewing. There are lots of ways to do this. Similarly, I like to also use "watchers" (context sensitive to the views) to catch needed inputs. We have never done a really satisfactory automatic inverter for dealing with the loss of "dimensions" that happen when a view is made (but we have done some experimental ones).

One important criterion is for end-users of all kinds to be able to easily make their own views in a very powerful ad hoc way via construction. We have done a number of adaptations and generalizations of how this can be done in Hypercard -- and this seems to work well (enough).

Since we always roll our own languages and development systems, we don't care about problems that other systems might have. For example, we have very little knowledge about C#, etc.

We do try to learn from the few good systems that are out there.

Re:What web developers thought of in the noughties as being ... by DonHopkins on Friday May 16, 2014 @11:11AM (#7755883)
When I was living with David Levitt, who worked with Alan Kay at Atari Cambridge Research, I was snooping around his bookshelves and read through some of the fascinating notebooks, in which Alan Kay wrote about the idea of a two way mapping/projection between the model and the view.

It's always seemed to me that the "controller" was just extra baggage, because the view knew the most about drawing the model, and naturally would also know what it needed to reverse that projection back from user input through to manipulating the model. But right now we usually meticulously write the view drawing and mouse tracking code by hand, without a lot of help from the system. (That's something I consider a high art form, which I enjoy diong, so I'd probably be horrified and out of a job it it were too easy! ;)

I think Ben Shneiderman's term "direct manipulation" describes the style of user interface that Alan Kay was getting at -- or at least DM has to deal with a lot of the same problems: "continuous representation of objects of interest, and rapid, reversible, incremental actions and feedback" according to http://en.wikipedia.org/wiki/Direct_manipulation_interface ...

By that I mean DM user interface programming could benefit from some kind of automatic inverter, but usually it's just implemented in an ad-hoc manner, usually by input tracking code in the view.

I think the way Smalltalk and Self/Morphic use reflection to present editable user interfaces to objects is another example of a two-way mapping between projecting the view on the screen, and editing the model via user input. Booleans whose values you can toggle, numbers whose values you can drag up and down, color pickers and things like that are all fine and good, but for many properties it has to fall back to standard widgets that don't know much about the semantics of the data they're viewing or editing.

I had the opportunity to play around with Sk8 when I was at Kaleida. That certainly let you drill down, see and modify everything there was in the system, and it was totally prototype based! Plus it had cool looking windows with neat shapes, which I like! ;)

I'm curious about what Kay meant by "projection", and what successful examples there are of automatic bi-directional mapping, and powerful user composition. I take it that projection is the problem that you lose dimensions and have to hide information by flattening the structure out onto the screen (via a 3d projection or scaling or filtering or whatever infovis technique you're using), and there's no visible place to click or affordance to edit some every property of an object (or you have to build scaffolding in the form of clumsy indirect manipulation techniques like browsers, outliners and pop-up menus).

Re:What web developers thought of in the noughties as being ... by twistedpair on Friday May 16, 2014 @01:42PM (#7756717)
You might like MVP then. There is pure UI manipulation (V - the view) and then the actual logic behind marshaling the UI and backend calls (P - the presenter), and finally the model. If you're on mobile/table/desktop, the presentation logic (i.e. form validation, RPC) will be the same, but the actual view code (to fetch the form field values/clear/set them) will differ.

I started with this on some projects last year and find it simplifies a lot of things. To boot, you can now rather easily test your presentation logic with no UI dependence (it's all in the V).

With MVP all the persistence stuff is a whole different place, in the REST/RPC services on the server (services and repositories) but it has no coupling at all with the UI or MVP. Makes life a lot easier.

Re:What web developers thought of in the noughties as being ... by barrkel on Friday May 16, 2014 @11:59AM (#7756151)
I've thought of the projection (bi-direction mapping) in terms of bijective functions that might be used in a data binding language.

So, consider a textbox on screen and an integer attribute on a model.

A bijective function might be a pair of (intToString, stringToInt) functions; one is the getter that projects out of the model, the other is the setter that takes from the view and pokes into the model.

Next, start think about how to compose bijective functions. How might they be packaged into bundles that represent a sub-component view of an individual model amongst many. And what might the mapping from a collection model look like; consider detail views (as in master-details), with a source of "currency" you can map from collection to "current item", and so on.

Re:What web developers thought of in the noughties as being ... by DonHopkins on Friday May 16, 2014 @12:13PM (#7756215)
Some alternatives to MVC for user interface programming that I've used and love are constraints / data binding / events and delegates.

I worked on the internals of "Garnet", a constraint based user interface management system written in Common Lisp on X11 (Brad Meyers' research system developed in the 90's at CMU) -- http://www.cs.cmu.edu/afs/cs/project/garnet/www/papers.html -- and also on the internals and applications of "OpenLaszlo", an open source cross platform XML/JavaScript based web programming system that supports Flash and browser JavaScript/HTML. http://www.donhopkins.com/drupal/node/124

Here is an article I wrote about constraints in OpenLaszlo and Garnet: Constraints and Prototypes in Garnet and Laszlo http://www.donhopkins.com/drupal/node/69

Oliver Steele (one of the architects of OpenLaszlo, and a great Lisp programmer) describes how OpenLaszlo supports "instance first development" and "rethinking MVC": http://osteele.com/archives/2004/03/classes-and-prototypes http://osteele.com/archives/2003/08/rethinking-mvc

I've used OpenLaszlo a lot, and I will testify that the "instance first" technique that Oliver describes is great fun, works very well, and it's perfect for the kind of exploratory / productizing programming I like to do. (Like tacking against the wind, first exploring by creating instances, then refactoring into reusable building block classes, then exploring further with those...)

OpenLaszlo's declarative syntax, prototype based object system, xml data binding and constraints support that directly and make it easy.

OpenLaszlo's declarative syntax and compiler directly support instance first development (with a prototype based object system) and constraints (built on top of events and delegates -- the compiler parses the constraint expressions and automatically wires up dependences), in a way that is hard to express elegantly in less dynamic, reflective languages. (Of course it was straightforward for Garnet to do with Common Lisp macros!)

Re:What web developers thought of in the noughties as being ... by endlessvoid94 on Friday May 16, 2014 @12:10PM (#7756208)
> One important criterion is for end-users of all kinds to be able to easily make their own views in a very powerful ad hoc way via construction.

This sounds exactly like Doug Engelbart's "viewspec" idea in NLS.