How to keep my functions (objects/methods) 'lean and mean'
- by Michel
Hi,
in all (Agile) articles i read about this: keep your code and functions small and easy to test.
How should i do this with the 'controller' or 'coordinator' class?
In my situation, i have to import data. In the end i have one object who coordinates this, and i was wondering if there is a way of keeping the coordinator lean(er) and mean(er).
My coordinator now does the followling (pseudocode)
//Write to the log that the import has started
Log.StartImport()
//Get the data in Excel sheet format
result = new Downloader().GetExcelFile()
//Log this step
Log.LogStep(result )
//convert the data to intern objects
result = new Converter().Convertdata(result);
//Log this step
Log.LogStep(result )
//write the data
result = Repository.SaveData(result);
//Log this step
Log.LogStep(result )
Imho, this is one of those 'know all' classes or at least one being 'not lean and mean'?
Or, am i taking this lean and mean thing to far and is it impossible to program an import without some kind of 'fat' importer/coordinator?
Michel