switch
John Bokma
john at castleamber.com
Thu Dec 10 22:22:41 EST 2009
Tim Chase <python.list at tim.thechases.com> writes:
Please don't delete attribution line(s), added:
Asun Friere writes:
>>
>> phone.update_from_record(record)
>>
>> This switch statement belongs to one guy. One guy who wants to know
>> how to do everything that needs to be done to Phones no matter who
>> asks
>
> This is where you make a false assumption -- the contents and parsing
> of the "switch" are provider-specific in this case, mapping to a
> common ontology of the Phone object:
In that case, why not give the classes Asun suggested all the same base
class: Phone?
>> I wonder if you agree that it's bit cleaner now? It's an effective
>> solution. I'm making no representation that it's the best.
>
> It's clean if it were the solution to my problem -- however, the mess
> comes from the profusion of provider formats.
Yup, and there is no other solution to that than to convert them to
something universal.
> Yes, having been programming since I was in middle-school (quick
> calculation yields a "boy I'm old" estimate of about 20 years...does
> anybody miss 360k 5.25" floppy disks? :)
I do miss cassette tapes and the wheeeeeee kkkrggrggrgrgrg of a program
loading.
--
John Bokma
Read my blog: http://johnbokma.com/
Hire me (Perl/Python): http://castleamber.com/
More information about the Python-list
mailing list