I hope I'm not exceeding the limit for questions in one day.
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:
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.
--- Mark Volkmann
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?
- Bert -
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
Am 26.09.2008 um 12:46 schrieb Mark Volkmann:
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.
I see. In that case I'd just name the methods
attribute:value: and prefix:attribute:value:
The first one actually exists in Squeak's XMLWriter ;)
In general we prefer single words over interCaps - makes code more readable.
- Bert -
One newbie to another - YES LOL Just kidding
If it were me.....I would look for something already in Squeak - like XMLElement in the XML-Parser category - and either use it straight out of the box or subclass it. (Notice it already has attributeAt: attributeName put: attributeValue)
Just my two cents.
Mark Volkmann wrote:
I hope I'm not exceeding the limit for questions in one day.
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:
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.
Mark Volkmann
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
On Sep 26, 2008, at 2:42 PM, John McKeon wrote:
One newbie to another - YES LOL Just kidding
If it were me.....I would look for something already in Squeak - like XMLElement in the XML-Parser category - and either use it straight out of the box or subclass it. (Notice it already has attributeAt: attributeName put: attributeValue)
The reason I don't want to do that is that I'm porting a library I wrote to Smalltalk. I've already implemented it in Java and Ruby. Other people are working on Perl, C# and JavaScript implementations. If you're interested, you can read about it at http://www.ociweb.com/ wax.
I'm not necessarily expecting that the Smalltalk world will gravitate toward using my library. For now I'm doing it mainly for the learning experience.
Just my two cents.
Mark Volkmann wrote:
I hope I'm not exceeding the limit for questions in one day.
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:
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.
Mark Volkmann
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
--- Mark Volkmann
beginners@lists.squeakfoundation.org