Questions tagged [libraries]

A library is a collection of resources providing data and/or services for developing independent software.

Filter by
Sorted by
Tagged with
3 votes
1 answer
84 views

Shell Script Design Patteren: Source a library file VS Call different files?

We discuss about POSIX compliant shell script here. While we are writing more and more shell scripts, we build some helper functions to reuse the codes. We are considering putting a few helper ...
midnite's user avatar
  • 131
0 votes
2 answers
108 views

Appropriate design pattern for providing a default Argparse instance, eliminating boilerplate

I'm using argparse.ArgumentParser extensively; however, it comes with a lot of boilerplate to set up, and this is especially noticeable when you've got more than a few common arguments that probably ...
g_elef's user avatar
  • 19
0 votes
2 answers
74 views

Deserializing serial protocol enums: Recoverable or unrecoverable errors?

I am currently implementing a library in Rust that implements a proprietary serial protocol. The protocol specifies several enum values, that mostly are returned by the hardware as u8s (bytes), but ...
Richard Neumann's user avatar
0 votes
1 answer
115 views

Options for designing a generic library

During development of libraries (mainly for use in internal projects) I have come across the "problem" of how to design them in a generic way. I am going to demonstrate with an example ...
Patrick Wright's user avatar
0 votes
0 answers
73 views

Pattern for Nuget Package (Abstractions, DepedencyInjections, etc.)

I've been interested in following what other successful libraries are doing with their nuget packages. Unfortunately, I can't seem to find any materials to read online and I don't even know what to ...
Lawrence's user avatar
  • 123
0 votes
2 answers
244 views

Local development for TypeScript library organized as mono repo with Lerna

I currently am developing a TypeScript shared library. The library needs to be imported in sections to minimize the imported bundle size, so I broke it up into packages with a monorepo with Lerna. ...
devleo's user avatar
  • 51
0 votes
0 answers
105 views

How to handle dependency injection in a library to avoid frequent breaking changes?

Let's say I have a C# .NET library with the following classes: public class FooService { private readonly IDependencyA a; public FooService(IDependencyA a) { this.a = a; } ...
srk's user avatar
  • 127
0 votes
1 answer
69 views

Is it a bad idea to create a library that only contains some mappers and related functions? [closed]

There is a software (once monolith) that makes use of a long list of mappers. You can think of them as Choices field, where each item translates into different conventions. For ex, say that they are ...
aws1785's user avatar
12 votes
2 answers
2k views

Designing a Python string validation library

