I need your input guys on this concept I intend to implement:

Use the Command Pattern to record everything in my app. It should encapsulate every single user action and micro-action as a Command and write it to a log file, for example the format of the log file can be something like this:

time=20:56:33 action=USER_SELECTED_ROWS_IN_DATAGRID control=dgEmployees RowId=2,5,8,9 time=20:56:51 action=USER_ERASED_SELECTED_ROWS_IN_DATAGRID control=dgEmployees



Then later the log file will have multiple uses:

  1. It can serve as a backup: The app can be launched in simulation mode, it can start with an empty database and by executing all commands from the log file the app can restore its database and settings to their latest state.

  2. I can analyse a client's log file to learn how they use my app.

  3. I can analyse a client's log file to locate a bug that he has run into.

  4. I can write various testing configurations with different such log files.

So my question to you guys is: Has anyone else thought of this strategy before? If this concept has a proper technical name or you know of any tutorials exploring it in more detail, I'd like to know more about it.

  • I think you're talking about Aspect Based Programming google.com/…
    – DanielS
    May 28, 2015 at 23:25
  • No it's not AOP (I know well about it and have used AspectJ before). Capturing method calls in my app and extracting info from them would be too cumbersome, so I'd rather pollute my code with creation of command objects everywhere the user has clicked, than to use AOP. May 29, 2015 at 2:44

1 Answer 1


The command pattern is often used to create undo functionality. I think that's close to what you want to do.

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.