I'm reading a technical book about programming and I came across on this sentence,

"A dependency abstracts functionality away from calling code. You don't need to worry too much about what a dependency is doing, much less how it is doing it, but you should ensure that all dependencies are correctly managed."

I did not quite get the sentence. Can anyone explain me this?

  • Which book did you find this quote in?
    – Jasper
    Commented Dec 20, 2017 at 19:10
  • 1
    @Jasper "Adaptive Code: Agile coding with design patterns and SOLID principles" Commented Mar 24, 2021 at 14:11

2 Answers 2


To abstract (away), specifically in computer science, refers to intentionally obscuring the details of how something works in order to simplify things conceptually. Something is abstracted when it acts as a "black box": We put some input into the box, and get some output from the box, but we can't see the inner workings inside the box. Abstraction typically happens in layers, i.e. some system of black boxes become the inner workings of a black box at a higher level of abstraction.

For example, consider what happens when I press a key and a letter appears on the screen. The details of how this happens are quite complex: pressing the key connects a circuit that causes a specific electronic signal to be sent to the computer, that signal is interpreted by hardware drivers and directed by the operating system into Google Chrome, which receives it as a sequence of bits which are handled by various functions in Chrome's code. Then there's a separate driver for the monitor, and so on. An abstract way of describing this is as follows: I press a key on my keyboard, and the corresponding letter appears on the screen.

The reason why this is conceptually useful in computer science is because computer systems and software can be incredibly complex. Nested black boxes are the conceptual building blocks of computer science because they allow you to choose your own level of detail. Need more detail? Open up the box and look inside. Too much detail? Abstract it away by putting everything in an even larger box.

How does this work with dependencies in particular?

One of the main ways of actually abstracting something is by encapsulating a piece of functionality in a class, method, routine, module, etc. that can be referenced by other areas of code. When a reference is established, the referencer becomes dependent on the referenced code. All the referencer can do is interact with the referenced code as a black box: giving it an input and receiving an output, but never having access to the inner workings. (See encapsulation.)

  • So this means, assume Object A is the referencer and Object B use reference code from Object A. By this Object B will not care how Object A process the code that is being reference in Object B, but only the product output from Object A?
    – rpmansion
    Commented May 11, 2016 at 16:59
  • Yes, except that if A references B, that means A is calling into B (A is using the code in B). A sends some input to B and receives some output. The reference itself just tells A where to find B. A can only use that code in B which is exposed to A, e.g. using access modifiers.
    – Era
    Commented May 11, 2016 at 17:11

You are talking about the functionality itself. But the purpose of a black box is reusability. A .dll is a good example of an encapsulated file. It can contain re-usable functions. This relieves the programmer of having to repeat a function in code over and over again. Thus, an encapsulated file reduces the size of the code in a software program. The .dll can be called many times and is an independent file of programs which call it. Any number of different programs can be written which can call upon the function (s) inside the same .dll file. Thus, a .dll is an incapsulated module which performs a specific set of actions...it is abstracting away the details of how it receives input, crunches the answers amd produces output.

  • 3
    I can't tell whether this is intended to be a comment on the other answer (which should either be a comment, or simply not posted at all) or an answer in its own right (which should directly answer the question). Commented Aug 3, 2016 at 7:48
  • 2
    This might be an answer if this site were about programming, but ELL is a language site. The answer needs to be explained in terms of what the words mean and not the programming concept that the paragraph is explaining.
    – ColleenV
    Commented Aug 3, 2016 at 14:22

You must log in to answer this question.

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