Changes between Version 3 and Version 4 of relationships
- Timestamp:
- 03/07/2011 09:22:58 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
relationships
v3 v4 26 26 When 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. 27 27 28 To open the browser that supports relationships, you need to do: '' RelationshipBrowser open''28 To open the browser that supports relationships, you need to do: ''!RelationshipBrowser open'' 29 29 30 30 {{{ … … 34 34 = How to Use = 35 35 36 When editing relationships, use the relationship browser: '' RelationshipBrowser open''36 When editing relationships, use the relationship browser: ''!RelationshipBrowser open'' 37 37 38 38 I'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. … … 42 42 In the relationship browser, select the ''Artist'' class and click on the relationship symbol: --> 43 43 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.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. 45 45 46 46 If 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''. … … 50 50 Assume we have found out that sometimes, multiple artists collaborate to create an artwork. 51 51 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.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. 53 53 54 54 Assume 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. … … 60 60 The relationships are not added to monticello when saved (however, the generated methods and instance variables are - your code still works). 61 61 62 Generated methods are editable. Don't do it! 63 Generated instance variables are editable and accessible. Don't do it, use the accessors instead! 64 62 65 = How to Extend = 63 66 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. 65 70 66 71