PHP to a COM object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    #16
    Re: PHP to a COM object


    "Alex" <d_keyoke@hotma il.comwrote in message
    news:473bf7eb$0 $26761$426a74cc @news.free.fr.. .
    "Steve" <no.one@example .comwrote in message
    news:mKH_i.34$d m.33@newsfe02.l ga...
    >a difference, yes. something that will make your code quit bombing and
    >still get the Factory functionality.. .probably not. all an interface
    >(IFactory in this case) is, is a contract...a definition of what *all
    >usable* objects that *implement* that interface will provide a caller,
    >i.e. your php code. make sense? IFactory will provide you no other
    >functionalit y than that. here's an example in vb.
    >
    OK it's like a class from which another inherits, then ?
    kind of. the difference being that there is no functionality given to a
    class that implements an interface (ifactory). if i inherit from a class in
    the traditional sense, whatever functionality is present in the parent class
    will be part of the inheriting class...the inheriting class can add more
    interfaces (functions, properties, etc.) or rewrite/override/shadow the
    parent class' interfaces (functions, properties, etc.)

    other than that, yes, they're pretty similar.
    (snip the example)
    >
    >anyway...i think i got off track, but does that help you know that you're
    >going to have to get at an actual Factory object in the list...which
    >doesn't solve your memory problem?
    >
    Yes, that's very helpful. But it raises a question in PHP. Can I assume
    that COM tells PHP what type the objects in a class (or Interface) are ? I
    don't have to explicitely instanciate or cast the objects that are childs
    of a COM object ?
    can you assume? no, not really. while COM defines everything about itself
    and makes that information know to any callers, php doesn't need to know any
    of it. php basically 'invokes' on a com object whatever you tell it to
    attempt. it doesn't need to know about sawMill.foo, it simply attempts to
    invoke 'foo' on the sawMill object. php only needs to handle errors thrown
    from the invocation or supply the results thereof back to the caller.
    Now, I tried different values for memory_limit in php.ini and it doesnt
    change anything. I had a closer look at the memory usage, and Apache also
    takes almost 50M on a working page. So I'm not really sure it's a memory
    problem.
    hmmm. glad i see in another post that you've got it figured out. i'd have
    focused on memory a while longer...and have gotten no where.
    Actually, the COM syntax is not really complicated. So I'm beginning to
    think of a bug (in the object or PHP).
    really? there are only a few ways to call things. what's puzzling you?
    I'm considering trying a newer version of PHP. But I fear the impacts.
    >
    Thank you very much again, things are getting clearer :)

    cheers


    Comment

    • Steve

      #17
      Re: PHP to a COM object


      "Csaba Gabor" <danswer@gmail. comwrote in message
      news:892b2933-e964-4f5a-bbb5-f8d822f8f48b@l1 g2000hsa.google groups.com...
      Steve, thanks for your awesome exposition on VB interfaces, replete
      with example. This type of post is all too rare on the web.
      >
      Csaba
      wow! thanks. i'm glad it helped.

      cheers.
      On Nov 14, 8:10 pm, "Steve" <no....@example .comwrote:
      >"Alex" <d_key...@hotma il.comwrote in message
      ...
      >a difference, yes. something that will make your code quit bombing and
      >still
      >get the Factory functionality.. .probably not. all an interface (IFactory
      >in
      >this case) is, is a contract...a definition of what *all usable* objects
      >that *implement* that interface will provide a caller, i.e. your php
      >code.
      >make sense? IFactory will provide you no other functionality than that.
      >here's an example in vb.
      >>
      >public interface iFactory
      > public property foo as integer
      >end interface
      >>
      >public class sawMill
      > implements iFactory
      > public property get foo() implements iFactory.foo
      > get
      > return 666
      > end get
      > set (byval value as integer)
      > # do nothing...howev er, set is *required*
      > # because iFactory is read/write
      > end property
      > public function saw()
      > debug.print "sawing..."
      > end function
      >end class
      >>
      >public class brewery
      > implements iFactory
      > private myFoo as integer
      > public property get foo() implements iFactory.foo
      > get
      > return myFoo
      > end get
      > set (byval value as integer)
      > myFoo = value
      > end property
      > public function brew()
      > debug.print "brewing " & myFoo
      > end function
      >end class
      >>
      >in the above, both completely unrelated classes (sawMill and brewery)
      >have
      >iFactory.foo as part of their definition. how they implement them is
      >different, but each must have a read and write foo.
      >>
      >if i simply say:
      >>
      >private myFactory as iFactory
      >>
      >and then try:
      >>
      >myFactory.foo( )
      >>
      >it will do nothing. myFactory is an interface that has no working parts.
      >however, if i do:
      >>
      >private myFactory as iFactory = new brewery
      >myFactory.fo o = 15
      >>
      >i'll get somewhere. notice that the above works whether or not i set
      >myFactory to new brewery OR sawMill. both have a foo interface. however,
      >if
      >i continue the above code with:
      >>
      >myFactory.saw( )
      >>
      >it'll blow up. both saw and brew are specific interfaces defined by each
      >class respectively... not by iFactory. let's say that myFactory is set
      >somewhere unbeknownst to me, how would i take specific action?
      >>
      >public function factoryToString (byval factory as iFactory, byval fooValue
      >as
      >integer)
      > factory.foo = fooValue
      > if typeof factory is sawMill then
      > factory.saw()
      > end if
      > if typeof factory is brewery then
      > factory.brew()
      > end if
      >end function
      >>
      >anyway...i think i got off track, but does that help you know that you're
      >going to have to get at an actual Factory object in the list...which
      >doesn't
      >solve your memory problem?

      Comment

      Working...