[yast-devel] WebYaST data model
Hi, yesterday's commit by jsuchome (model adapted to the YaST data structure, see http://lists.opensuse.org/yast-commit/2009-07/msg00158.html) raised an important topic which hasn't been discussed before - the data model we use for WebYaST. REST only defines the architecture how to manage resources, it does not describe how resources look like. In WebYaST, all the RESTful stuff is nicely handled by Rails ActiveResource. It manages Ruby objects according to the REST style. However, this leaves the responsibility for a good data model on the developer when defining the Ruby classes. A couple of rules should apply here, e.g.: - Honor Ruby style when naming attributes and classes. Classes have CamelCase, attributes have lower_case_with_underscores (see http://www.caliban.org/ruby/rubyguide.shtml for the 'Unofficial Ruby Usage Guide') - Limit the attribute types to - numerical (int, float) - string - boolean - array (list) - hash (map) Hash is probably questionable as it might be more useful to use a separate class for this. Its probably a case-by-case decision. - Document the resource class rDoc (http://rdoc.sourceforge.net/doc/index.html) is included with Ruby and quite useful for in-line documentation. - Make the resource introspectable This is mostly covered by ActiveRecord itself, we're still missing a classification on what a resource represents (i.e. 'logical device', 'physical device', 'identity' (user), etc.). Proposals welcome ! If anyone has pointers to applicable data models already in use, send them in ! Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Wed, Jul 08, 2009 at 10:01:54AM +0200, Klaus Kaempf wrote:
yesterday's commit by jsuchome (model adapted to the YaST data structure, see http://lists.opensuse.org/yast-commit/2009-07/msg00158.html)
A more readable version of the commit: http://git.opensuse.org/?p=projects/yast/rest-service.git;a=commitdiff;h=3cc...
- Limit the attribute types to - numerical (int, float) - string - boolean - array (list) - hash (map)
Hash is probably questionable as it might be more useful to use a separate class for this. Its probably a case-by-case decision.
OK, I understand that as ruling out the YaST specialties (path, symbol, term). Or is this in Ruby context? Then what are we leaving out?
- Document the resource class
rDoc (http://rdoc.sourceforge.net/doc/index.html) is included with Ruby and quite useful for in-line documentation.
Yes. "rake rdoc"
- Make the resource introspectable
This is mostly covered by ActiveRecord itself, we're still missing a classification on what a resource represents (i.e. 'logical device', 'physical device', 'identity' (user), etc.). Proposals welcome !
I don't understand what introspection you mean. Example? URL? -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Klaus Kaempf
-
Martin Vidner