Thursday, December 29, 2005

Method "Overload" Comments: Further Discussion

Note at the end of each blog entry there is an indication of how many comments have been posted to that particular entry. Sad to say, most of them say "0 comments," but after the immediately previous entry there were "4 comments" (well, actually 2 comments plus 2 responses from me).

If you click on the "... comments" you will be taken to an area where you can read comments people have posted or you can post a comment yourself. Before you can post a comment, you do have to register with Blogger.com, but you can register without having to start a blog.

Some helpful comments were posted by "silverpie":
Two improvements I would suggest: CStr() instead of Str(), so that if the user's format isn't US, it will still display as the user expects. Second, have the numeric version take a double as its parameter--it will still accept integers, but can thus show fractional values too.
Actually, even by itself CStr does much of what my "overloaded" S function does, i.e., it Converts to a Str a number of different data types. But I would argue that my S function still has at least two advantages: (1) It is easier to type one character ("S") rather than four ("CStr"), and (2) my S function has other features built in (specifically, EndOfLine and "|"). Here's the improved version of one of my definitions, thanks to silverpie's comments:
Function S (Param1 As Double) As String
Return EndOfLine + CStr(Param1) + EndOfLine
End Function
(The other definitions remain as they were before.)

I'd be interested to hear if people reading this have any of their own suggestions for worthwhile Method "overloads."

Also posted was this comment from Darryl of "glenarbourtech":
Hey Barry,

I just wanted to comment that as a RealBasic newbie, I really appreciate what you are doing here. Keep up the good work!

Darry|
Both posts are important because they both encourage me to keep this blog going. Writing a blog and writing programs takes time and effort (in short, it's a lot of work!), and what keeps me going is getting feedback from readers. So please feel free to post a helpful comment or a relevant question and/or please feel free to write me a private email at rb@ix.netcom.com.

Barry Traver



Blog Home Page: http://traverrb.blogspot.com/

Programs and Files Discussed in the Blog: http://traver.org/traverrb/

0 Comments:

Post a Comment

<< Home