PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > Is it in the C++ culture to use Dependency Injection/Inversion ofControl?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

Réponse
 
LinkBack Outils de la discussion
Vieux 09/04/2008, 02h07   #1
Danno
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

Just that simple question....out of curiosity.
  Réponse avec citation
Vieux 09/04/2008, 02h13   #2
Ian Collins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversionof Control?

Danno wrote:
> Just that simple question....out of curiosity.


Which is?

--
Ian Collins.
  Réponse avec citation
Vieux 09/04/2008, 06h16   #3
Juha Nieminen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversionof Control?

Danno wrote:
> Just that simple question....out of curiosity.


Two things:

1) It's common netiquette to write the contents of the post in the
body of the post, not in its subject. The subject line is just a quick
intro to the post itself, it's not the post. The post should be
completely understandable even if the subject line was completely removed.

2) You are clearly trying to be a smart-ass by using complicated
terminology that only few people are acquainted with, clearly on
purpose. If you don't want people to think you are a smart-ass, explain
your terminology before using it.
  Réponse avec citation
Vieux 09/04/2008, 06h35   #4
Abhishek Padmanabh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

On Apr 9, 6:07am, Danno <dh.evolutionn...@gmail.com> wrote:
[Subject] : Is it in the C++ culture to use Dependency Injection/
Inversion of Control?
> Just that simple question....out of curiosity.


If you are hinting towards AOP, you could refer this: http://www.aspectc.org/
  Réponse avec citation
Vieux 09/04/2008, 06h52   #5
Danno
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

On Apr 8, 7:13 pm, Ian Collins <ian-n...@hotmail.com> wrote:
> Danno wrote:
> > Just that simple question....out of curiosity.

>
> Which is?
>
> --
> Ian Collins.


Well, the seminal articles are by Martin Fowler.
http://martinfowler.com/bliki/InversionOfControl.html
http://martinfowler.com/articles/injection.html

It is a way of designing classes, therefore objects, to be injected
with what they need instead of tight coupling relationships to other
classes & objects by instantiation or non-abstract assignements. This
is also usually done with abstractions (interface oriented design).
In Java and Ruby, objects are injected with the objects they require
by text, xml, or dsl file.








  Réponse avec citation
Vieux 09/04/2008, 07h04   #6
Danno
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

On Apr 8, 11:16 pm, Juha Nieminen <nos...@thanks.invalid> wrote:
> Danno wrote:
> > Just that simple question....out of curiosity.

>
> Two things:
>
> 1) It's common netiquette to write the contents of the post in the
> body of the post, not in its subject. The subject line is just a quick
> intro to the post itself, it's not the post. The post should be
> completely understandable even if the subject line was completely removed.
>
> 2) You are clearly trying to be a smart-ass by using complicated
> terminology that only few people are acquainted with, clearly on
> purpose. If you don't want people to think you are a smart-ass, explain
> your terminology before using it.


Calm down, my god, this group is too egotistical, pious and angry.

I am trying to educate myself with different languages and I asked one
simple question here on c.l.c++ a couple of weeks ago about pointers
and I get jumped on by one of your members. Now I ask another question
about DI/IoC and you think it's an affront to your intelligence? Are
you guys that sensitive and insecure about yourselves to go bashing
posters?

Don't worry, this will be last participation in this group for me, you
guys can proceed with your "don't hit your ass on the way out" party.
There are plenty open academic discussion groups out there.


  Réponse avec citation
Vieux 09/04/2008, 07h07   #7
Danno
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

On Apr 8, 11:35 pm, Abhishek Padmanabh <abhishek.padman...@gmail.com>
wrote:
> On Apr 9, 6:07 am, Danno <dh.evolutionn...@gmail.com> wrote:
> [Subject] : Is it in the C++ culture to use Dependency Injection/
> Inversion of Control?
>
> > Just that simple question....out of curiosity.

>
> If you are hinting towards AOP, you could refer this:http://www.aspectc.org/


No, but that is some great info, and I appreciate the link.

I posted the info on Dependency Injection and Inversion of Control on
the response to Ian.
  Réponse avec citation
Vieux 09/04/2008, 09h19   #8
Ian Collins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversionof Control?

