Re: Relationships between objects in CLOS
- From: Ken Tilton <kentilton@xxxxxxxxx>
- Date: Wed, 12 Jul 2006 03:36:55 -0400
Lemon wrote:
Ken Tilton wrote:
Point of information: "model" to me is a rather general and abstract
word which seems to be used below as if it has a very specific meaning.
Yes? No? Are we talking about UML or something? is the big win the bit
about "technology neutral"?
It is indeed an overused term, but I was not using it in the UMLstract
sense. If I am building a bloggling app, my app will need to manipulate
domain concepts like blogs, posts, comments, etc (e.g. create a new
post and associate it with Joe's blog, find specific comments, change
properties of posts, etc). That is the sense of model I was implying:
very concrete and dealt with at a programming level.
OK, but then why do I need EMF if, as Graham says, I can build my language up to the domain? No, Java does not do that other than with (ick) singly-inheritant class descriptions (not that that is not a start).
I build models out of CLOS. I persist with AllegroStore or Rucksack or
cl-xml or print/read. I use Cells to connect everything. I do not use a
second language from which Lisp is generated, and indeed this "model
building" is Just Programming.
As with AOP, EMF just sounds like another measure of how hard it is to
develop big, complex systems with a fundamentally primitive and broken
language like Java.
I agree to some extent. I agree that Java as a language leaves a lot to
be desired and makes the job of a programmer harder. That may increase
the appeal of using something like EMF in the Java world, but even so,
there are features in EMF that go beyound event to what CL and CLOS
support out of the box. One example is the need to implement something
like Cells in CL (if I understood its general idea correctly).
OK, but now we are not talking about limits to the abstraction one can achieve. I mean, I /did/ manage to add constraints directly to Lisp, such that rules are written simply in Lisp with all its expressive power. But to me this constraints thing is not about abstractive power, it is just something no one thought to build into a language. hell, I have reached the point where it seems to me they simply missed the boat on computer programming when they built the first computer and did not implement dependency trackingin hardware.
I am a first hand witness of how one has to integrate a varied of
different libraries and frameworks in order to get an implementation
done in Java. I imagine that is still true in CL, but maybe to a small
degree because the language provides the flexibility needed to remove
all the unneeded crap and hide what the programmer shouldnt be dealing
with.
Lemon wrote:
Following are some features I use from EMF. I dont care much about
Java, EMF or MOF per se and I am by no means preaching them here, but I
do care about the high level and concrete benefits that a framework
like EMF brings to building real applications:
Well of course a good Lisp programmer works at a terrifically high level
thanks to macros and reflection and CLOS etc etc etc. I think the
culture clash is the very idea of looking for EMF (as in a distinct tool
to be learned) in Lisp when Lisp /is/ EMF.
I can see that to some extent as I mentioned above. CL didnt preclude
the need to create Cells, for instance. On the other hand, I can also
see that a lot of the value and design decisions in EMF where driven by
Java's limitations. EMF takes a lot of the pain out of the programmer
when writing consistent models in Java, but surely adds a bunch of
other pains to the mix.
One of my goals re: CL is understand the pains it removes and the pains
it adds; gauge what have I been missing all these years building
applications in Java. And representing domain models in CL is one
focus.
- EMF provides an infrastructure to use model in a Java application.
- Based on OMG's MOF: abstract language and framework for specifying,
constructing, and managing technology neutral metamodels
Neutrality? I want to bury other languages, not have a gateway to them.
I consider the above MOF's goal at a larger scope than the programming
level we have been talking about here. The world is not just CL or Java
and the fact that the models can be described at a meta-model level
means that I can share models between CL and Java: both instances of
the models but also the models themselves. MOF is a meta-model
(circular) that allows one to describe domain models. It is a small
subset of UML. XMI is just an XML representation of anything produced
by MOF instances being them domain models or their domain model
instances. However, I prefer not to emphasize that since it is a can or
worms...
- Various Eclipse projects are relying on EMF to create models
- Notification framework: there is a well defined API for being
notified about state changes in EMF object attributes/references (i.e.
slots).
This is where Cells would come in.
In my first read of Cells, I got the impressions that it allows one to
create calculated slots only, but it seems that it can do more than
that.
When you add propagation from changed dependency to "calculated slot", the imperative paradigm reverses course and flows in the other direction: all application behavior arises from serial assignments of new values to places one value at a time.
I'll take a deeper look. Can I consider the docs in the Cell
project site the main source?
You might look for cells-manifesto.txt in the source distro, or some nice discussions in the PyCells archive. The doc you can find on my web site and in things like 01-cell-basics.lisp are syntactically out of date but make all the points.
Or are there other documents I should be
aware of?
- Serialization framework: create your models in EMF and you
automatically serialize them to XMI or a custom schema. Proxy
resolution and demand loading framework. At least two projects I know
of are working on a framework that can automatically persist your
models to a relational database.
Here again I would hold out for persistent CLOS and avoid the ugliness
and hassle of changing my representation merely to persist.
- Reflexive API and Dynamic model definition: create and introspect
models dynamically
Beyond the Java reflection package?
Yes. I am able to reflect at the domain model level. However, I have to
use a generic API to do that (I can hear already the "arghhh" in the
crowd ... :-)).
- Bidirectional reference handshaking: both end of the relationship are
always kept in sync
- Simple models constraints on objects and relationships
- Tracking modifications
Cells again.
Ok, I'll definetely have to read on Cells.
- Validation framework
Would that be the Lisp compiler?
:-) Can the List compiler guarantee or at least validate that blog
posts cannot have more than 100 comments? Or that an employee cannot be
its own employer?
And of course one could enforce that in code, no need to do it in EMF. I will guess that there is a declarative quality to expressing in EMF that makes you prefer it to coding up the same rule directly. yes, declarative rocks, and is possibly the greatest charm of Cells programming: just state the rule and sit back and let the engine do the rest.
kenny
--
Cells: http://common-lisp.net/project/cells/
"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
.
- References:
- Relationships between objects in CLOS
- From: Lemon
- Re: Relationships between objects in CLOS
- From: Jack Unrue
- Re: Relationships between objects in CLOS
- From: Jack Unrue
- Re: Relationships between objects in CLOS
- From: Ken Tilton
- Re: Relationships between objects in CLOS
- From: Lemon
- Re: Relationships between objects in CLOS
- From: Ken Tilton
- Re: Relationships between objects in CLOS
- From: Lemon
- Relationships between objects in CLOS
- Prev by Date: Re: What should (ignore-errors ((foo))) do?
- Next by Date: Re: What should (ignore-errors ((foo))) do?
- Previous by thread: Re: Relationships between objects in CLOS
- Next by thread: Re: Relationships between objects in CLOS
- Index(es):
Relevant Pages
|