Hi, all.
I'm working on a spaghetti monster (unfortunately not of the flying variety), and I've got a question about proper design.
I'm in the process of taking a gigantic static Java method that returns an object and splitting it into reusable (and readable) components. Right now, the method reads an XML document, and then appends summary and detailed information from the document to a "dataModule", and the dataModule is then returned from the method.
In breaking my code up into a getSummaryData and getDetailedData method, I noticed I'd done the following:
dataModule = getSummaryData(xmlDocument);
setDetailedData(xmlDocument, dataModule);
(Pass by reference, append detailed data to dataModule within method)
This mostly has to do with the fact that the detailed data requires business logic based on the summary data in order to be parsed properly, and the fact that changing the structure of the dataModule involves lots of changing the front end of the application.
Is this approach any better than:
dataModule = getSummaryData(xmlDocument);
dataModule = setDetailedData(xmlDocument, dataModule);
(Pass by reference, append detailed data to dataModule within method, return dataModule)
I can't share much more of the code without revealing "teh secretz", but is there a strong reason to go with one approach over the other? Or, am I just getting caught up in which shade of lipstick I'm putting on my pig, here?
Thanks,
IVR Avenger