Danno wrote:
> On Apr 8, 7:13 pm, Ian Collins <ian-n...@hotmail.com> wrote:
>> Danno wrote:
>>> Just that simple question....out of curiosity.

>> Which is?
>>

>
> Well, the seminal articles are by Martin Fowler.
> http://martinfowler.com/bliki/InversionOfControl.html
> http://martinfowler.com/articles/injection.html
>
> It is a way of designing classes, therefore objects, to be injected
> with what they need instead of tight coupling relationships to other
> classes & objects by instantiation or non-abstract assignements. This
> is also usually done with abstractions (interface oriented design).
> In Java and Ruby, objects are injected with the objects they require
> by text, xml, or dsl file.
>

Ah, I wasn't sure what the question was. It's been a while since I read
those papers (it's well worth spending time on Martin's site, there are
some real gems there), but I think I remember the gist.

C++ classes don't support dynamic binding, but it can be approximated
with callback functions and/or functors. SO yes, a C++ class can be
instantiated and then have specific behaviour "injected". I guess the
good old C callback functions is the most basic form of IoC.

--
Ian Collins.
  Réponse avec citation
Vieux 09/04/2008, 10h12   #9
arnuld
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion of Control?

> On Tue, 08 Apr 2008 23:04:02 -0700, Danno wrote:


> Calm down, my god, this group is too egotistical, pious and angry.


really ?

when I saw your post for 1st time, you seem like you were either trying to
be over-smart or you are stupid. I am not saying you are idiot/smart-ass.
I am saying the way you communicate your question to comp.lang.c++,
then it shew that way.

The way youo asked your question with *zero* words in your post reminds of
the programmers from 1late 90s "IT Revolution" era. Many persons called
themselves HTML Programmers at that time. Now I added your name onto that
list.



> I am trying to educate myself with different languages and I asked one
> simple question here on c.l.c++ a couple of weeks ago about pointers and
> I get jumped on by one of your members. Now I ask another question about
> DI/IoC and you think it's an affront to your intelligence? Are you guys
> that sensitive and insecure about yourselves to go bashing posters?


No one is bashing you here. *They* are trying to educate you. Juha
Nieminen did the same and there were no harsh words in his reply.


> Don't worry, this will be last participation in this group for me, you
> guys can proceed with your "don't hit your ass on the way out" party.
> There are plenty open academic discussion groups out there.


yes, they are there. comp.lang.c++ is a kind of group where
regular-posters are much more matured, intelligent and patient than what
you will experience on other groups.

try yourself but it will take a lot of personal-time of yours before you
find that out.





-- http://lispmachine.wordpress.com/

Please remove capital 'V's when you reply to me via e-mail.

  Réponse avec citation
Vieux 09/04/2008, 13h12   #10
Lloyd Bonafide
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion of Control?

Ian Collins <ian-news@hotmail.com> wrote in news:663cgoF2hu9ejU9
@mid.individual.net:

> Danno wrote:
>> On Apr 8, 7:13 pm, Ian Collins <ian-n...@hotmail.com> wrote:
>>> Danno wrote:
>>>> Just that simple question....out of curiosity.
>>> Which is?
>>>

>>
>> Well, the seminal articles are by Martin Fowler.
>> http://martinfowler.com/bliki/InversionOfControl.html
>> http://martinfowler.com/articles/injection.html
>>
>> It is a way of designing classes, therefore objects, to be injected
>> with what they need instead of tight coupling relationships to other
>> classes & objects by instantiation or non-abstract assignements. >
>> C++ classes don't support dynamic binding,


Isn't plain old LSP an instance of DI? The client code only knows the
interface, not the implementing classes. If you link dynamically, you
can plug and play different modules.

