in reply to How would you simplify this code?

If this were my code, I'd make both attributes required so that it's impossible (or at least unlikely, if you follow the API documentation) to create a Remote object without a valid resource and username.

Replies are listed 'Best First'.
Re^2: How would you simplify this code?
by elTriberium (Friar) on Apr 07, 2011 at 05:46 UTC
    That's a good comment, however what if these 2 (or other) attributes are only required in this subroutine and not in all subroutines of the class?

      Some classes work out that way. It's not necessarily a design smell.