I am implementing a report that will use different components ie some have header, footer table. Another has header, title, table, graph. I have implemented this using a similar pattern to the strategy pattern. I can generate an report using the same class report, and have an interface defined Component( onDraw ). Which each component implements Table, Graph etc...
But for memory consumption and good software design I dont want to have to create duplicate tables and headers if they are being used on each report with the same data. Is there a pattern that I can use to save the drawn table and header down from one report and re use for the other report? I have been looking at the fly weight pattern. Or using static variables on the class report. Issue with this is when I want to use different data on the report class.