BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

maintenance problem for customized application

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
Roland
Guest





PostPosted: Mon Apr 02, 2007 5:46 am    Post subject: maintenance problem for customized application Reply with quote



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





PostPosted: Mon Apr 02, 2007 4:04 pm    Post subject: Re: maintenance problem for customized application Reply with quote



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





PostPosted: Tue Apr 03, 2007 5:50 am    Post subject: Re: maintenance problem for customized application Reply with quote



Thanks Joanna, I will have a try.

Roland
Back to top
Bryan Crotaz
Guest





PostPosted: Sat Apr 07, 2007 9:00 pm    Post subject: Re: maintenance problem for customized application Reply with 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
Roland
Guest





PostPosted: Wed Apr 11, 2007 8:13 am    Post subject: Re: maintenance problem for customized application Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.