2 Replies Latest reply on Mar 4, 2011 12:51 AM by pauland

    which kind of flex class is good?


      I run my flex project in sonar, and sonar says, I decleared too many fields, too many methods , too much public fields or functions.

      acturally, the rule shows the standerd number is very little.

      I just want to know, in the common way, how many fields, methods, functions are suitable?

        • 1. Re: which kind of flex class is good?
          pauland Level 4

          You need as many fields as are required to hold object state.

          You need as many methods as are required to implement object functionality.

          You need as many public fields and methods as are required to enable external objects to use the class.


          Anything more is pointless. Any less means some aspects of the class are inaccessible.


          Generally don't make things public unless there's a reason to do so.


          Is there anything more? There is no magic number to say X fields or methods per class is optimal.

          1 person found this helpful
          • 2. Re: which kind of flex class is good?
            will000 Level 1

            Yes, i agree with you.

            I can write the class to meet the requirement. but I am not sure whether the way is good or not.

            I want to get the way to improve the performance. So I try to talk this topic to find the rule to identfy.