Skip navigation
Currently Being Moderated

Clarification for "MoreThanOneEntryPointInMxml" needed

Oct 20, 2009 6:42 AM

Hello,

 

What is the reasoning behind the "MoreThanOneEntryPointInMxml" violation?

Its description says:

"There are more than 1 public variable in this MXML component"

 

Why .as files are ok to have more than one public variable but .mxml files are not?

Why does the Flex FW itself provide a lot of UI components which have multiple public vars but FlexPMD considers such components as not well designed ones?

 

Thanks,

Smirnoff

 
Replies
  • Currently Being Moderated
    Apr 15, 2011 12:56 AM   in reply to smirnoff81

    I am wondering about precisely this same thing, and I am surprised that there still is no answer after all this time. Someone took the time to devise and implement this rule. Surely he/she must have had a good reason for it?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 28, 2011 9:17 AM   in reply to Jandr123

    Sorry for the sooo late answer to that...

     

    the idea behind this rule is to promote the usage of Presentation Models. A view should only have as an entry point a PM, everything else required by the view should be injected through the PM and consumed by the view then by bindings.

     

    A common problem we've identified with multiple entry points in views is that:

    1. The order in which the parameters are set can change the behaviour if the validation/invalidation pattern has not been properly implemented

    2. Injecting the dependencies through a PM can somehow give developers on Binding execution. i.e. having multiple entry points could potentially trigger bindings several times. If everything is in a PM then Bindings will trigger only when the PM is injected.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 28, 2011 1:48 PM   in reply to Xavi Beumala

    sorry that I don't understand, but this reply seems to miss the point made in the original question. Why is it OK for the flex components to have an almost limitless number of variables, like for instance:

    <mx: Button id="button1" label="button one" left="30" verticalCenter="0" click="somefunction()"/>

    but if we try to build one ourselves, more than one variable violates some guideline? It looks like ALL flex components need intensive refactoring which seems unlikely, so I have probably missed some essential bit of information/education. Please clarify a bit further?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 28, 2011 10:06 PM   in reply to Jandr123

    Hello,

     

    I agree with Xavi's previous reply, you also raised a good question: Why does not it apply to the SDK?

    You don't build an application like you build a SDK.

    You do have some business logic in you application, whereas the SDK team does not have any business logic to deal with.

    The rule is more a guideline, that you can bend if you need to.

    If you append to build a SDK for other developpers on top of the SDK, then I would disable that rule.

     

    But again, all the points mentioned by Xavi are absolutly right.

     

    Best

     

    Xavier

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points