What is the difference between a Morph in Morphic and a NSView in Cocoa?

余生长醉 提交于 2019-12-10 03:26:28

问题


I'd like to know about the things that make Morphic special.


回答1:


Morphic is much more than NSView or any other graphics class that simply allow the re-implementation of a limited set of features. Morphic is an extremely malleable UI construction kit. Some design ideas behind Morphic makes this intention clear:

  • A comprehensive hierarchy of 2D coordinate systems is included. They are not restricted to Cartesian or linear. Useful nonlinear coordinate systems include polar, logarithmic,hyperbolic and geographic (map like) projections.
  • Separation of the handling of coordinate systems from the morphs themselves. A morph should only need to select its preferred coordinate system, instead of needing to convert every point it draws to World coordinates by itself. Its #drawOn: method and the location of its sub-morphs are expressed in its own coordinate system.
  • Complete independency of Display properties such as size or resolution. There is no concept of pixel. The GUI is thought at a higher level. All the GUI is independent of pixel resolution. All the rendering is anti aliased.
  • Separating the coordinate system eases the moving, zooming and rotation of morphs.
  • All coordinates are Float numbers. This is good for allowing completely arbitrary scales without significant rounding errors.
  • The Morph hierarchy is not a hierarchy of shapes. Morphs don't have a concept of a border or color. There is no general concept of submorph aligning. A particular morph may implement these in any way that makes sense for itself.
  • Morphic event handling is flexible and allows you to send events to arbitrary objects. That object need not subclass Morph.



回答2:


Warning: Smalltalk's live dynamic environment is a red pill. Static, frozen languages will never be the same for you ;-)

In a nutshell: Morphic is a virtual world where you can directly explore live objects (just like the real world). Did you ever look at a UI and...

  • wonder "wow, that's really cool! How did they do that?"
  • kvetch "I wish they had done X instead!"

While these thoughts would lead to pain and frustration in any other environment, not so in Morphic.

If you want to blow your mind, become a god in a Morphic world:

  1. Launch a Pharo image, and click on the background (which is actually the "World") to bring up the world menu:

  2. Bring up the "halos" on one of the menu options (shift-alt-click on my Mac):

  3. Drag the "Pick Up" halo (top-middle) and drop it somewhere in the world:

  4. Enjoy your menu item which is now available wherever you want it:

Seriously, click it and watch the Browser open!!

Ever have an option you always use that a vendor has buried three-menu-levels deep? Could this be useful?! This is a glimpse of the power of a live direct GUI environment like Morphic.

If you're intrigued, read John Maloney & Randall Smith's paper Directness and Liveness in the Morphic User Interface Construction Environment




回答3:


The title do not map your question, so I answer your question and not the title.
I have read about Morphic the last two days and conclude with what I think makes morphic special.

Morphic is perfect for live coding. That is a direct mapping such that when code is changed the output on the screen change. And/or if morphs on screen is changed (draged) the values in the code is changed. That is cool in art performance!

But Morphic aims for higher abstractions than that. The properties of the morphs is abstracted away from the code. Do the SoC to a file or fetch a server-side database.

I suppose WebStorage and JavaScript file is a good option to store the liveness state of the Morph properties changed interactively. You see - programming is done through each Morph. Then the code need only to handle events from click and drag.

The aim for research has even abstracted the code away. Coding can be done through the Morph to define what happen with click or drag. Morphs can be puzzle pieces as in Scratch.

A program has to be backed up into a file somewhere. I don't consider to do coding on a cloud as safe. So a JS-file is the only alternative (if not setting up a server is an option), because datafiles is not allowed locally, not even in same folder as the web app. The Same Origin policy means same server - not same folder.

When the app starts the Javascript file (or Web Storage in first place) will set up the world of morphs. User interacts with that world. The new state can be stored in WebStorage and bacuped by a download.

You can use Lively Kernel as the language in the file or store the morph data in an object or whatever you find simplest to generate as a file to download.

So what is special with this? I am not repeat the accepted answer, but this is my conclusion:

  • Everything you see on the Morphic screen is a morph.
  • The tree of morphs is called a world.
  • The coordinate, dimension and properties of each morph is abstracted away from the code into the tree.
  • The research aims for abstract away the code too.


来源:https://stackoverflow.com/questions/4070444/what-is-the-difference-between-a-morph-in-morphic-and-a-nsview-in-cocoa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!