How to keep my functions (objects/methods) 'lean and mean'

Posted by Michel on Stack Overflow See other posts from Stack Overflow or by Michel
Published on 2010-06-09T11:52:46Z Indexed on 2010/06/09 12:02 UTC
Read the original article Hit count: 450

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET