in reply to Re: Parsing the command line: manual or module?
in thread Parsing the command line: manual or module?

I want to say there's a refactoring (from the book of the same name) that is recommended for when a routine starts getting too many parameters. I want to say something along the lines of encapsulating some (or all) of the arguments into an object, and/or possibly moving the behavior onto that object so the current implementer becomes a client using an instance of the new class.

(Unfortunately I don't have my copy at hand, but someone may chime in that actually remembers it or does have a copy nearby . . .)

Update: Found it: Introduce Parameter Object, p295. The (simple) example given is a series of calls which all take a start and end Date; the refactoring is to create a DateRange class which encapsulates both.

  • Comment on Re^2: Parsing the command line: manual or module?