0

I asked a question here which was down voted. Let me put the question here:

" I know that dependency injection (DI) is one kind of Inversion of Control (IoC). There might be different types of examples that show IoC but not DI.

From Wikipaedia,

"inversion of control (IoC) is a design principle in which custom-written portions of a computer program receive the flow of control from a generic framework"

Can you show how each of your examples in code conform with Wikipedia definition ? I am particularly interested to find in each of your example the following terms and techniques from the mentioned definition :

1) Which part of your code is custom-written ?

2) Which part is the generic framework ?

3) What is the flow of control that is received by the custom-written portion from a generic framework ? How does the 'receiving' take place ?

They say that this question sounds to be a homework assignment. I came up with this question while preparing for an interview.

Can you point out the weakness of this question and how to improve it anyhow ?

4

There are three major issues with the question as originally asked:

1. Questions that ask for lists of things are too broad. See also: Why was my question closed as "Too Broad?". In particular, lists make it impossible to select one answer that is the best answer to your question.

2. This site is not a crowd-sourced search engine. This site is a question and answer site about software engineering. Good questions usually lead to answers that are based on professional experience. Collecting code snippets does not fit the bill. In contrast, asking us to explain some concept to you can sometimes be on topic.

3. Questions are expected to “show their work”. What did you try to answer the question yourself? For example:

  • point to resources that didn't quite solve the question (for example, related questions on this site)
  • explain your current understanding of a concept
  • show partial solutions, and explain why they won't work

Those are things that show that you are serious about getting an answer and show respect for the people that might spend their time on researching and answering your question. This also avoids answers that re-explain something that you already know. However, your question does not show any research beyond citing a Wikipedia snippet.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .