Design Question--am I going too far with this?

Design Question--am I going too far with this?

Post by Kurt Webe » Thu, 25 Apr 2002 06:27:26



I'm writing a newsreader, and I had an idea for a highly modularized design
as follows:

A NNTP module that would communicate with the server...this would be
essential and the only standard module (although the distribution would
ship with every module, this would be the only one that cannot be taken out
and replaced)

A config file module, which could have several different interchangeable
versions so you could use whatever syntax and directives you liked in your
config files

A UI module, so you could have any sort of user interface design you liked

A scripting module, so you could implement whatever scripting language you
wanted (or create your own) for use within the newsreader

An article-storage module, so you could use whatever format you desired to
store your articles and newsgroup list

These would all communicate via FIFOs [1], and the idea is that you can
find modules of each type that worked in whatever way you wanted (or even
write your own) and drop them in interchangeably...each module would be
totally separate from the others, and would communicate via the FIFOs via a
standardized protocol.

My question is, am I taking this whole modularization thing too far?

--
Kurt Weber

ROW Software and Web Design
http://www.rowsw.com

 
 
 

Design Question--am I going too far with this?

Post by Alex Mitrofano » Thu, 25 Apr 2002 06:54:50



> I'm writing a newsreader, and I had an idea for a highly modularized design
> as follows:

> A NNTP module that would communicate with the server...this would be
> essential and the only standard module (although the distribution would
> ship with every module, this would be the only one that cannot be taken out
> and replaced)

[...]
> These would all communicate via FIFOs [1], and the idea is that you can
> find modules of each type that worked in whatever way you wanted (or even
> write your own) and drop them in interchangeably...each module would be
> totally separate from the others, and would communicate via the FIFOs via a
> standardized protocol.

> My question is, am I taking this whole modularization thing too far?

Why don't you want to use more traditional modularization approach using
dlopen() call? That would be easier, cleaner, and faster.

--
Alex Mitrofanov
Brainbench MVP for C++
http://www.brainbench.com

 
 
 

Design Question--am I going too far with this?

Post by Santhosh Kud » Thu, 25 Apr 2002 11:24:48




> > I'm writing a newsreader, and I had an idea for a highly modularized design
> > as follows:

> > A NNTP module that would communicate with the server...this would be
> > essential and the only standard module (although the distribution would
> > ship with every module, this would be the only one that cannot be taken out
> > and replaced)

>  [...]
> > These would all communicate via FIFOs [1], and the idea is that you can
> > find modules of each type that worked in whatever way you wanted (or even
> > write your own) and drop them in interchangeably...each module would be
> > totally separate from the others, and would communicate via the FIFOs via a
> > standardized protocol.

> > My question is, am I taking this whole modularization thing too far?

> Why don't you want to use more traditional modularization approach using
> dlopen() call? That would be easier, cleaner, and faster.

I would just add that, maybe you might want to abstract your
communication protocol into a seperate module. Today its FIFO`s
tomorrow it might be something else, so you might find it easier to
accomodate such changes.

Santhosh

 
 
 

Design Question--am I going too far with this?

Post by GoogleF » Thu, 25 Apr 2002 17:14:20



> I would just add that, maybe you might want to abstract your
> communication protocol into a seperate module. Today its FIFO`s
> tomorrow it might be something else, so you might find it easier to
> accomodate such changes.

> Santhosh

I would suggest that FIFOs are a bad idea. They have limited buffering
and if you suffer any bottlenecks anywhere then they are likely to be
a pain in the butt.

If you want speed, then multithreading and/or shared memory for
communication so you can create your own buffering layer.

Given you want to abstract things, then the poster above is right -
modularise your I/O mechanism so you can go for things like FIFO or
TCP or whatever.

Whether you use dlopen() or not is not really an issue as you get your
design off the ground.

 
 
 

Design Question--am I going too far with this?

Post by Kurt Webe » Fri, 26 Apr 2002 06:37:06





