Class Design Help
Posted on 2013-09-13
I come from a long history of using procedural oriented languages and over the past year have been trying to make the transition to a more object oriented approach. I understand most of the concepts and have made great progress but now and then I still run into issues and question myself on my class design. I am currently working on a project which generates a backlog of our financial data. One format in which this data needs to be available to the user in is an excel file.
So my class "Backlog" has a method called GenerateBackLogExcel that returns an excel workbook. My question is, should the GenerateBackLogExcel method actually create the excel workbook as well as populate the workbook before returning it to the user. I know the single responsibility principle has a fine line here because technically you could say that the responsibility is creating an excel formatted version of the backlog to the user, on the other hand the method is creating an excel workbook as well as populating it with data so its technically performing two tasks.
This may not be enough info without seeing the entire class for you to provide feedback, but I would appreciate any feedback on design. Like I said this seems to be my biggest hurdle to overcome on switching how I do things.