[Seaside] HTML method naming conventions
Holger Kleinsorgen
kleinsor at smallish.org
Fri Apr 11 08:23:02 UTC 2008
Edward Stow wrote:
> On Fri, Apr 11, 2008 at 11:18 AM, Steve Aldred
> <aldreds at velocitynet.com.au> wrote:
>> In the "SVG design questions" thread Philippe Marschall wrote:
>>
>>> Just a side note here. Wherever possible we tried to avoid the C-ish
>>> names of html elements in Seaside and used full names instead. So
>>> instead of #img we name #image. Here this would mean #rectangle
>>> instead of #rect.
>>>
>>>
>> Not trying to be difficult or anything but why?
>>
>> Given to use Seaside you have to have a good understanding of HTML where is
>> the advantage in translating tags to different message name? Renaming for
>> the sake of being 'Smalltalkish" just makes entry for existing web
>> developers that much more difficult. How many people have tried to send #tr
>> and #td?
>
> + 1 I would prefer to use html tag names, td, tr, a.
>
> And seaside adds to the html language disconnect by using #url: for
> src and href attributes.
There's a SVG example that lets me agree with the "full names" policy:
The SVG path tag. The following example draws a simple pie chart:
<path
d="M600,350 l 50,-25
a25,25 -30 0,1 50,-25 l 50,-25
a25,50 -30 0,1 50,-25 l 50,-25
a25,75 -30 0,1 50,-25 l 50,-25
a25,100 -30 0,1 50,-25 l 50,-25"
fill="none" stroke="red" stroke-width="5"/>
the path is encoded in the "d" attribute as a set of primitives. A
letter represends a command (move to, elliptical arc to). Uppercase
characters imply absolute coordinates, lowercase characters relative
coordinates.
If this would be translated directly into a SVGPathTag, using the names
specified in the W3C SVG spec, the Smalltalk code would look like this:
svg path d: "M600,350 l 50,-25 a25,25 -30 0,1 50,-25 l 50,-25 a25,50 -30
0,1 50,-25 l 50,-25 a25,75 -30 0,1 50,-25 l 50,-25 a25,100 -30 0,1
50,-25 l 50,-25"
or
svg path
Mx: 600 y: 350;
lx: 50 y: -25;
arx: 25 ry: 25 x-axis-rotation: -30 large-arc-flag: 0 sweep-flag: 1
x: 50 y: 25;
lx: 50 y: -25;
....
or maybe
svg path
M: 600 at 350;
l: 50 at -25;
a: 25 at 25 x-axis-rotation: -30 large-arc-flag: 0 sweep-flag: 1 to: 50 at 25;
lx: 50 y: -25;
....
but currently it looks like this:
svg path
moveTo: 600 at 350 relative: false;
lineTo: 50 at -25 relative: true;
arcTo: 50 at 25 radius: 25 at 25 rotation: -30 large: true sweep: true
relative: true.
lineTo: 50 at 25 relative: true;
...
or alternatively (using a state flag)
svg path
moveTo: 600 at 350 relative: false;
defaultIsRelative;
lineTo: 50 at -25;
arcTo: 50 at 25 radius: 25 at 25 rotation: -30 large: true sweep: true;
lineTo: 50 at 25;
...
much easier to read.
More information about the seaside
mailing list