Re: genesis design

Reinout van Rees <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Organization Zest software
Message-ID <[email protected]>
Daniel Nouri wrote:
> 
> So what about reading the destination files?

We'll just use the existing pyparser.py from archgenxml. That's the only 
part of archgenxml that is almost 100% unittested :-) It'll probably be 
the generator's responsibility to check if files already exist and mix 
'em a bit.

>>There are some configuration possibilities to steer this process. Of
>>course some commandline or config file parameters for setting some
>>global options. More directly important are the profiles and the
>>generator.
> 
> I think you guys intended to use the CA for configuration?  Which I
> think makes a lot of sense.  Plug in your own profile or stereotype
> handler or whatever and off you go.

CA, what's that?
Pluggable: yes, amen.

> So profiles are a way to add special behaviour based on tagged values
> and stereotypes?

Not 100%. It's important to see this as a two-step process. Stereotypes 
only *indicate* something. "This is not a normal class, this is a 
Membrane class". The internalmodel ends up giving this item a different 
interface.

Step two, the behaviour, has to be handled by the 
generator/tranformations. If there's no adapter to handle the special 
interface, handling will just fall back to that of a normal class (for 
instance).

> Why do profiles live in both profiles and generator?  From what I
> understand, profiles are only configuration and documentation, whereas
> the implementation is in the generator?

I'd like to keep the profile a bit separate from the implementation. The 
profile is only configuration and documentation, right. The generator 
doesn't even need to read the profile. It just has to have the right 
adapters for the interfaces.

>>  All those little things like an '__init__.py' file in every
>>  directory are handled by creating it on every incoming
>>  'IPackage'. The adapter itself can of course query the package for
>>  contained items and calling an appropriate adapter that gives back
>>  an import line.
> 
> Query package for contained items and create import lines?  Could you
> eloborate on what those imports are for?  Are they inside the __init__.py?

Just something like this (lifted from a 2.0.5 product):

def initialize(context):
     # imports packages and types for registration
     import JoinIn
     import JoinInFolder
     import PressRelease
     import Publication
     import IllustrationMixin
     import NewsItemFolder


>>  The great thing here is that *if* you've got a certain class of item
>>  in the package for which you don't want an import line *then* you
>>  just need to provide an adapter for that interface that keeps quiet
>>  when asked for an import line.
> 
> I think I get it.  Every class contained in a package gets imported in
> the __init__.py until it explicitely says it doesn't want to?

yes. Elegant way (adapters!) of handling corner cases and exceptions.

>>Internal model -- It can store most basic UML-like items. Stereotypes
>>get turned into implemented interfaces, ready for the generator to use.
> 
> OK, I think i know what internal model does.

Jens had an idea of having just one very generic class for the internal 
model instead of the "current" UML-like set of classes. I thought it to 
be a bad idea, but perhaps it's not so bad after all. So it might change 
:-) Perhaps the internal model will only be a reasonably thin adapter 
for a suitable external UML model reader.

Daniel, were you looking at existing UML python parsers? If gaphor's 
model would be usable, that would be worth something to me. Python UML 
tool plus genesis :-)

Now if only I'd get gaphor (with the metric ton of gnome and gtk libs) 
running on OSX... Limi, did you manage it already?

Reinout

-- 
Reinout van Rees                       r.van.rees @ zestsoftware.nl
http://vanrees.org/weblog/                  http://zestsoftware.nl/
"Military engineers build missiles. Civil engineers build targets."



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.