[Newbies] method naming advice
Mark Volkmann
mark at ociweb.com
Fri Sep 26 19:46:47 UTC 2008
On Sep 26, 2008, at 2:36 PM, Bert Freudenberg wrote:
> Am 26.09.2008 um 12:24 schrieb Mark Volkmann:
>
>> I hope I'm not exceeding the limit for questions in one day.
>
> Not yet ;)
>
>> I'm porting some Java code that deals with XML to Smalltalk. A Java
>> class has these methods.
>>
>> public StartTagWAX attr(String name, Object value) ...
>> public StartTagWAX attr(String prefix, String name, Object
>> value) ...
>>
>> What would be good Smalltalk names for these methods?
>> Here's my first guess.
>>
>> attrName:value:
>> attrPrefix:name:value:
>
> The way to test this is to check how it looks in a method using
> this. Looks okay except that a Smalltalker probably would prefer
> "attribute" to "attr".
>
>> Note that I don't really have a new to create Attr objects. I just
>> need data describing an attribute so I can output it.
>
> I'm not sure I understand ... do these methods return an new
> Attribute object? Or is the method writing the arguments directly?
The method writes the part of the XML corresponding to the attribute
to a stream. For example,
wax attrName: 'foo' value: 'bar'
would write ' foo="bar"' to the stream and
was attrPrefix: 'p' name: 'foo' value: 'bar'
would write ' p:foo="bar"' to the stream.
---
Mark Volkmann
More information about the Beginners
mailing list