105 votes
Accepted

What is the difference between a library and a dependency?

Libraries and dependencies are like persons and relatives: One is just an entity (something), the other is a relational entity. I am a person. My niece is also a person. But to her, I'm a relative. ...
Kilian Foth's user avatar
104 votes
Accepted

Is it ok copying code from one application to another, both belonging to the same repository, to keep them independent?

It is acceptable if the copied code can change independently from the original code. If you are copying code and every future change has to be maintained in two different code bases, you could better ...
Rik D's user avatar
  • 4,803
94 votes
Accepted

How to deal with fear of taking dependencies

... We are forced to stay on the lowest API level of the framework (.NET Standard) … This to me highlights the fact that, not only are you potentially restricting yourselves too much, you may also be ...
David Arno's user avatar
  • 39.3k
51 votes

How to deal with fear of taking dependencies

We are forced to stay on the lowest API level of the framework (.net standard). The reasoning behind this is that a new platform could one day arrive that only supports that very low API level. The ...
berry120's user avatar
  • 1,747
48 votes
Accepted

When should dependencies be updated?

You should generally upgrade dependencies when: It's required There's an advantage to do so Not doing so is disadvantageous (These are not mutually exclusive.) Motivation 1 ("when you have to") is ...
Jonathan Eunice's user avatar
41 votes

What is the difference between a library and a dependency?

If an application uses a library, the application has a dependency on that library. Libraries are not the only type of dependency an application can have. Software can also depend on: configuration ...
Rik D's user avatar
  • 4,803
36 votes
Accepted

Why should I use foreign keys in database?

It maintains referential integrity (yes but can be maintained without it too) You are technically correct that if you're able to maintain referential integrity yourself, you don't need the constraint ...
Flater's user avatar
  • 49.4k
19 votes
Accepted

What to do when critical functionality of a dependency is broken and impedes development?

This is one of the reasons you're using open-source software, right? You could make the very same argument for "what happens if my very expensive, proprietary, closed-source library suddenly falls ...
Robert Harvey's user avatar
16 votes

Is it ok copying code from one application to another, both belonging to the same repository, to keep them independent?

In theory it's the best practice to put any significant common piece of code in a separate library that both applications use, rather than duplicating the code across both applications. In reality I ...
Bernhard Barker's user avatar
16 votes
Accepted

Writing a separate package vs copy pasting small amount of reused code

Isolating the serialization code in its own package is little overhead but significant benefits. You already pointed out the reuse possibility the package, but in fact it offers more: Separation of ...
Christophe's user avatar
  • 77.1k
15 votes

Optional dependencies in npm?

If you want simple optional dependencies like plugins, e.g. if you install foo you will run it colorful but if not installed, you don't have any problem and see it in gray, then you could use ...
PhoneixS's user avatar
  • 323
14 votes

Is it problematic to have a dependency between objects of the same layer in a layered software architecture?

I am comfortable to say that an object belonging to a layer can depend on objects from lower layers To be honest, I don't think you should be comfortable with that. When dealing with anything but a ...
David Arno's user avatar
  • 39.3k
12 votes

Is it a good idea to manage a group of repo microservices as submodules of a master repo?

