SimpleBrowserDotNet/SimpleBrowser

History Duplication

Opened this issue · 2 comments

Is looks like there is some duplication of effort for logging requests and keeping a history of the navigation state. The Browser class has the following collections:

private List<LogItem> _logs = new List<LogItem>();
private List<NavigationState> _history = new List<NavigationState>();

The HttpRequestLog (subclassed from LogItem) and NavigationState objects are similar, but not the same. This begs the question, why are there two of these collections for keeping history? Even if the two collections are really needed, why can't they be collections of the same object rather than having three classes for logging history records?

Refactoring is needed, but I suspect this will be a change that breaks backwards compatibility.

Teun commented

I think the history collection is specifically to support back and forward
navigation. The logs collection is supposed to be used for diagnostics. I
guess they could be combined, but I'm not sure if they should.

If you want to improve the design, I think the logs stuff could use some
love.
Op 29 okt. 2015 12:02 schreef "Kevin Yochum" notifications@github.com:

Is looks like there is some duplication of effort for logging requests and
keeping a history of the navigation state. The Browser class has the
following collections:

private List _logs = new List();
private List _history = new List();

The HttpRequestLog (subclassed from LogItem) and NavigationState objects
are similar, but not the same. This begs the question, why are there two of
these collections for keeping history? Even if the two collections are
really needed, why can't they be collections of the same object rather than
having three classes for logging history records?

Refactoring is needed, but I suspect this will be a change that breaks
backwards compatibility.


Reply to this email directly or view it on GitHub
#151.

I'll look at it. I've been toying with implementing Issue #37. Before I can do that, some clean up is needed, I think. This will likely be the first step on that path.

I completely agree that navigation history is different from log history. I think, however, that the objects can be stored in the same collection to avoid duplication. I would raw encapsulate the collection to provide outside access then provide methods to get the events from the single collection.