I believe that passing container objects like args to all your subroutines is eventually asking for trouble. By using such a container, functions are allowed to hide what fields of the container they are actually using. And those functions are not reusable, as I have to first create an args container with all the right fields.
If you search for args you will find it is used in open_remote_device(), pipe_device(), and read_tablet(). But actually
open_input_device() is using args.address, and optionally args.key and args.password.
pipe_device() is using args.orientation, args.monitor, args.threshold, args.mode, and args.debug
read_tablet() is using args.orientation, args.monitor, args.threshold, and args.mode
That fact is completely hidden in the generic function(args) interface.
I believe that passing container objects like
args
to all your subroutines is eventually asking for trouble. By using such a container, functions are allowed to hide what fields of the container they are actually using. And those functions are not reusable, as I have to first create anargs
container with all the right fields.If you search for
args
you will find it is used inopen_remote_device()
,pipe_device()
, andread_tablet()
. But actuallyopen_input_device()
is usingargs.address
, and optionallyargs.key
andargs.password
.pipe_device()
is usingargs.orientation
,args.monitor
,args.threshold
,args.mode
, andargs.debug
read_tablet()
is usingargs.orientation
,args.monitor
,args.threshold
, andargs.mode
That fact is completely hidden in the generic
function(args)
interface.Instead of a function
I would recommend unpacking the arguments in the call