So, this was the original code:
public static void LoadPersistentData() { try { // load plug-in configurations Manager01.LoadPersistentData(); } catch( Exception ex ) { Utilities.Logger.Instance.LogError( ex ); } try { // load user preferences Manager02.LoadPersistentData(); } catch( Exception ex ) { Utilities.Logger.Instance.LogError( ex ); } // lots of try-catchs... try { // load model configurations Manager07.LoadPersistentData(); } catch( Exception ex ) { Utilities.Logger.Instance.LogError( ex ); } }
I've change the real name of the objects because of privacy, but they were all "managers". If we just apply some basic refactoring, just look what do we have in the end. Is it worth the "effort"?
public static void LoadPersistentData() { try { Manager01.LoadPersistentData(); Manager02.LoadPersistentData(); /// lots of calls... Manager07.LoadPersistentData(); } catch (Exception ex) { Utilities.Logger.Instance.LogError(ex); } }
I think it's not a big deal to perform such refactoring... And it also doesn't take any time to do it, whether you have the time or not.
No hay comentarios:
Publicar un comentario
Comments are subject to moderation, only in order to avoid insults and disguising things.
Los comentarios están sujetos a moderación, solo con el fin de evitar insultos y cosas por el estilo.