CRITICAL
Rule Definition
Reports MXML components with more than 2 public variables
Remediation
Have only one entry point into MXML component.
Violation Code Sample
<mx:Script>
<![CDATA[
public var firstPublicVariable:int = 1;
private var _secondPublicVariable:int = 2;
public var thirdPublicVariable:int = 3;
public function get secondPublicVariable() : int {
return _secondPublicVariable;
}
public function set secondPublicVariable(anint: int) : int {
_secondPublicVariable = anint;
}
//...
]]>
</mx:Script>
Fixed Code Sample
<mx:Script>
<![CDATA[
private var firstPublicVariable:int = 1;
private var _secondPublicVariable:int = 2;
public var thirdPublicVariable:int = 3;
public function get secondPublicVariable() : int {
return _secondPublicVariable;
}
//...
]]>
</mx:Script>
Reference
http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD
Related Technologies
Technical Criterion
Secure Coding - Encapsulation
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.