-*will it be ok to create a class that
just handle the service?


Not just ok, but great!

*does it really worth considering we
are using the code just 2 times?
*why?


Just wait till you need to modify anything about that service, like the URL.
Who wants to track down multiple instances that could just live in one
place?

Ounce of prevention = Pound of cure!

-Scott

On 25 Mar 2007 16:07:21 -0700, Yaison Alcantara <[EMAIL PROTECTED]>
wrote:

  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.




--

: : ) Scott

Reply via email to