Conveying meaning is the essence and beauty of code.The article ends with a nice quote from Buckminster Fuller:
One of the essential spoilers of understandable and clear code is the inevitable time sequential specification in imperative languages. It is one of those little critters in programming we could happily do without. It always spoils things. There is always a sequence of events that you did not take into account. In catering for these rare sequences you add code and then more code, you add complexity and make it less understandable, less beautiful, often even ugly. An additional problem with sequential specifications in programming languages is that it is only essential at some points. At many points in your program it is not important and therefore an over specification. The main frustration comes from the fact that it can not be specified where sequential execution is essential and where it is not. It is then very hard, if not impossible, for humans as well as computers to separate the two. We need programming languages that do not require time sequential specifications to make truly beautiful code. We need to abstract away from time to encounter real beauty. This perhaps explains my preference for declarative and functional programming where sequntiality is not explicitly specified. When you free yourself from this over-specification there is more beauty.
When I am working on a problem I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong....
The astute reader will spot that I have used the word sequence rather loosely. In many In many cases, the interactions don’t have to occur in any particular sequence. To buy that 80-cent drink, I could put in eight dimes, three quarters and a nickel, or ...(you can fill in the list). It doesn’t matter which coin goes in first.
I overlooked that the showMenu() method should also be in the contract for the Controller role:
stageprop
Controller {}
requires {
void showMenu();
Command awaitNextCommand();
}
So in a way, the use case Context does still have some knowledge
of the UI. But how to prepare and display the menu is still up to
the View and the Controller. The Controller could of course
provide a more abstracted interface to avoid getting even as
specific as referring to a "menu", but I'm not sure that's
necessary in this case.
Our type system should let us, and we should, define temporal constraints & relationships. And explore them, generate automatic fuzz tests from them, hive us interactive queries about them, etc.
Yes, those are the problems I attempted to address with my
proposed solution. I didn't show the full code (because I haven't
written it yet), but the idea is that there would only be a single
entry point, which could be called start() or perhaps something
more descriptive. All subsequent user interaction (until the end
of the use case) is managed internally within the Context,
although it does delegate UI-specific concerns to MVC.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
Visit this group at https://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composition+unsub...@googlegroups.com.
Den 24/04/2016 kl. 21.55 skrev Matthew Browne <mbro...@gmail.com>:So in a way, the use case Context does still have some knowledge of the UI. But how to prepare and display the menu is still up to the View and the Controller. The Controller could of course provide a more abstracted interface to avoid getting even as specific as referring to a "menu", but I'm not sure that's necessary in this case.
Den 25/04/2016 kl. 06.37 skrev Hai Quang Kim <wan...@gmail.com>:In reality, I tend to combine 3 use cases into one context with 3 entry points (start, stop, update..) which is easier to read for me.
Den 25/04/2016 kl. 09.00 skrev Hai Quang Kim <wan...@gmail.com>:Yes, it is more like scenario than use cases.
The pong example gives me a better idea to refactor my code to have less and even 1 entry for context.
Den 24/04/2016 kl. 21.55 skrev Matthew Browne <mbro...@gmail.com>:
So in a way, the use case Context does still have some knowledge of the UI. But how to prepare and display the menu is still up to the View and the Controller. The Controller could of course provide a more abstracted interface to avoid getting even as specific as referring to a "menu", but I'm not sure that's necessary in this case.
Just to raise the level of discourse: what problem does that solve?
The current thoughts in Alan Kay's group was that objects should be visible and tangible. I faced the problem that there an activity should be made visible in many different ways. There was also the problem of making structures of related activities visible on the screen. I had always been a fan of separation of concerns. In particular, I advocated that there should be a separation between the UI part of the program and the part with the actual subject matter (a Plan, a Ledger, an Inventory...) With this separation, programs could be run by other programs as well as by humans.I'm mainly concerned about code comprehension. As a reminder, I made an earlier attempt at implementing this use case (as an experiment) in which the Controller and Views played roles in the context:
The fundamental idea of MVC is to separate the code for the substance (i.e., the Model) from the I/O. There could be contexts for the operations on the model and separate contexts for the IO (View/Controller). You can find an example of this separation in my big planning example. A single context that combines the M and the V/C behaviors would violate this idea.My goal is not to artificially eliminate essential coupling, but simply to maintain a separation between presentation and use case logic.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
You're right; separating the Model and View can sometimes weaken
readability rather than improve it. I imagine that's why Trygve
said that in some of his implementations, it made sense for the
Model, View, and Controller roles to all be played by the same
object. But in my experience, with most use cases it's the other
way around. In the shopping cart example, I maintain that
including all the controllers and views within the Place Order
context (or even within nested contexts for its subfunctions like
Pay for Order) would be distracting and make it harder to
understand and maintain the code. Based on my investigation so
far, I currently have the same opinion regarding the library
borrowing example, although there's more room for debate there.
There are additional considerations. In the MVC Pattern Language document, the "Model/Editor Separation" pattern is motivated by the following problem:
The user may want to inspect and edit information that exists in a business object.
These objects may not be directly accessible from the node holding the user interface
The objects may be too complex to be viewed directly
Different tasks may require different presentations and operations on the same information; each version highlighting some aspect and suppressing something else.
I find that I encounter the third bullet point most often, and
that many use cases have at least one instance of that.
The essence of object orientation is
that objects collaborate to achieve a
goal.
Trygve Reenskaug mailto: try...@ifi.uio.no
Morgedalsvn.
5A http://folk.uio.no/trygver/
N-0378
Oslo http://fullOO.info
Norway Tel:
(+47) 22 49 57 27
Den 26/04/2016 kl. 08.04 skrev Trygve Reenskaug <try...@ifi.uio.no>:A real pattern language does not have an author but is a community effort. It does not belong in a printed and signed document. It belongs in a Wiki like Wikipedia where it can grow in beauty and substance.
A living, evolving pattern language for MVC is a wonderful idea.
I'm not sure if you literally were suggesting that Wikipedia would
be a good place for it, but I wonder if it might be better for it
to be worked on and extended somewhere else first (maybe its own
wiki). I do think Wikipedia would be a good place for it
eventually. My concern is that most people in the software
community have a mistaken idea of what a pattern is, so anyone
with an opinion on their favorite MV* framework or technique could
potentially add "patterns" that are nothing more than myopically
technology-focused techniques that in some cases detract from the
essence of MVC. But I also think a balance should be struck so
that contributions are not limited to only those who have studied
patterns in great depth. The work of Alexander is very important
and we should continue to encourage people to study it (including
me ;) ), but it would be rather limiting to first require everyone
to read several long books and articles before making even small
contributions. And I gather that patterns are about more than book
knowledge: an appreciation of patterns in nature and their beauty
is fundamental. Perhaps the wiki site could include a brief
introduction to patterns that would inspire people to learn more,
so that anyone seeking to contribute would at least be made aware
of the original meaning of "pattern" and "pattern language".
Regarding Wikipedia...on the other hand, this would probably be
its own article, "MVC Pattern Language", rather than in the main
MVC article. So perhaps it could initially be published and
refined by a small team without too much interference from
anonymous users who don't know what patterns are about.
> Google, I think, is on its way there
Scary to me.
Maybe run it thru Typescript's inference &c.