--- In flexcoders@yahoogroups.com, "lostinrecursion" <[EMAIL PROTECTED]> wrote: > > Evening folks, > > I finished reading a chapter in the new book, RIAs with Flex and Java. > Specifically, I was reading Chapter 11: Advanced Datagrid which > introduces the concept of a destination aware component which contains > calls to a remote object embedded in the extended component's MXML code. > > Although the destination and method are passed to the component in > compile time attributes, this smells of not only tight coupling of > components - but totally ignoring good OOP practice and mixing the > business and presentation tiers. Add to that the fact that now the > dataProvider can only have the one view, the actual grid to which it > is set. > > Can someone point out what I am missing here or make any points why my > thoughts are incorrect? > > So far, it's a great book but that chapter really threw me off. > > -Kenny/LIR >
I'm not sure that's that's ignoring good OOP practice but it certainly does mix the business and presentation tiers. I have been doing this since Flex 1.5 for the ComboBox, List, DataGrid and Tree components. I first extended each these to create generic components that implement Flash Remoting, some standard contextmenus, drag and drop, security/privilege checking and dispatch events when remoting calls return. Then I extend these and point the RemoteObject source to the specific CFC that retrieves the data from the database. For instance I have a RemotingComboBase class that extends the ComboBox class and I have an EmployeeComboBox class that extends the RemotingComboBase. I have several applications that need to use an EmployeeComboBox, so when I need one I just have to drag it onto the form and go on to the next component. I also have an EmployeeList class when I want to display a list of employees. Both of these components have their RemoteObject source pointed at the same CFC. Obviously if I'm using both of these components on the same form I am retrieving and storing this information twice but it's worth it to me for the ease and speed of development that I've gained. Also I don't normally have the need to display the same data in different views within the same application. I don't view this as much different than the Flex example of a StateComboBox that always displays a list of hardcoded US states. Maury