How to organize your code library?

I am interested in learning how people organize their code libraries, especially regarding reusable components. I speak in OO terms below, but I'm interested in how your organization libraries are for other types of languages ​​as well.

For example:

  • Are you a fan of class library projects for everything or would you rather keep everything in one project?
  • Are you reusing your pre-created DLLs or are you including individual classes from previous projects in your current job? If you participate in separate classes, do you share them between projects to make sure that they are all updated, or do you allow branching?
  • How big are your reusable items? How are they focused? How are they focused?
  • What level of reuse do you achieve with your preferred methods?

and etc.

EDIT

I’m not looking for specific instructions here, I’m just interested in the thoughts and practices of people. I am particularly interested in code reuse between disparate projects, and not within a single project. (Unfortunately, using the “project” here is misleading - I mean reusing real-world projects undertaken for clients, not projects in the sense of Visual Studio.)

+7
package-design reusability organization
source share
4 answers

In general, this may be a guide for deployment considerations:

How will you deploy (that is, what you copy on your production machine)?

If what you are deploying is packaged components (for example, dll, jar, war, ...), it’s wise to organize a “code library” as a set of packaged files.
Thus, you will develop directly with the help of - dll, jar, war, ... - which will be deployed on the production platform.
The idea is that if it works with these packaged files, it can still work in the production process.


code reuse between disparate projects, and not within the same project.

I argue that such reuse is easier in the "component" approach (for example, in the " Affiliate Affiliates in GIT discussed" issue)

Over 40 ongoing projects we have achieved:

  • technical reuse , systematically isolating any pure technical aspect in an independent structure (as a rule, a log framework, exception infrastructure, KPI-Key Performance Indicator - structure, etc.). These technical components are reused in all other projects.
  • functional reuse by establishing a clear application architecture to divide any functional domain (taking into account business functions and functional specifications) into clearly defined applications. This is usually associated, for example, with the bus level, which is also an excellent candidate for the provision of services, reusable by any other projects.

Summary:
For a large functional area, one project is not manageable; a good applicative architecture will lead to code reuse.

+6
source share

We follow these principles:

  • Equivalence principle of release and reuse: the reuse pellet is a release pellet.
  • The principle of general closure: classes in the package must be closed with the same changes.
  • General reuse principle: classes in a package are reused together.
  • The principle of acyclic dependencies: do not allow cycles in the package dependency graph.
  • The principle of stable dependence: depends on stability.
  • Stable principle of abstraction: the package must be as abstract as stable.

You can find more here and above here .

+4
source share

It depends on what platform you are working on. I am a (proud) Java developer and we have good tools for organizing our dependencies like Maven or Ivy

0
source share

Regardless of what you decide, good control over the source code is crucial for this, as it allows you to implement your strategy in any way you like, without reaching a large number of unrelated copies of your libraries. Good branching support is essential.

0
source share

All Articles