From: Tom Sawyer Date: 2002-09-15T01:25:43+09:00 Subject: Re: MVC and OO Design? On Fri, 2002-09-13 at 18:44, MetalOne wrote:> > I guess my real questions are the following: > 1) Under the MVC scenario, does it make sense to expose all of the > model's data using attr_reader. What if the code was written in Java, > where getter functions would be required for all data? Imagine a very > complicated nested data structure that would require hundreds or > thousands of lines to make readable. > 2) Would it be better to add the draw functions to the model by > opening up the model later. Perhaps a view module could be created. > This module would contain the code that opens the Model and adds the > draw function or functions. > What if you're using Ruby and can't open the class later, but you have > to edit the only source for the class. In my case the source is > available, but conceivably, in general, it might not be. > > Any thoughts on this subject or good links would be greatly > appreciated. i have good news for you my friend. all though the code is not yet realeased, the GUtopIa project has successfully solved these problems. you do not have to touch you model one single iota, and yet with GUtopIa's Controller module you can access your model on two different levels, as you see fit: either at the level of what the model exposes, through public methods including accessor methods, or you can access the model on a level that exposes it in its entirety, via any instance or class variable. again, you can do this without touching the model code at all. it is an "Automagiacal Observer". if you're interested i can make the code available. i have been thinking about releaseing this section of the code soon anyway as a seperate offshoot project, becasue i realized it actually enables Declaritive Programming (like Prolog) in Ruby. cool, ey? -- tom sawyer, aka transami transami@transami.net