IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New WARNING - HUNGARIAN NOTATION HEREIN
-drl
New I've crossed the annoyance threshold
There is nothing attactive about this environment.

Why the hell am I wasting my time in it?

Oh, I know.

Hey, ChrisR!!!

Explain to me how to handle this trivial issue.
New Not likely to be a casting issue
C# is case sensitive, so I'd try

htFieldAddrMap[field].Text = val;

I really wish MS had stuck with lower case method/property names - kind of annoyance to my style.
New Oh please.
Of COURSE I tried that.

And anyway, I hacked that out.

I'm far more annoyed with this no strtoint, strtobool, etc.

Do you have a way of converting data types back and forth?

New Just going by the original error
Try the [link|http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemconvertclasstopic.asp|Convert class].

Best I remember is that they frowned on having a bunch of visitor convert functions within the various objects.
New Thank you
The convert class was what I needed.
How many other "base" programming classes will I need?
Is there a language tutorial somewhere I should read / run before I try to code anymore?
And what do you mean "frown"?
What am I doing that is bad here?

New Classic library design issue
The problem boils down to which classes need to understand which other classes. There are three possible solutions:

1). Put all the convert functions in the String class. This is nice to the extent that you can just call the convert function directly from the object to be converted:
   "123.45".toDouble();

The problem from a library design standpoint is that (a). The String class now has to understand all the potential target data formats; and (b). Every time you add a new type, you have to modify the String class to add a conversion function. From languages like Smalltalk, this isn't a problem because the string class can be modified by the add programmers to tack on new functions as needed.

Also, Smalltalk can get away with passing the message on to the class to be converted to. That is, Smalltalk probably just ends up sending a message to the Double Class (in this example) with the string as the message to the double class. That means that the String class doesn't have to know how the string gets converted to a double, it just needs to pass the message on to the double class and let it do the magic.

Problem with languages like Java and C#, though, is that they don't have this dynamic capability, either in terms of adding methods to the base String class or to dispatching the problem on to another target class. As such, both Java and C# don't put the convert methods in the String class. VB does do some compiler magic to do auto converts but it's rather limited and come up to bite you as often as not.

2). Put the convert methods in the target classes. Since you don't have dynamic dispatch like Smalltalk, you have to do the dispatch yourself. With overloading, though, you can have one method in the target class that handles all of the various possible inputs. Something like:
   Double.parse("123.45");

This has the advantage that the Double class is the only one that needs to understand how you arrive at a double from other types of data. It has the disadvantage that the Double class still has to understand all the possible source data formats that will be shot it's way. IIRC, this is the technique used by the Java libraries.

3). Seperate the problem of conversion from both the source and target classes. That is, treat conversion as a specialized problem and lump it into a class all by it's lonesome self. Something like:
   Convert.parseDouble("123.45");

Has the advantage of keeping the problem out of both the source and target classes (String and Double). Has the disadvantage of having a class that has to understand all the intricacies of conversion for all the n possible from-to combinations. This seems to be the method chosen by C#.
New This is not a problem in REAL OO languages
Only the static ones.

For instance, in Objective C I frequently would add methods to NSString in a category (bundle of dynamically loaded methods) that made my life easier. ie
[myString asNetworkMessage] or whatever.

Smalltalk, ditto - adding asFoo methods is the accepted way of adding conversions.

