cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vadim.gritse...@verizon.net>
Subject RE: [Design] ContainerManager is under fire--let's find the best resolution
Date Fri, 07 Jun 2002 00:09:06 GMT
> From: Berin Loritsch [mailto:bloritsch@apache.org]
> 
> > From: Leo Sutic [mailto:leo.sutic@inspireinfrastructure.com]
> >
> > > From: Berin Loritsch [mailto:bloritsch@apache.org]
> > >
> > > Hmm.  What we have here is a bad design.  Should the
> > > container make up for your poor design?  Can you really get
> > > away with only three instances in a pool with a web
> > > environment?  Honestly, there is nothing in Cocoon that does
> > > what you are talking about.
> >
> > Yes, it is bad design. It is more than that - it is horrible design.
> >
> > But admit one thing: It was not difficult to see that it was
> > utterly atrocious!
> >
> > I meant to use it to show a situation that may occur in a
> > system. It will not be as clearly awful as the abomination I
> > showed you, but *hidden* in the code. I can show you more
> > poor architecture:
> >
> >   public void tailRecursive (int i) {
> >     if (i < 100) {
> >       mycomp = lookup (...);
> >       tailRecursive (i + 1);
> >     }
> >   }
> 
> In order for a component based system to gain all benefits of being
> component based, we have to consider the "story" of the system.  After
> all, that is where we develop our roles.  From the story that we are
> trying to tell.
> 
> The point is that you should know ahead of time, what the correct
> story is.  You should know how, in a certain context the components
> relate to each other.  That is what design is all about.  As much as
> possible, you should strive to make your components as threadsafe
> as possible.  That way you just don't have to worry about certain
> things.
> 
> Systemic problems such as your recursive and iterative lookups should
> not be allowed by design. 

What's wrong with this:

public void do () {
  for (int I = 0; i < 8000; i++) {
    mycomp = lookup (...);
    info = mycomp.getIt(i);
    release(mycomp);

    info = calculate(info);
    print(info);
  }
}

Assumptions: mycomp.getIt() might use JDBC connection which are limited
in count, and calculate() takes some time, so it is really not wise to
block connection for time of the whole loop.


Vadim 

</snip>



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message