Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: OO design: returning string and/or special value

by pwagyi (Monk)
on Oct 10, 2019 at 08:12 UTC ( [id://11107285] : note . print w/replies, xml ) Need Help??


in reply to OO design: returning string and/or special value

If you have a method that returns SCALAR, in this case, I assume it should also be an object. Converting that object to string format should be responsibility of that object's class. not method() that returns that SCALAR responsibility.

  • Comment on Re: OO design: returning string and/or special value

Replies are listed 'Best First'.
Re^2: OO design: returning string and/or special value
by Anonymous Monk on Oct 10, 2019 at 08:28 UTC
    Scalars should be objects because?
      Since OP does not specify anything, I'm making assumption, anything non-simple SCALAR (number/string) should be already objectified if OP is using OOD approach.