presented by Chafic Kazoun
A bit of a history lesson, a few years ago the expectations were very different. The bar is being set higher for good UI and business rules. Because of this we as developers need to carefully consider the architecture of Flex applications.
What are application components? Higher level information. For example, a datagrid list of names (not editable). Decide what will be a component, then create the component, decide and implement the API. Don't overthink things - it doesn't have to be perfect. It's OK to go back and make changes during the dev cycle.
Layout the component as if it is a standalone application and save. Then import the file as a namespace [i.e. xmlns:pf2="com.subfolder.views.*] in your main application MXML file, and invoke the file. Congrats! You just wrote your first component.
Best practices... Remember that the component should be a "black box". That is, the application should never "reach inside" the component. This is especially important as you start to reuse components! Use the Inspectable meta tag to provide insight for enumerations. Use the Bindable meta tag to make the getter and setter accessible. Use dispatching and event listeners (add the event info to a meta data tag in the component).
Don't go too crazy and go to a lot of depth... try to keep things simple. For example... don't put styles into your component, do that at the application level.
What are custom components? You can create complex/advanced components, at a commercial level. Can be distributed or shared among other developers. Recommended to develop them in AS3, not Flex. An important difference is that for custom components you must author the validation steps. This step is not necessary for application components... and if your application component is that complicated you should consider writing it as a custom component!
Always check to see if there is already an instance of your component. This is especially important because someone could write a component to extend your component, and you wouldn't want them to fight one another.
From here we get into a lot of technical detail that I don't quite understand yet. ;) But I am pretty sure that as I use this stuff it will make sense. (At least, I hope so!) The lifecycle of a custom component is fairly complicated, and the steps of invalidation, commitment, measurement and validation have to be coded properly. In ActionScript. Again... I need to learn me some Flash goodness.