The kind of DI used in dynamic languages like Ruby and Python (which
I've used) can lead to debugging and maintenance nightmares when your
behavior is specified in code as well as config files.

  Réponse avec citation
Vieux 09/04/2008, 15h33   #11
Danno
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

On Apr 9, 6:12 am, Lloyd Bonafide <nos...@nicetry.org> wrote:
> Ian Collins <ian-n...@hotmail.com> wrote in news:663cgoF2hu9ejU9
> @mid.individual.net:
>
> > Danno wrote:
> >> On Apr 8, 7:13 pm, Ian Collins <ian-n...@hotmail.com> wrote:
> >>> Danno wrote:
> >>>> Just that simple question....out of curiosity.
> >>> Which is?

>
> >> Well, the seminal articles are by Martin Fowler.
> >>http://martinfowler.com/bliki/InversionOfControl.html
> >>http://martinfowler.com/articles/injection.html

>
> >> It is a way of designing classes, therefore objects, to be injected
> >> with what they need instead of tight coupling relationships to other
> >> classes & objects by instantiation or non-abstract assignements. >
> >> C++ classes don't support dynamic binding,

>
> Isn't plain old LSP an instance of DI? The client code only knows the
> interface, not the implementing classes. If you link dynamically, you
> can plug and play different modules.
>
> The kind of DI used in dynamic languages like Ruby and Python (which
> I've used) can lead to debugging and maintenance nightmares when your
> behavior is specified in code as well as config files.


That is definitely one of the major complaints about DI. Some
developers get blamed for overdoing it by making their code as
anorexic as possible.

I pulled up the DI page on wikipedia and it offers frameworks in C++:

http://code.google.com/p/autumnframework/
http://code.google.com/p/pococapsule/
http://qtioccontainer.sourceforge.net/



  Réponse avec citation
Vieux 09/04/2008, 15h46   #12
Danno
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

On Apr 9, 2:19 am, Ian Collins <ian-n...@hotmail.com> wrote:
> Danno wrote:
> > On Apr 8, 7:13 pm, Ian Collins <ian-n...@hotmail.com> wrote:
> >> Danno wrote:
> >>> Just that simple question....out of curiosity.
> >> Which is?

>
> > Well, the seminal articles are by Martin Fowler.
> >http://martinfowler.com/bliki/InversionOfControl.html
> >http://martinfowler.com/articles/injection.html

>
> > It is a way of designing classes, therefore objects, to be injected
> > with what they need instead of tight coupling relationships to other
> > classes & objects by instantiation or non-abstract assignements. This
> > is also usually done with abstractions (interface oriented design).
> > In Java and Ruby, objects are injected with the objects they require
> > by text, xml, or dsl file.

>
> Ah, I wasn't sure what the question was. It's been a while since I read
> those papers (it's well worth spending time on Martin's site, there are
> some real gems there), but I think I remember the gist.
>
> C++ classes don't support dynamic binding, but it can be approximated
> with callback functions and/or functors.


Now I know what callback functions are, but they may have different
meaning in a C++ context (or may not). I had no clue what functors
were until you posted. I googled it and found out. It looks like that
is probably the best way to do injections.

> SO yes, a C++ class can be
> instantiated and then have specific behaviour "injected". I guess the
> good old C callback functions is the most basic form of IoC.
>





  Réponse avec citation
Vieux 10/04/2008, 04h41   #13
Lou Parsons
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversionof Control?

Danno wrote:

>
> Don't worry, this will be last participation in this group for me, you
> guys can proceed with your "don't hit your ass on the way out" party.
> There are plenty open academic discussion groups out there.
>
>



Nah dont go anywhere. You had a good question. Just because some
people act like bruised little pussies whenever they're made
uncomfortable with words they don't know and then whine about it, it's
their failure not yours....post away!

Thanks for links on DI on C++ BTW.

--

Lou

12 skiing injuries to date.
  Réponse avec citation
Vieux 10/04/2008, 21h08   #14
Ke Jin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is it in the C++ culture to use Dependency Injection/Inversion ofControl?

On Apr 8, 6:07pm, Danno <dh.evolutionn...@gmail.com> wrote:
> Just that simple question....out of curiosity.


In C++ applications, it is pretty common that object dependencies are
configured (wired up) by passing depender references as input
parameters of plain old C++ constructs, static methods (e.g.
factories), setters, as well as other virtual/non-virtual member
functions of dependee objects. So, from this sense, one could claim
that dependency injection (DI) has been a C++ calture for decades.

To change the question more specific to "DI framework support in C++",
there are several of them already. For instance, the PocoCapsule
(<http://code.google.com/p/pococapsule) supports framework agnostic
plain-old C++ objects (POCO).

Hope this s,
Ke

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h17.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,20401 seconds with 22 queries