Its only the pretend OO languages (C++, Java, C#) that have this annoyance.



That was lovely cheese.

     --Wallace, The Wrong Trousers
Expand Edited by tuberculosis Aug. 21, 2007, 06:17:50 AM EDT
New Is a casting issue
This syntax works:

((ComboBox) htFieldAddrMap[field]).Text = val;
New Is a junk idiom issue - see Todd's post
-drl
New Is a language library/design issue
This is telling:

"I then have a switch statement that attempts to assign
the data to the value field."

Not very OO is it. Polymorphism possible? Guess not. If you ever have a switch statement (or ladder-like if else construct) discriminating on type, then you have a broken OO system or class library.

No polymorphism, no OO.



That was lovely cheese.

     --Wallace, The Wrong Trousers
Expand Edited by tuberculosis Aug. 21, 2007, 06:19:10 AM EDT
New /me whistles nonchalantly to myself in public
New 'splain please.
New Use Python.
All your annoyances go away. Python code will be much smaller and easier to write than C#.

And you *can* just pick Python up in a few hours.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New What GUI toolkit?
Screen painter, etc?
New wxThingy, I wot.


Peter
[link|http://www.debian.org|Shill For Hire]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Blog]
New Re: wxThingy, I wot.
[link|http://wxpython.org/what.php|http://wxpython.org/what.php]
[link|http://www.roebling.de/default.html|http://www.roebling.de/default.html]
[link|http://wxglade.sourceforge.net/|http://wxglade.sourceforge.net/]

Wotwot.

Wot.

WOT!


Peter
[link|http://www.debian.org|Shill For Hire]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Blog]
Expand Edited by pwhysall Sept. 10, 2004, 08:28:40 AM EDT
Expand Edited by pwhysall Sept. 10, 2004, 08:32:36 AM EDT
New Valid weekend project
If I can suffer through doing this in VB and C#, I guess I can do it in Python as well.

Note: I'd say my C# version will be releasable in about an hour.

But I REALLY don't like depending on indentation level.
Something tells me as far as evils go, it'll be the lesser.

Thanks.
New Re: Valid weekend project
But I REALLY don't like depending on indentation level.
Some people like it. Some people don't. In my experience the code is extremely readable. Problems with scoping are immediately apparent.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New My unscientific impression from the newsgroup
For those who have come to Python from another language and say they "were unsure about" or outright hated the indentation issue:

Group A: those who come to love indentation, even prefer it, versus
Group B: those who still hate it.

Ratio of A to B: about 50:1.
New Self-selecting sample
People who hate it are less likely to stick with the language. Thus they won't be on the newsgroups.
===

Implicitly condoning stupidity since 2001.
New wxWindows/wxPython
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New GAK!!!
jb4
shrub\ufffdbish (Am., from shrub + rubbish, after the derisive name for America's 43 president; 2003) n. 1. a form of nonsensical political doubletalk wherein the speaker attempts to defend the indefensible by lying, obfuscation, or otherwise misstating the facts; GIBBERISH. 2. any of a collection of utterances from America's putative 43rd president. cf. BULLSHIT

     Casting in C#? - (broomberg) - (24)
         What about things like strtoint? - (broomberg)
         WARNING - HUNGARIAN NOTATION HEREIN -NT - (deSitter) - (22)
             I've crossed the annoyance threshold - (broomberg) - (20)
                 Not likely to be a casting issue - (ChrisR) - (8)
                     Oh please. - (broomberg) - (4)
                         Just going by the original error - (ChrisR) - (3)
                             Thank you - (broomberg) - (2)
                                 Classic library design issue - (ChrisR) - (1)
                                     This is not a problem in REAL OO languages - (tuberculosis)
                     Is a casting issue - (broomberg) - (2)
                         Is a junk idiom issue - see Todd's post -NT - (deSitter)
                         Is a language library/design issue - (tuberculosis)
                 /me whistles nonchalantly to myself in public -NT - (FuManChu) - (10)
                     'splain please. -NT - (broomberg) - (9)
                         Use Python. - (admin) - (8)
                             What GUI toolkit? - (broomberg) - (7)
                                 wxThingy, I wot. -NT - (pwhysall) - (5)
                                     Re: wxThingy, I wot. - (pwhysall) - (4)
                                         Valid weekend project - (broomberg) - (3)
                                             Re: Valid weekend project - (admin) - (2)
                                                 My unscientific impression from the newsgroup - (FuManChu) - (1)
                                                     Self-selecting sample - (drewk)
                                 wxWindows/wxPython -NT - (admin)
             GAK!!! -NT - (jb4)

It ran CP/M, I believe.
211 ms