Changes between Version 3 and Version 4 of relationships


Ignore:
Timestamp:
03/07/2011 09:22:58 PM (13 years ago)
Author:
christoph.neijenhuis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • relationships

    v3 v4  
    2626When checking out from Monticello, an additional instance variable is added to Class, causing a lenghty recompile. You probably want to do this on a new image.
    2727
    28 To open the browser that supports relationships, you need to do: ''RelationshipBrowser open''
     28To open the browser that supports relationships, you need to do: ''!RelationshipBrowser open''
    2929
    3030{{{
     
    3434= How to Use =
    3535
    36 When editing relationships, use the relationship browser: ''RelationshipBrowser open''
     36When editing relationships, use the relationship browser: ''!RelationshipBrowser open''
    3737
    3838I'll use a simple example to illustrate the use of this framework: We have a class ''Artist'' and a class ''Artwork''. Artists can create many artworks, but an artwork can only have a single artist. We therefore have a one to many relationship between artist and artwork.
     
    4242In the relationship browser, select the ''Artist'' class and click on the relationship symbol: -->
    4343
    44 In the category menu, select ''OneToMany''. As you can see, there is a template for a ''OneToManyRelationship'' in the edit pane. Simply add the ''Artwork'' class as the right class and save. The new relationship has been created.
     44In the category menu, select ''OneToMany''. As you can see, there is a template for a ''!OneToManyRelationship'' in the edit pane. Simply add the ''Artwork'' class as the right class and save. The new relationship has been created.
    4545
    4646If you go back to the instance view, you can see that ''Artist'' does now have the methods ''addArtwork:'', ''artworks'' and ''removeArtwork''. ''Artwork'' has the method ''artist''.
     
    5050Assume we have found out that sometimes, multiple artists collaborate to create an artwork.
    5151
    52 Go back to the relationship view (use -->) and select the existing relationship. The edit pane is filled with the previous values. To create a many to many relationship, replace ''OneToManyRelationship'' with ''ManyToManyRelationship''. Hit save and look at the newly generated methods.
     52Go back to the relationship view (use -->) and select the existing relationship. The edit pane is filled with the previous values. To create a many to many relationship, replace ''!OneToManyRelationship'' with ''!ManyToManyRelationship''. Hit save and look at the newly generated methods.
    5353
    5454Assume all artworks in this relationships are paintings. We don't want to create a new subclass for this, but change the name used in the methods.
     
    6060The relationships are not added to monticello when saved (however, the generated methods and instance variables are - your code still works).
    6161
     62Generated methods are editable. Don't do it!
     63Generated instance variables are editable and accessible. Don't do it, use the accessors instead!
     64
    6265= How to Extend =
    6366
    64 ''Internal documentation. Show models, explain the architecture. Do anything that may help a new developer to extend this project.''
     67''!RelationshipDescription'' is an abstract class which encapsulates a lot of the shared logic. The inheriting classes implement the generation / removal of the instance variables and methods needed for its specific type.
     68
     69''!RelationshipBrowser'' implements the changes for relationships on top of the standard browser from Squeak. It mostly overrides existing methods and uses the relationships like one would from the workspace.
    6570
    6671