Git submodules are broken: workflow is hard to follow history is cluttered unintuitive behaviour for non-git-experts easily broken (see section "Submodules break easily, and submodules break ...
BartoszKP's user avatar
  • 248
12 votes
Accepted

If a instance method is used in one place only, should I move that method to that place?

The question you ask is generalized, but the issue here is not what you think it is. The majority of this answer focuses on the real issue, but I want to respond to your direct question first. So ...
Flater's user avatar
  • 49.4k
12 votes

What is the difference between a library and a dependency?

Dependency In Docker image you have dependencies on different types and versions of: underlying OS (CentOS, Debian, Windows, ...) database (Mongo, Postgresql, ElasticSearch, ...) tools, and ...
RenatoIvancic's user avatar
11 votes

What to do when critical functionality of a dependency is broken and impedes development?

The solution to developing applications where bugs or lack of features have a high risk of causing your work to stop is to not use high risk libraries. Boring and lame, I know.. You said this is an ...
enderland's user avatar
  • 12.1k
11 votes

When should dependencies be updated?

Libraries should be updated when they are required to be updated. That means, if updating brings no value, you shouldn't. In your particular case, you were migrating from a old tech stack to a new ...
Christopher Francisco's user avatar
11 votes
Accepted

Avoid dependency version conflicts?

It's not your problem. It is up to your end user to resolve. It just comes with the territory of using third-party dependencies, and I've had to resolve dependency conflicts more times than I count. ...
Samuel's user avatar
  • 9,187
11 votes

How to have multiple source copies of a dependency in a C# git project?

I have always avoided this problem by using NuGet. If you are developing .NET, it's the 'standard' out of the box package manager and works very well. The downside, if any, is that your dependencies ...
Ewan's user avatar
  • 75k
11 votes
Accepted

Is it problematic to have a dependency between objects of the same layer in a layered software architecture?

Yes, objects in one layer can have direct dependencies among each other, sometimes even cyclic ones - that is actually what makes the core difference to the allowed dependencies between objects in ...
Doc Brown's user avatar
  • 207k
11 votes

How to deal with fear of taking dependencies

On the whole these things are good for your customers. Even a popular open source library might be impossible for them to use for some reason. For example, they may have signed a contract with their ...
Ewan's user avatar
  • 75k
11 votes

What is the difference between a library and a dependency?

A library is a specific piece of software that is intended to be consumed by another program. Typically, the library will address a specific/group of specific issues (although they can sometimes grow ...
Brian Place's user avatar
11 votes

How much of the frontend functionality should be mirrored in the API?

Data must always be validated again in the backend, even if it is already validated in the frontend. The fundamental principle at work here is this: you cannot trust the frontend. It could contain a ...
Robert Harvey's user avatar
10 votes
Accepted

Is it better to expose or hide dependency in OOP?

Is it better to expose or hide dependency in OOP? It's best to do both. Before I explain that let me explore the problems with your proposals. Let's say I have an object A, which is too big(having ...
candied_orange's user avatar
10 votes

What is the correct way of adding third-party code into a C or C++ project?

@17of26 gave a lot of good reasons why #2 is dangerous, and why #1 makes more sense. But I think there is one thing missing, for which I recommend the following: download the code of the library you ...
Doc Brown's user avatar
  • 207k
10 votes
Accepted

Adding library as dependency only to use one function

This really really depends and has to be decided on a case by case basis. Also, the modern JavaScript ecosystem has a strong bias towards using tiny libraries, so conventions from other ecosystems do ...
amon's user avatar
  • 134k
10 votes

Is it ok copying code from one application to another, both belonging to the same repository, to keep them independent?

A one-time copy is reasonable, but in my experience, if you don't set up a pattern for sharing code between builds, you will end up copying a lot more. I used to work in a code base that used copying ...
Karl Bielefeldt's user avatar
9 votes
Accepted

Semantic Version Change (to application) when Upgrading Libraries Involved

The semantic versioning rules are applied to your software from the perspective of your users. If your API has changed and is not backwards-compatible, you should update your major version number. It ...
Thomas Owens's user avatar
  • 82.7k
9 votes
Accepted

How to deal with recursive dependencies in OO languages?

Whenever a piece of code needs something, it should take a parameter. Don't do anything more complicated than that. If you want to create an object that needs a dependency use constructor parameters. ...
Winston Ewert's user avatar
9 votes
Accepted

External dependencies in Domain Driven Design

Yes and no. Yes, by abstracting external dependencies, you ensure that you can easily switch between different libraries. If there is a simple and straightforward way to wrap your library; go for it. ...
Flater's user avatar
  • 49.4k

Only top scored, non community-wiki answers of a minimum length are eligible