My employer has a significant number of company-internal strings which require format validation. For instance, order number AAA-BBB-CCC, stock number AB-123456 or factory ABC1 - Regex with extras (...
MikeFoxtrot's user avatar
1 vote
1 answer
92 views

How should I approach the development of an app with an parallel independent library?

I'm currently working on an ERP Blazor WebAssembly app that works alongside its base Razor Class libraries. The app could have some custom pages that aren't the same for all the customers and are ...
ImZac's user avatar
  • 21
0 votes
2 answers
946 views

Share Global Variable in DLL, feasible or naive?

So the gist is to have a static global variable that can be modified by different executables. For example I have 2 different source files including the same dll.h: dll.h #include <iostream> ...
VJZ's user avatar
  • 127
0 votes
4 answers
719 views

Is API exactly the same as header file?

I am trying to understand the difference between an Application Programming Interface and a Library and I stumbled upon this question: https://stackoverflow.com/questions/3678665/is-there-still-a-...
Noob_Guy's user avatar
  • 159
0 votes
2 answers
174 views

Why session should be a param when you write a query function?

I read a lot of examples where I read code like this: def get_user_by_id(session, id) ... and the function that calls that function needs to create or get the DB session a pass to the function. the ...
Tlaloc-ES's user avatar
  • 387
4 votes
5 answers
668 views

How to prevent in house frameworks and libraries from becoming technical debt

My company develops many relatively small projects that a lot of times do the same things and have a similar structure. (e.g. read/write to a databse, data pre processing, building a query etc.). This ...
krezno's user avatar
  • 167
0 votes
1 answer
499 views

How to handle config/env vars in a library project

I am building a new Python library project to be consumed by several of my application projects. The existing code consumes environment variables for various configuration settings. Should my ...
Brian's user avatar
  • 183
2 votes
2 answers
164 views

How to document external libraries that have been adopted into an existing codebase?

I have been using an external library for a while now. Unfortunately, it stopped receiving updates, and has since been adopted into my codebase. The issue is the library was poorly documented in the ...
Nicholas Ficara's user avatar
-3 votes
1 answer
141 views

Best way make a complex libraries as a plugin with dependency inversion principle [closed]

For instance, if we have a complex library with many functionalities, how can we make this lib a plugin such that it can be replaced with another lib more easily. The answer obviously is the ...
Vitor Figueredo Marques's user avatar
5 votes
4 answers
9k views

How to get an ILogger instance from extension methods?

Let's say I have this service abstraction exposed from a library. public interface INavigator { ImmutableList<IPageViewModel> Entries { get; } void NavigateForward(IPageViewModel page); ...
Batesias's user avatar
  • 234
4 votes
4 answers
532 views

Design pattern to create a shared lib architecture

I am making a renderer as a hobby, one thing I thought to try is making the low levelAPI be dynamically swappable, i.e. you could have an opengl or vulkan backend and switch between the two without ...
Makogan's user avatar
  • 261
2 votes
2 answers
711 views

Strategy for offering a library both a single-header and as a header + compiled implementation

I am maintaining a FOSS library which, for the sake of discussion, consists of a small .h file and a larger .c file (plus build-related files, see below) I've been requested to offer this library as a ...
einpoklum's user avatar
  • 2,488
6 votes
1 answer
642 views

Is changing the exception a method throws a breaking change for a library?

I have a library that I am distributing on maven in the new version I will be changing the exceptions some methods are throwing. Is this considered a breaking change? If this is the only change in the ...
K-RUSHer's user avatar
2 votes
3 answers
167 views

Should I ensure my libfoo library's include file can be included as foo/foo.h?

I'm maintaining a small C library; let's call it libfoo. It has quite a few users (actually it's complicated - it's the main fork of a highly popular library which has been abandoned); and it sports a ...
einpoklum's user avatar
  • 2,488
1 vote
1 answer
282 views

Re-export (certain) library components from barrel file

Situation At the project I'm currently working on we're using Chakra UI to create our UI. But I guess this question applies to whatever (UI) library you're using. There are certain components that ...
Jap Mul's user avatar
  • 111
40 votes
7 answers
10k views

Why do library developers deliberately break existing code?

Today, I updated ZBateson\MailMimeParser the PHP e-mail parser library from 1.x to 2.x. Soon enough, my PHP error log started filling up with errors. Noting where it happened, I found out that it had ...
user16508174's user avatar
6 votes
3 answers
974 views

How to simplify exception handling for library users?

Suppose of having a library exposing the following piece of functionality: public static class AwesomeHelpers { public static async Task<int> ComputeSomethingImportAsync(CalculationInputs ...
Enrico Massone's user avatar
3 votes
1 answer
358 views

Shared library and modules with versioning

I have different versions of modules and they should all work together with the same shared library which could also have different versions like displayed in the image below: From a daily use ...
TomatenSalat's user avatar
0 votes
1 answer
929 views

How to expose C++ static library interface, extending Pimpl to an abstract interface

Until today I had a static C++ library with no separation between the public interface and internal headers. My other apps just linked to it, included the required headers, and used whatever they ...
user3717741's user avatar
2 votes
2 answers
121 views

What's a good solution for prioritising tasks for a company code library?

I work at a game company that has a Core Library with a bunch of ultities, extensions and systems that we typically import large chunks of into projects. Recently we have been trying to improve our ...
Sebastian King's user avatar
1 vote
3 answers
4k views

"Hard coded" vs. configuration files for values in libraries? (code organization question)

I'm trying to get a good understanding as to whether there is a best practice or standard regarding keeping values within your code libraries or referencing them from another config file. I don't ...
Kyle's user avatar
  • 13
2 votes
4 answers
525 views

Is it common practice to declare exceptions in a library that won't be thrown or caught anywhere within that library?

I have a very basic library that serves the purpose of collecting some useful but simple pieces of code. Like for example a Percent struct or functions like ToDegrees() and ToRadians(), just to give ...
Stelios Adamantidis's user avatar
3 votes
4 answers
426 views

Should functions depend on other functions?

Suppose I have a function to log error messages printError(). Suppose I have another function which might throw an error, doSomething(). Should doSomething() implement its own error logging or depend ...
404 Name Not Found's user avatar
2 votes
0 answers
239 views

Drawing the boundary between high level API and low level API

Assume that were developing a cross platform graphics engine. Now we have quite a lot of low level APIs to choose from (OpenGL, Vulkan, DirectX 11, DirectX 12, ...). Now because of this, we are gonna ...
D-RAJ's user avatar
  • 129
-2 votes
1 answer
100 views

How to start developing a well architected Javascript Library?

I want to start developing an. open-source javascript library. I can see other open-source libraries are well structured. They have src, dist, test kind of folders, etc. Which is making me very ...
Saba Naeem's user avatar
1 vote
1 answer
42 views

CLI and Lib package, where to put module loading code

My Software contains a lib package, a cli package and an arbitrary number of plugin packages. The plugin packages do the algorithmic work. The lib package basically just executes the plugins and ...
danielr1996's user avatar
3 votes
2 answers
3k views

Programming a library in multiple languages

I am planning to implement a cryptographic library for several languages and looking for best practices. I have looked at several threads, especially this, this, and this one, which answer my ...
mushishi's user avatar
-2 votes
1 answer
118 views

In C++, does it make sens to have library project be composed of other libraries?

I'm working on a C++ project which is currently divided into "sub modules" / "components". Each of these are compiled into a separate library (components are usually 10-20 files). The libraries are ...
Antiro42's user avatar
1 vote
2 answers
54 views

Suitable way to round results returned by any function of a class

Assume there is a class Shape. The class has two functions area() and perimeter(). Let's say Circle and Square inherit from Shape and override these methods. Obviously the results are going to be ...
Abhishek Kumar's user avatar
-4 votes
1 answer
65 views

Development paradigms of ML libraries

I know that Tensorflow use symbolic model-building APIs where the developers can use them to build static computational graphs. Whereas Pytorch offer imperative programming paradigm where it performs ...
ShaAk's user avatar
  • 1
2 votes
1 answer
362 views

Backward compatibility testing

As a creator of a software library, how can I verify backward compatibility with earlier versions? When using a dependency management (here: Maven), multiple versions of my dependency could be (...
Matthias's user avatar
  • 145
0 votes
1 answer
141 views

When does it make sense to update eslint/prettier?

I have the following setup: different teams shared eslint config (that imports airbnb rules as a basis). Whenever a developer decides to update libraries, if eslint/prettier have updates, it's a ...
sergioviniciuss's user avatar
45 votes
5 answers
17k views

What is the difference between a library and a dependency?

In this docker beginner video its explained, that different stacks may depend on different libraries and dependencies and that this can be handled with Docker. However, I don't get what the ...
Adam's user avatar
  • 577
2 votes
2 answers
397 views

Is it a best practice or anti-pattern to export mock versions of functions for a library?

Context We are creating a library that makes an API (HTTP) request to a 3rd party. During testing we have written mock versions of the functions that make external requests so that we can test the ...
nelsonic's user avatar
  • 137
2 votes
1 answer
387 views

What is the name of the throw-an-exception on invalid inputs pattern?

In some .NET libraries, there's a pattern of two alternative ways to call a function. int i = x.GetValue(k); /* Might throw. */ if (x.TryGetValue(k, out int i) { /*...*/ } else { /* ... */ } I ...
billpg's user avatar
  • 611
0 votes
1 answer
119 views

How should I provide generic typing and allocation for a collection library in C?

I am in the process of implementing a persistent collection in C, specifically, an immutable hash trie. In order to increase acceptance and reusability, I have identified the following key areas that ...
ammut's user avatar
  • 159
1 vote
0 answers
45 views

how to handle external shared libraries, which we do not want to expose

We have 800-900 services we expose via an ESB. Each service is a web app hosted on Tomcat servers. We have 4 tomcat servers per group of services. Our services are split into 4 groups. Each service (...
Kelvin Wayne's user avatar
1 vote
1 answer
132 views

Is it common to include a specific build of a library/ tool for production level project?

I am working with C++ in a Linux/ Unix environment. I am trying to learn the physical design of large scale projects. In one of my projects, I am using an SDK from a camera manufacturer. They released ...
skr's user avatar
  • 123
0 votes
0 answers
315 views

Ensure that library has been initialized

I am using a 3rd party library that must be initialized with Lib::init() before any of its other functions may be called and that must be uninitialized with Lib::destroy() before the application ends. ...
pschill's user avatar
  • 1,807
2 votes
1 answer
791 views

Are symbolic links a good way to 'import' a project into another?

I've been thinking on how to import a project B into a project A, which both are GitHub repositories. Project B is a library I reuse over many projects, I do add stuff in it, directly from project X, ...
aybe's user avatar
  • 727
2 votes
2 answers
323 views

Organization of C++ source code for reusable components

I'm implementing a custom templated container as part of a learning project in C++. The container makes use of different components like serialization, memory management, iterators. I am wondering ...
NBWL's user avatar
  • 31
-1 votes
1 answer
215 views

Better stdbool.h

How about instead of #define bool _Bool #define true 1 #define false 0 #define __bool_true_false_are_defined 1 We should have this: #define bool _Bool #define true (bool)1 #define false (bool)0 #...
user avatar

1
2 3 4 5
8