hosain-fouad / dotify

Automatically exported from code.google.com/p/dotify
0 stars 3 forks source link

VolumeContentBuilder allows invalid sequences of operation #91

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The VolumeContentBuilder currently allows invalid sequences of operation, such 
as
newSequence(null);
newOnTocStart();

Doing so could throw an IllegalStateException, but it is really up to the 
implementation to do so. This causes unnecessary uncertainty which can be 
avoided by moving the state dependent methods to separate interfaces. E.g. 
newSequence(null) could return a FormatterCore for that sequence.

And newTocSequence(null) could return another interface containing the methods 
needed e.g. newOnTocStart() (which in turn could return FormatterCore);

Original issue reported on code.google.com by joel.hak...@mtm.se on 21 May 2014 at 7:07

GoogleCodeExporter commented 9 years ago
The interface was originally like described above. It is unclear why that 
changed, but should be clarified before reverting to the original design.

Original comment by joel.hak...@mtm.se on 28 Jul 2014 at 1:11

GoogleCodeExporter commented 9 years ago
The reason was probably that doing so allows the user of the API to "hold on" 
to objects after starting other sequences and adding more content to them 
later. Which is more problematic could be debated; requiring a complex sequence 
of calls OR losing control over the DOM build order.

Original comment by joel.hak...@mtm.se on 7 Aug 2014 at 7:46