Good solutions for passing around large numbers of arguments in alayered architecture?

N

Nathan Rice

I've been running into a problem lately where I have an architecture like so:

Main class -> facade/configuration class -> low level logic class.

The main class is what the user interacts with.

The facade/config class is responsible for loading and managing the
lower level classes and providing a consistent interface to the main
class. It can be hot swapped in/out to drastically change the
functionality of the main class.

The low level logic classes are responsible for dealing with domain primitives.


The issue I'm having is that I want advanced users to be able to pass
extra configuration information to the facade and low level classes if
need be, without the signature drastically changing with different
facade classes. Currently, I explicitly state parameters as much as
possible at each level. To deal with low level logic classes that
have a large number of possible options I allow the caller to pass a
dictionary of options for that class. This leaves me with signatures
that are upwards of 15 arguments long in some cases, the majority of
them repeated in classes called from the main class.

I've tried using args/kwargs, however I found it difficult to avoid
having arguments in my signature re-ordered, and it is also a source
of bugs.

Has anyone come up with a good solution for dealing with arguments in
situations like this where you'd like to encapsulate lower level stuff
for neophyte users but make it easily available to advanced users?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top