c# - API Design Question -
While designing my API, I'm thinking how I would like to model the following behavior
options 1 seems more logical, but with the same invasions apply as if to check that the spreadsheet is actually related to the workbook.
Option 2 looks weird that a spreadsheet knows how to remove it, but in fact there is a reference to its parent workbook in the spreadsheet and can hand over the call directly to it.
Or is this not really a valid case because the workbook will need to validate this spreadsheet, no matter what? idea?
workbook wb = new workbook ("finance"); Spreadsheet SS = wb.CreateSpreadsheet ("Bob's"); // Option 1: wb.RemoveSheet (SS); // Option 2: ss.RemoveFromWorkbook (); Thank you everyone
I'll use wb.Sheets.Remove (SS) This sheet allows the separation of responsibilities in the form of an object, which is a collection of spreadsheets. It later also allows the concept that a sheet can be in many workbooks.
Comments
Post a Comment