Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > design issue

Reply
Thread Tools

design issue

 
 
softwareEngineer
Guest
Posts: n/a
 
      05-17-2012
On Wednesday, 16 May 2012 17:09:47 UTC+2, nick_keigh...@hotmail.com wrote:
> On Tuesday, May 15, 2012 3:47:22 PM UTC+1, softwareEngineer wrote:
>
> I thought I'd posted this already...
>
> <snip>
>
> > I have two component, one (letīs call it A) manage the request (command) from external systems and another (letīs call it B) manage its own command.

>
> lets not! Why A and B? Can't we have someting that conveys a little meanining? How about ExternalCommandProcessor and InternalCommandProcessor?
>
> > Once A receive one command calls one method of class B.
> > Now Iīd like to expose only one method from B (ProcessCommand) which accept a abstract class (ICommand). So B have to expose one method ProcessCommand,

>
> yes
>
> > ICommand and all ConcreteCommand (derived by ICommand) that it manage.

>
> why? Isn't this all B's business? Why can't you do this in the header file:-
>
> class ICommand; // declaration only
>
> class InternalCommandProcessor
> {
> public:
> ProcessCommand (ICommand*);
>
> };
>
> > What do you think ? there is a better way to do it ?

>
> read the Proxy design pattern

Thanks for your answer.

First more detail on what I had before refactoring :
simplifying I had an exe and 6 dll. The exe used the dll services (methods exposed). The exe is more on low level communications mechanism. So it parse the request (from the network) and send a specific request to a dll that will perform the request. the easiest way would have be to pass the (low level) request from exe with just one method in the dll and a little parser in it. But I'd like to abstract (in the dll) of low level mechanism tipical of the engine (exe) so I thought to encapsulate the low level request in a command and pass it to the dll method.

Now
The InternalCommandProcessor is exactly what I've done. But I've even exposed the concrete command which the dll can perform.
something like :

class QoSCommand : public ICommand
{

}
 
Reply With Quote
 
 
 
 
softwareEngineer
Guest
Posts: n/a
 
      05-17-2012
On Wednesday, 16 May 2012 17:09:47 UTC+2, nick_keigh...@hotmail.com wrote:
> On Tuesday, May 15, 2012 3:47:22 PM UTC+1, softwareEngineer wrote:
>
> I thought I'd posted this already...
>
> <snip>
>
> > I have two component, one (letīs call it A) manage the request (command) from external systems and another (letīs call it B) manage its own command.

>
> lets not! Why A and B? Can't we have someting that conveys a little meanining? How about ExternalCommandProcessor and InternalCommandProcessor?
>
> > Once A receive one command calls one method of class B.
> > Now Iīd like to expose only one method from B (ProcessCommand) which accept a abstract class (ICommand). So B have to expose one method ProcessCommand,

>
> yes
>
> > ICommand and all ConcreteCommand (derived by ICommand) that it manage.

>
> why? Isn't this all B's business? Why can't you do this in the header file:-
>
> class ICommand; // declaration only
>
> class InternalCommandProcessor
> {
> public:
> ProcessCommand (ICommand*);
>
> };
>
> > What do you think ? there is a better way to do it ?

>
> read the Proxy design pattern


Thanks for your answer.

First more detail on what I had before refactoring :
simplifying, I have an exe and 6 dll. The exe uses the dll services (methods
exposed). The exe is more on low level communications mechanism. So it parse
the request (from the network) and send a specific request to a dll that
will perform the request. the easiest way would have be to pass the
(low level) request from exe with just one method in the dll and a little
parser in it. But I'd like to abstract (in the dll) to low level mechanism
tipical of the engine (exe) so I thought to encapsulate the low level request
in a command and pass it to the dll method (processCommand).

Now
The InternalCommandProcessor is exactly what I've done. But I've even exposed
the concrete commands which the dll can perform.
something like :

class ICommand
{
public :
virtual bool execute () = 0;
}

class QoSCommand : public ICommand
{
private:
// some member needed for QoS check !
public :
void setDelay ();
void setWindowQoS ();

virtual bool execute ();
}

bool QoSCommand::execute()
{
// perform the method which was previously
// exposed by dll.
return doCheckQoS ();
}

then the processCommand method exposed by the dll :
bool processCommand (ICommand &command)
{
// some other operation ...

return command.execute();
}

My doubt is on exposing the concrete command. what other althernative
have I ?
 
Reply With Quote
 
 
 
 
softwareEngineer
Guest
Posts: n/a
 
      05-17-2012
On Thursday, 17 May 2012 08:49:53 UTC+2, Jorgen Grahn wrote:
> On Wed, 2012-05-16, wrote:
> > On Tuesday, May 15, 2012 3:47:22 PM UTC+1, softwareEngineer wrote:
> >
> > I thought I'd posted this already...
> >
> > <snip>
> >
> >> I have two component, one (letīs call it A) manage the request (command)
> >> from external systems and another (letīs call it B) manage its own command.

