K
konstantin.kivi
Hello All
We have a system where customer request (of text form) are processed.
The number of different request types is more than a thousand.
With current ( C-langauage ) design request a parsed, type of the
request is determined (and encoded as unsigned int)
and request data is packed in request specific structure.
Then processing function for this type of the request is looked up
in a table by binary search and this function is
called and request specific data is passed to it(as void*).
The system is now being rewritten in C++. Is it practical to
derive each request from a common base class and have virtual function
run()
instead of current 'processing' function?
Is virtual table lookup of such size as fast or faster then binary
search?
Is design with so many derived classes good in this situation?
Best regards, Konstantin Kivi
PS.
It comes to my mind, that Java programmers haven't first
option (as there is no pointer to function). So they
can use only second option.
We have a system where customer request (of text form) are processed.
The number of different request types is more than a thousand.
With current ( C-langauage ) design request a parsed, type of the
request is determined (and encoded as unsigned int)
and request data is packed in request specific structure.
Then processing function for this type of the request is looked up
in a table by binary search and this function is
called and request specific data is passed to it(as void*).
The system is now being rewritten in C++. Is it practical to
derive each request from a common base class and have virtual function
run()
instead of current 'processing' function?
Is virtual table lookup of such size as fast or faster then binary
search?
Is design with so many derived classes good in this situation?
Best regards, Konstantin Kivi
PS.
It comes to my mind, that Java programmers haven't first
option (as there is no pointer to function). So they
can use only second option.