2

Situation:
I've some scripts that simulate user-activity on desktop. Therefore I've defined a few cases (workflows) and implemented them in Python. I've also written some classes for interacting with the users' software (e.g. web browser etc.).

Problem:
I'm a total beginner in software design / architecture (coding isn't a problem). How could I structure what I described above?

Providing a library which contains all the workflows as functions, or a separate class/module etc. for each workflow?

I want to keep the the workflows simple. The complexity should be hidden in the classes for interacting with the users' software.

Are there any papers / books I could read about this, or could you provide some tips?

1
  • 2
    It's difficult to say, but imagine you have to edit the code in half a year
    – superM
    Commented Aug 6, 2012 at 19:18

1 Answer 1

1

I tend to prefer to represent series of actions as series of statements, which would equate to actual code. That would mean a function with the steps to simulate the activity as method calls on the objects that represent the interface to be interacted with. This seems to be what you describe as having already.

However, if the actions are something that need to be editable by the user or some other part of the system, then you need to have a representation for the steps of the scripts. That sounds very familiar so I'm pretty sure there is a design pattern to do just that. I would suggest looking at the Command, Strategy and Template Method design patterns, as one or more of them might be what you are looking for. If you need a book, those I mentioned are described in the "Gang of Four" book, Design Patterns: Elements of Reusable Object-Oriented Software, which is the book that introduced the concept of design patterns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.