Hi coders,
This is a newbie question, finding its way to "The enlightenment of
Best-Practices and Re-use". Consider this case:
Custom Component A
------------------------------------------+
<mx:Script
<![CDATA[
//...<logic for comp A
private function getRecords():void{
var params:Object = new Object();
params.method = 'company.getRecords';
params.table = 'Employees';
srv.send(params);
}
]]>
</mx:Script>
<mx:HTTPService id="srv"
url="http://company.com/dbmanager/"/>
//components for comp A>...
-----------------------------------------+
|
|
|-*will it be ok to create a class that
just handle the service?
*does it really worth considering we
are using the code just 2 times?
*why?
|-*when should I re-use?
|
|
Custom Component B
------------------------------------------+
<mx:Script
<![CDATA[
//...<logic for comp B
private function getRecords():void{
var params:Object = new Object();
params.method = 'company.getRecords';
params.table = 'Employees';
srv.send(params);
}
]]>
</mx:Script>
<mx:HTTPService id="srv"
url="http://company.com/dbmanager/"/>
//components for comp B>...
-----------------------------------------+
that was all i hope you get the main idea. any tips, guidance, etc..
will be graceful.
thanks
yaison.