> >
> > lets not! Why A and B? Can't we have someting that conveys a little
> > meanining? How about ExternalCommandProcessor and
> > InternalCommandProcessor?

>
> Almost as bad. There's information we don't have access to -- A and B
> already exist, and have some meaning and responsibilities, but we
> haven't been told what they are. We can't make up useful names.
>
> Perhaps A deals with protocol-specific stuff like sequence numbering,
> demultiplexing, flow control and so on -- but that's just a guess.
>
> [...]
>
> >> What do you think ? there is a better way to do it ?

> >
> > read the Proxy design pattern

>
> Yes; he seems to be influenced by the design pattern line of thinking;
> then going to the source is a good idea. (Personally I don't like
> them very much though.)
>
> /Jorgen
>
> --
> // Jorgen Grahn <grahn@ Oo o. . .
> \X/ snipabacken.se> O o .


Personally I think to design pattern as an elegant solution
which (sometime) I can apply to my problem and not like
something cool to absolutely apply.

bye
robbie.
 
Reply With Quote
 
nick_keighley_nospam@hotmail.com
Guest
Posts: n/a
 
      05-18-2012
On Thursday, May 17, 2012 7:49:53 AM UTC+1, Jorgen Grahn wrote:
> On Wed, 2012-05-16, wrote:
> > On Tuesday, May 15, 2012 3:47:22 PM UTC+1, softwareEngineer wrote:


> >> I have two component, one (letīs call it A) manage the request (command)
> >> from external systems and another (letīs call it B) manage its own command.

> >
> > lets not! Why A and B? Can't we have someting that conveys a little
> > meanining? How about ExternalCommandProcessor and
> > InternalCommandProcessor?

>
> Almost as bad. There's information we don't have access to -- A and B
> already exist, and have some meaning and responsibilities, but we
> haven't been told what they are. We can't make up useful names.


well I think A and B are poor names. I really hope the actual code doesn't use them. How do you /know/ A and B have meaning and responsibilities assigned to them?

Besides we do know that A "manages requests/commands from external systems".. So ProcessExternalCommand:: seems pretty reasonable.

> Perhaps A deals with protocol-specific stuff like sequence numbering,
> demultiplexing, flow control and so on -- but that's just a guess.


maybe. So what?

> >> What do you think ? there is a better way to do it ?

> >
> > read the Proxy design pattern

>
> Yes; he seems to be influenced by the design pattern line of thinking;
> then going to the source is a good idea. (Personally I don't like
> them very much though.)


why not? Just curious. Too restrictive? Broken?
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      05-18-2012
On Fri, 2012-05-18, wrote:
> On Thursday, May 17, 2012 7:49:53 AM UTC+1, Jorgen Grahn wrote:
>> On Wed, 2012-05-16, wrote:
>> > On Tuesday, May 15, 2012 3:47:22 PM UTC+1, softwareEngineer wrote:

>
>> >> I have two component, one (letīs call it A) manage the request (command)
>> >> from external systems and another (letīs call it B) manage its own command.
>> >
>> > lets not! Why A and B? Can't we have someting that conveys a little
>> > meanining? How about ExternalCommandProcessor and
>> > InternalCommandProcessor?

>>
>> Almost as bad. There's information we don't have access to -- A and B
>> already exist, and have some meaning and responsibilities, but we
>> haven't been told what they are. We can't make up useful names.

>
> well I think A and B are poor names. I really
> hope the actual code doesn't use them.
> How do you /know/ A and B have
> meaning and responsibilities assigned to them?


I don't understand what you're getting at. It's obvious from his
posting that A and B only exist as placeholder names in the posting
itself. And it's obvious from *our* postings that we don't like that.
What's there to argue about?

....
>> > read the Proxy design pattern

>>
>> Yes; he seems to be influenced by the design pattern line of thinking;
>> then going to the source is a good idea. (Personally I don't like
>> them very much though.)

>
> why not? Just curious. Too restrictive? Broken?


I don't want to be involved in a heated discussion about that, too.
I just mentioned it so it wouldn't seem like I was advocating design
patterns.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFP - Journal of Systems Architecture, Embedded Software Design(Elsevier), Special Issue on Hardware/Software Co-Design Juan A. Gomez-Pulido VHDL 0 08-24-2009 02:11 PM
2nd. CFP - Journal of Systems Architecture - Embedded Software Design(Elsevier) - Special Issue on HARDWARE/SOFTWARE CO-DESIGN Juan A. Gomez-Pulido VHDL 0 05-24-2009 03:14 PM
Class design/design pattern resources TomTom MCSD 2 10-09-2004 07:38 AM
Xilinx Schematic design vs VHDL code design ZackS VHDL 5 07-09-2004 07:51 AM
Looking for help/resources on Writing a nice detailed design / tech design for vb.net code SpamProof Java 3 12-01-2003 06:06 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57