Mailinglist Archive: yast-devel (152 mails)

< Previous Next >
[yast-devel] WebYaST data model
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Wed, 8 Jul 2009 10:01:54 +0200
  • Message-id: <20090708080154.GA7216@xxxxxxxxxxxxx>
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@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups