Hi All,
I wanted to ask,
If writing nested(deep) iteration loops (as shown in example) a bad practice (in OOPs)?
For example :
If i want to zip all files that in all Workspaces.
Given example classes are Workspace, Project , File
please ignore avoid syntax errors
for each Workspace workspace in WorkSpaces
{
Projects = workspace.Projects; //any collection of projects
{
for each Project project in Projects
{
Files = project.Files//any collection of Files
for each File file in Files
{
....so on so forth
//SOMEWHERE Down the line
do_something(f); //ideally add file to zip
}
}
}
}
//Note : nesting could go more deeper.
//Not the best example but hope it explains my intent.
*One more way is adding a zip function to each class Workspace,Project,File
and call that,but still the iteration would be needed?
Whats the best way to achieve the same in an more Object oriented manner?
Thanks All