4 Replies Latest reply on Feb 27, 2012 5:51 AM by new2oop

    refactoring - is creating a class just to initialize a class a good idea

    new2oop

      This is probably more of an oop or architecture question than specifically Flex but...

       

      I'm refactoring a largish application. The initialising class is many hundreds of lines of actionscript code so I'm trying to reduce it to reduce the complexity.

      Much of the code is a sequence of creating a class, adding to the display, doing something, closing the class down and removing it from the the display.

       

      The initialisation of the application is a linear process (login, load data, init menu, init screen elements etc.) so at the moment it is all in one long class but there are 20 steps and each step is about 40 lines of actionscript code by the time the listener code is included.

       

      Because there are so many lines of code just to create a class, initialise data, add listeners, add to screen, remove listeners, remove from display list,

      is it good practice to create a class who's sole purpose is to initialise another class. It would dramatically reduce the lines and complexity of code in my main class.