>> I would just add that, maybe you might want to abstract your
>> communication protocol into a seperate module. Today its FIFO`s
>> tomorrow it might be something else, so you might find it easier to
>> accomodate such changes.

>> Santhosh

> I would suggest that FIFOs are a bad idea. They have limited buffering
> and if you suffer any bottlenecks anywhere then they are likely to be
> a pain in the butt.

> If you want speed, then multithreading and/or shared memory for
> communication so you can create your own buffering layer.

> Given you want to abstract things, then the poster above is right -
> modularise your I/O mechanism so you can go for things like FIFO or
> TCP or whatever.

Well, the problem with TCP is since the configuration files are read in a
separate module, then the TCP port used for communication (at least until
the config file module is loaded and the config files are read) will have
to be hard-coded; thus, one may run into problems if that port is already
in use when the newsreader is started.

--
Kurt Weber

ROW Software and Web Design
http://www.rowsw.com

 
 
 

Design Question--am I going too far with this?

Post by Kurt Webe » Fri, 26 Apr 2002 07:30:44





> Given you want to abstract things, then the poster above is right -
> modularise your I/O mechanism so you can go for things like FIFO or
> TCP or whatever.

Another problem I see with that is how will the modules themselves know
whether to use TCP/IP, FIFOs, or whatever other form of IPC that one
chooses to use?

--
Kurt Weber

ROW Software and Web Design
http://www.rowsw.com

 
 
 

Design Question--am I going too far with this?

Post by Santhosh Kud » Fri, 26 Apr 2002 21:49:59






> > Given you want to abstract things, then the poster above is right -
> > modularise your I/O mechanism so you can go for things like FIFO or
> > TCP or whatever.

> Another problem I see with that is how will the modules themselves know
> whether to use TCP/IP, FIFOs, or whatever other form of IPC that one
> chooses to use?

The OP states that the configuration file reading functions are
modularized into a seperate module. But the OP has not mentioned
anything about the order of execution.

If config files arent read first then the problem becomes highly
challenging and difficult, given the trade off of complexity versus
flexibility in my opinion :-), perhaps reading config files first
might be a good idea.

Well it could do roughly something like this,

main()
{
read_news()

Quote:}

read_news()
{
  Commlink *comm ;

  if(!is_comm_created(comm))
  {
    comm = comm_create() ;
    comm = comm_get_parameters(config_file) ;
    comm = comm_get_data() ;
    comm = comm_close() ;
  }

Quote:}

The code isnt great, but its just to illustrate an idea.

Cheers
santhosh

 
 
 

Design Question--am I going too far with this?

Post by Santhosh Kud » Fri, 26 Apr 2002 22:03:22






> > Given you want to abstract things, then the poster above is right -
> > modularise your I/O mechanism so you can go for things like FIFO or
> > TCP or whatever.

> Another problem I see with that is how will the modules themselves know
> whether to use TCP/IP, FIFOs, or whatever other form of IPC that one
> chooses to use?

Oops, I am getting a little blind these days. I didnt realize that you
were the OP. So your question stands. My apologies.

But I still think you would have to read whatever config info you need
from a file. as the previous post suggests. But one further question
is why is there a precedence on the module loading. Generally,
configurations are read first AFAIK to acquire context and state of
the program.

Cheers,
Santhosh

 
 
 

Design Question--am I going too far with this?

Post by Kurt Webe » Sat, 27 Apr 2002 08:19:08








>> > Given you want to abstract things, then the poster above is right -
>> > modularise your I/O mechanism so you can go for things like FIFO or
>> > TCP or whatever.

>> Another problem I see with that is how will the modules themselves know
>> whether to use TCP/IP, FIFOs, or whatever other form of IPC that one
>> chooses to use?

> Oops, I am getting a little blind these days. I didnt realize that you
> were the OP. So your question stands. My apologies.

> But I still think you would have to read whatever config info you need
> from a file. as the previous post suggests. But one further question
> is why is there a precedence on the module loading. Generally,
> configurations are read first AFAIK to acquire context and state of
> the program.

Yes, and the order in which the modules are loaded is listed in my first
post.  Even if the config files are read absolutely first (before the NNTP
module is loaded), however, the problem remains--how are the modules
supposed to communicate with the config module to find out which method
they're supposed to use to communicate.

Well, now that I think of it, the config module could simply set an
environment variable to tell the other modules how to communicate with
it...and if it's TCP/IP, then also what port to use.

--
Kurt Weber

ROW Software and Web Design
http://www.rowsw.com

 
 
 

Design Question--am I going too far with this?

Post by Santhosh Kud » Sat, 27 Apr 2002 16:57:01









> >> > Given you want to abstract things, then the poster above is right -
> >> > modularise your I/O mechanism so you can go for things like FIFO or
> >> > TCP or whatever.

> >> Another problem I see with that is how will the modules themselves know
> >> whether to use TCP/IP, FIFOs, or whatever other form of IPC that one
> >> chooses to use?

> > Oops, I am getting a little blind these days. I didnt realize that you
> > were the OP. So your question stands. My apologies.

> > But I still think you would have to read whatever config info you need
> > from a file. as the previous post suggests. But one further question
> > is why is there a precedence on the module loading. Generally,
> > configurations are read first AFAIK to acquire context and state of
> > the program.

> Yes, and the order in which the modules are loaded is listed in my first
> post.  Even if the config files are read absolutely first (before the NNTP
> module is loaded), however, the problem remains--how are the modules
> supposed to communicate with the config module to find out which method
> they're supposed to use to communicate.

> Well, now that I think of it, the config module could simply set an
> environment variable to tell the other modules how to communicate with
> it...and if it's TCP/IP, then also what port to use.

Well I assume by modules you mean Services...? or am I missing
something here. Because if they are libraries, then its just a matter
of ensuring an interface. Then the only comm service you need is for
the nntp reader to communicate with the NNTP server.

If I assume that these are services, then, the problem boils down to
how will the config and the comm module communicate.

The comm module needs to get the config information. As far as the
other modules are concerned they are just users of a service. So their
interface to the service will not change. When the comm service inits
it will bring up whatever communication service it requires.

Well as you suggest, between the two, a Env Variable might be a good
idea. Or else, you can have a default comm interface to fall back on
and init the connection between the config and comm modules, before
switching to the comm service specified in the config file.

HTH
Cheers
Santhosh

 
 
 

1. Am I pusing Solaris too far? :-)

I seem to be taking a very long and convoluted route to reach a goal
which I'm sure must be easier by some other fashion. Any advice is
most welcome.

We need to compile our package for distribution under Solaris 2.4 so
that it runs under both 2.4 and 2.5 as 2.5 binaries aren't guaranteed
to run under 2.4. (Oddly enough I was told by someone at Sun that
dynamically linked 2.3 binaries should run under 2.4, 2.4 binaries
under 2.5, but not 2.3 under 2.5. Bizarre.)

We also wish to have 2.5 in use on this machine, and we need it for
testing anyway. So the natural solution is a dual booted system. No -
we don't want another physical machine. It's hot (no air conditioning)
and cramped enough in here as it is.

This works fine. However I then decided that it'd be nice to compile
2.4 binaries under 2.5. The reason being that this workstation is in
use and it's hassle for everyone to require it to be rebooted each
time we distribute programs. I could probably play with using -L and
-I, but I simply don't trust the compilers (Sun's f77 and GNU gcc) to
do this. So I come up with the following hack.

Start up a chrooted environment under /24 (my 2.4 root directory). Now
this hasn't got the necessary disks mounted, and the automounter
thinks that /net/arran/home5 (which is really /24/net/arran/home5) is
already mounted. So I do this manually with a second mount. That's the
first question - does NFS mounting the same disk twice to different
positions cause problems? It lets me do it and it _appears_ to work.

Then, because I need some stuff in /usr/local, I have to export (in non
chrooted environ.) /usr/local from this machine to itself, and then
NFS mount it in the chrooted environment. So - does this cause
problems? It sounds pretty iffy - NFS mounting localhost:/usr/local to
/usr/local. However, once more, it works.

Finally, because I keep running out of /tmp space, I realised that
when really booted under 2.4 /tmp is tmpfs mounted. So I then did a
final mount to mount /tmp as tmpfs. So how about that last one - can
we mount tmpfs in two different locations?

The code now compiles away fine. However df (2.5) now core dumps! So
am I really expecting just a tad too much, or should I be able to do
such ghastly things? :-)

Of course, if anyone can suggest a simpler solution then it would be
most greatfully recieved!

        James

--

Medical Research Council - Laboratory of Molecular Biology,
Hills Road, Cambridge, CB2 2QH, England.
Also see Staden Package WWW site at http://www.mrc-lmb.cam.ac.uk/pubseq/

2. Problem with PLIP (via laplink cable)

3. I am not impressed with Debian so far.

4. Driver for EXOS205T (i82586 chipset) sought

5. Probably stupid basic questions

6. Long ago, in a partition far, far away...

7. Help routing betweeen 100Mb & 10Mb nets

8. ISSG down far, far more than BCSG

9. webhosting.com - stay away... far far away

10. Newbie: "Linux has come so far only to seem so far away"

11. ldd: How far does it go?