From: Brandon Weaver Date: 2012-12-29T02:10:47+09:00 Subject: Re: numeric? --089e011767dd8e5f2004d1ecbe5d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable It uses ssh and SNMP to retrieve data. They return different strings, all some variation of null, if the antenna is unreachable from the Au. I decided to opt out of a multi conditional approach to every possible variation of the word null. On Dec 28, 2012 8:13 AM, "Robert Klemme" wrote= : > On Fri, Dec 28, 2012 at 2:01 PM, Dami=E1n M. Gonz=E1lez > wrote: > >> The more I think about it the more I do believe it is responsibility > >> of the "driver" (i.e. the bit that fetches the data) to return _proper > >> data_. In this case it would mean: do not return numbers as strings. > >> If values are invalid return a special value for that; this value > >> could be nil or one or more symbols depending on how many states need > >> to be represented. > >> > >> The using code should expect data properly typed so it can do its > >> business. > > > > Yes that ensure a proper work, but he says that at any time can enter = a > > new antenna, and he wants to quickly put it working, > > And where is the problem with my approach? Does it prevent getting > new devices to work quickly? > > > so what we know is > > that all the null values are returned as strings. Perhaps just the null > > values are always returned as strings, the others values meaby are > > returned as Fixnums, so he wants to handle strings. > > I'd rather not speculate but hear Brandon's comment on this. Also, > even if what you say is true it still does not prevent the "driver" > layer to convert "null" strings into nil or something other meaningful > value. > > Cheers > > robert > > -- > remember.guy do |as, often| as.you_can - without end > http://blog.rubybestpractices.com/ > > --089e011767dd8e5f2004d1ecbe5d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

It uses ssh and SNMP to retrieve data. They return different strings, al= l some variation of null, if the antenna is unreachable from the Au. I deci= ded to opt out of a multi conditional approach to every possible variation = of the word null.

On Dec 28, 2012 8:13 AM, "Robert Klemme&quo= t; <shortcutter@googlemail= .com> wrote:
On Fri, Dec 28, 2012 at 2:01 PM, Dami=E1n M. Gonz=E1lez
<lists@ruby-forum.com> wr= ote:
>> The more I think about it the more I do believe it is responsibili= ty
>> of the "driver" (i.e. the bit that fetches the data) to = return _proper
>> data_. =A0In this case it would mean: do not return numbers as str= ings.
>> If values are invalid return a special value for that; this value<= br> >> could be nil or one or more symbols depending on how many states n= eed
>> to be represented.
>>
>> The using code should expect data properly typed so it can do its<= br> >> business.
>
> =A0Yes that ensure a proper work, but he says that at any time can ent= er a
> new antenna, and he wants to quickly put it working,

And where is the problem with my approach? =A0Does it prevent getting
new devices to work quickly?

> so what we know is
> that all the null values are returned as strings. Perhaps just the nul= l
> values are always returned as strings, the others values meaby are
> returned as Fixnums, so he wants to handle strings.

I'd rather not speculate but hear Brandon's comment on this. =A0Als= o,
even if what you say is true it still does not prevent the "driver&quo= t;
layer to convert "null" strings into nil or something other meani= ngful
value.

Cheers

robert

--
remember.guy do |as, often| as.you_can - without end
http://blo= g.rubybestpractices.com/

--089e011767dd8e5f2004d1ecbe5d--