Re: Oaf names & file structure



Miguel de Icaza <miguel helixcode com> writes:

> > Applications should NEVER EVER use IIDS directly. OAF is something which was
> > designed precisely so that you do not have to remember to keep them around.
> 
> Sometimes you want to use IIDS.  Because I have coded my application
> against a specific component, not something that can be plugged. 

I cannot really imagine scenarios to do this. My personal solutino to such a problem
would be to design an OAF query which I know to always the return what I need.

Could you give us a specific example ?

> 
> > 	  - difficult to type and remember.
> 
> The problem is that you still need to use the OAFID in a bunch of
> places: in the oafinfo file and in the source code in a number of
> spots (to register the factory, to check the instance being
> activated).

yes. It does not bother me. I usually can do one copy/paste when
I write a component: #define works pretty well and I do not have
to think about it anymore anytime after.

> 
> I could also claim that "oaf_query" has dissadvantages:
> 
> 	* I do not know how to use it.  I need to read another manual.

This argument has not much ground: if you write a program, you have
to learn the API of the libs you are using. Such is  life.

> 
> 	* I need to populate more data in the oaf-file when sometimes,
>           I am dealing with a component that is fully internal to me.

Once more, I cannot think of any real-life example which _needs_ this.
Theorically, if I yoiu have components, they should specicy their whole
features in their CORBA interfaces which means that you SHOULD be able to replace
them with a component iomplementing the same exact set of interfaces.

So, I must say I do not really see what you need the IID for in your code.

Please, an example :)

> 
> > 	  - if someone writes a component to replace your own component
> > 	  and want it to be used in the application the original one was used,
> > 	  the fact that the code uses the IID directly and not an OAF query
> > 	  means that the new component will not be picked up without source code
> > 	  hacking.
> 
> Lets assume you get two components back A and B from the query.  Now
> every time you try to activate a component you should offer the user
> an option to select.  That seems excesive and a waste of time.

Well, oaf_query has this nice parameter named selection_order....
It allows you to sort the returned query. You can arbitrarily take the first
component returned. ie: this is what nautilus does to pick up the default view 
for a given directory But the user can alter the order in which the view will 
be picked next time if he wants to. He is not asked to do it all the time.

> 
> Why would I need to handle that scenario if I want to activate a
> specific implementation?  

ie: above.

> 
> > I know that last time I checked Evolution was using IIDs directly and I cannot
> > do anything but repeat once more how broken this is: if I write my own
> > mail component, I am screwed: it will never be displayed unless I hack the code.
> 
> Microsoft COM supports two types of activation, CatID based activation
> (similar to the query system in OAF) and implementation-ID based.
> CatIDs are only used in a few instances --when it makes sense-- not
> everywhere as a rule.
> 
> > Using IIDs destroys the whole point of having components with well defined 
> > interfaces.
> 
> Not at all.  It does defeat replacing random components with other
> random components.

Those are not random components: they implement a set of CORBA interfaces and define
a set of specific OAF attributes. The OAF query langage is powerful enough so that
you can use it to do a lot of fancy stuff. And it has DOCUMENTATION !!! :)

> For instance, when you launch Internet Explorer, you are not asked 45
> imes whether you want to use the toolbar A or the toolbar B.  Or if
> you want to use IE's HTMl engine, or some other engine.  Some things
> are better kept hardcoded.

Well, you should be able to change the HTML engine used by IE if you want to
just by adding the proper config file with the proper data on the system.
As far as I can tell, you cannot right now because they precisely hardcode
the IID.

This should also be the case of Evolution: if I want Evolution to use
my own mail component, I should be able to change it by just adding a new 
config file without changing the code.


regards,
Mathieu


-- 
Mathieu Lacage <mathieu eazel com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]