 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Roland Guest
|
Posted: Mon Apr 02, 2007 5:46 am Post subject: maintenance problem for customized application |
|
|
Hi:
We have an application used by many customers. Some customers want their own
special requirements which cause we modify the code and create special
versin for these customers. Now there are about 50 special versions already.
Usually we use directive to build up special version, like {$IFDEF
CUSTOMER_A}do customer procedure ($ENDIF}.
With so many special requirements, it causes our maintenance headech,
especially for some major procedure, like saverecord for example it contains
many directives.
procedure saverecord;
begin
{$ifdef customer_a}
do customer_a procedure;
{$else}
do general procedure;
{$endif}
{$ifdef customer_b}
do customer_b procedure
{$else}
{$ifndef customer_c}
do general procedure 2
{$endif}
{$endif}
end;
Imagine the saverecord procedure already have more then 10 directives and
could be more and more, so any small changes could cause bugs and sometime
we have to test for every directive.
Is there any way to use OOP idea to minimise these problem? Thanks.
Roland |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Mon Apr 02, 2007 4:04 pm Post subject: Re: maintenance problem for customized application |
|
|
Roland a écrit :
| Quote: | We have an application used by many customers. Some customers want their own
special requirements which cause we modify the code and create special
versin for these customers. Now there are about 50 special versions already.
Usually we use directive to build up special version, like {$IFDEF
CUSTOMER_A}do customer procedure ($ENDIF}.
With so many special requirements, it causes our maintenance headech,
especially for some major procedure, like saverecord for example it contains
many directives.
procedure saverecord;
begin
{$ifdef customer_a}
do customer_a procedure;
{$else}
do general procedure;
{$endif}
{$ifdef customer_b}
do customer_b procedure
{$else}
{$ifndef customer_c}
do general procedure 2
{$endif}
{$endif}
end;
Imagine the saverecord procedure already have more then 10 directives and
could be more and more, so any small changes could cause bugs and sometime
we have to test for every directive.
Is there any way to use OOP idea to minimise these problem? Thanks.
|
Absolutely! Design a factory class that loads a runtime package that can
be hold a class that holds the custom methods. Then all you have to do
is to add each customer's packages to a predetermined location.
To do this well, you need to have a well-defined class hierarchy from
which each customer's special classes can derive.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer |
|
| Back to top |
|
 |
Roland Guest
|
Posted: Tue Apr 03, 2007 5:50 am Post subject: Re: maintenance problem for customized application |
|
|
Thanks Joanna, I will have a try.
Roland |
|
| Back to top |
|
 |
Bryan Crotaz Guest
|
Posted: Sat Apr 07, 2007 9:00 pm Post subject: Re: maintenance problem for customized application |
|
|
Extending what joanna said, I'd use the strategy pattern. Have the ability
for objects to be registered for certain events (eg BeforeSave, AfterSave),
with an appropriate interface:
eg
DLL exported procedure:
procedure Register(AppServices: IAppServices);
begin
AppServices.Register('BeforeSave', TCustomerASaver as IBeforeSave);
AppServices.Register('AfterSave', TCustomerASaver as IAfterSave);
end; |
|
| Back to top |
|
 |
Roland Guest
|
Posted: Wed Apr 11, 2007 8:13 am Post subject: Re: maintenance problem for customized application |
|
|
Thanks Bryan, I will have a try.
Roland
"Bryan Crotaz" <bryan@inspiredsignage-not.at-all.com> wrote in message
news:4617c039$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Extending what joanna said, I'd use the strategy pattern. Have the
ability for objects to be registered for certain events (eg BeforeSave,
AfterSave), with an appropriate interface:
eg
DLL exported procedure:
procedure Register(AppServices: IAppServices);
begin
AppServices.Register('BeforeSave', TCustomerASaver as IBeforeSave);
AppServices.Register('AfterSave', TCustomerASaver as IAfterSave);
end;
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|