You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
5.0 KiB
Markdown

# Dependency
9 months ago
Dependency of a piece of [technology](technology.md) is another piece of technology that's required for the former to work (typically e.g. a software [library](library.md) that's required by given computer [program](program.md)). Dependencies are [bad](shit.md)! Among programmers the term **dependency hell** refers to a very common situation of having to deal with the headaches of managing dependencies. Unfortunately dependencies are also unavoidable. We at least try to minimize dependencies as much as possible while keeping our program functioning as intended, and those we can't avoid we try to abstract (see [portability](portability.md)) in order to be able to quickly drop-in replace them with alternatives.
9 months ago
Having many dependencies is a sign of **[bloat](bloat.md) and bad design**. Unfortunately this is the reality of mainstream programming. For example at the time of writing this [Chromium](chromium.md) in [Debian](debian.md) requires (recursively) 395 packages LMAO xD And these are just runtime dependencies...
7 months ago
Though dependencies are primarily bad because they endanger whole functionality as such, i.e. "it simply won't run without it", they are also bad for another reason: you have no control over how a dependency will behave, if it will be implemented well and if it will behave consistently. [OpenGL](opengl.md) for example caused a lot of trouble by this because even though the API is the same, different OpenGL implementations performed differently under different situations and made one game run fast with certain combinations of GPUs and drivers and slow with others, which is why [Vulkan](vulkan.md) was created. It is also why some programmers write their own memory allocation functions even though they are available in the standard library etc. -- they know they can write one that's fast and will be fast where they want it to be.
In [software](software.md) development context we usually talk about software dependencies, typically [libraries](library.md) and other software [packages](package.md). However, there are many other types of dependencies we need to consider when striving for the best programs. Let us list just some of the possible types:
- [software](software.md)
- [libraries](library.md)
- [compiler](compiler.md) supporting specific language standard
- [build system](build_system.md)
- [GUI](gui.md) capability
- [operating system](operating_system.md) and its services such as presence of a [window manager](file_system.md), [desktop environment](desktop_environment.md), presence of a [file system](file_system.md) etc.
- [Internet](internet.md) connection
9 months ago
- ...
- [hardware](hardware.md)
2 years ago
- sufficient [computing resources](computing_resources.md) (enough RAM, CPU frequency and cores, ...)
- [graphics card](gpu.md)
- [floating point unit](fpu.md) and other [coprocessors](coprocessor.md)
- CPU features such as special instructions
- [mouse](mouse.md), [speakers](monitor.md) and other I/O devices
9 months ago
- ...
- other:
- know-how/education: Your program may require specific knowledge, e.g. knowledge of advanced math to be able to meaningfully modify the program, or nonnegligiable amount of time spent studying your codebase.
- running cost: e.g. electricity, Internet connection cost
- culture: Your program may require the culture to allow what it is presenting or dealing with.
9 months ago
- ...
9 months ago
Good program will take into account all kinds of these dependencies and try to minimize them to offer [freedom](freedom.md), stability and safety while keeping its functionality or reducing it only very little.
2 years ago
Why are dependencies so bad? Because your program is for example:
9 months ago
- **more [buggy](bug.md)** (more [fuck up surface](fuck_up_surface.md))
- **less [portable](portability.md)** (to port the program you also need to port all the dependencies)
2 years ago
- **more expensive to [maintain](maintenance.md) (and create)** (requires someone's constant attention to just keep the dependencies up to date and keeping up with their changing API)
- **less [future proof](future_proof.md)** and **more fragile** (your program dies as soon as one of its dependencies, or any dependency of these dependencies)
- **more [bloated](bloat.md) and so probably less efficient**, i.e. slower, eating up more RAM than necessary etc.
- **less under your control** (in practice it's extremely difficult to modify and maintain a library you depend on even if it's [free](free_software.md), so you're typically doomed to just accept whatever it does)
9 months ago
- **less "secure"** (more [attack surface](attack_surface.md), i.e. potential for vulnerabilities which may arise in the dependencies) -- though we don't fancy the [privacy](privacy.md)/[security](security.md) hysteria, it is something that matters to many
- **more dangerous [legally](law.md)** (reusing work of other people requires dealing with several to many different licenses with possibly wild conditions and there's always a chance of someone starting to make trouble such as threatening to withdraw a license)
9 months ago
- ...
## How to Avoid Them
TODO