instruction stringlengths 34 36.1k |
|---|
In our company, there is no standard for how to document APIs. Missing API documentation slows down the development process.
Therefore, we want to introduce OpenAPI.
We want to use code generators to ensure that the OpenAPI specification is up-to-date and to ensure that the services are compliant with the OpenAPI speci... |
Right now we have a monolith application, and we will still have one monolith probably for the following years. What we are trying to do though, is to break the responsibilities more clearly in well-defined bounded contexts. For this question, let's say we have two bounded contexts:
Company bounded context: in this bo... |
I am developing a package for the Unity game engine. I want to add additional functionality to my package if another specific package is present. I am faced with a dilemma I am not sure which of these two options is better in terms of API design and usability.
While not frequent, one can expect users to swap between ha... |
I am working on a ChildModelListSheetHandler, that has a childModelListDict.
As what you're probably thinking, it maps the foreign keys that are the IDs of the parent models, to the list of child models associated with that parent model.
I start working on a derived class thereof: RateCardChildModelListHandler. So far,... |
Currently my company has 2 applications that use Identity Server for SSO. Not every client we have uses both applications but some do. The part I'm uneasy about is that both apps have a user management section that adds users to IS by calling an api in IS. They even get a different token to do this behind the scenes (u... |
Why does the infrastructure layer depend on the application layer, and the application layer depend on the domain layer in the onion architecture ?
In its definition, the dependency flow inwards. But I can't see the advantages of having the application layer depending on the domain layer, and the infrastructure layer ... |
I want to build a grpc server which will be run by a company (service provider) and multiple client each run by a different company (a client). I thought of this instead using a Rest API to get benefit from the grpc speed.
My question:
Is it a good practice to connect multiple clients using grpc to a server over intern... |
I am trying to build a "world" consisting of Fields
for simplicity lets say there is a water and town field
i created two classes
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Water extends Field {
}
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Town ext... |
Lets say i have an application where user can register, and the username has to be unqiue value.
Now lets say i have N partitions and for each partition i have M replicas with multiple leaders.
Now i have questions regarding these scenarios:
First:
User 1 attempts to register with username user1 - the write request ge... |
We have an application that fetches user data from an Azure tenant via MS Graph. We need to distinguish between guests and regular members.
Guests come back with Usernames that look like this:
johndoe_agreatdomain.org#EXT#@mydomain.onmicrosoft.com
In our web application that actually displays this information, we nee... |
I have to create custom buttons but in order to encapsulate the logic of button creation I've this class (VB.net):
Public Class ButtonCreator
Public Shared Function CreateBaseButton(Optional label As String = "") As Button
Dim btn As New Button()
btn.Text = label
btn.Size = New Size(100, 25... |
Does modular design decrease compilation time in cpp? My professor said so, but I don't understand how, because the build and compilation time depend on the amount of code, right?
Also, wouldn't resolution of header guards in a separate module and stuff like that actually increase the compile time (marginally as I unde... |
I am making a appointment system for various businesses.
Each business provides us the following type of information (system already impemented):
Weekly schedule which day of week id open and close where stored upon weekly_schedule:
business_id
day_of_week
open
time_open
time_close
Deviations from the schedule stor... |
I'm writing my own F#-esque language and I'm using LLVM for code generation. I want my language to support continuation passing style and I think I've got TCO figured out but I cannot figure out how to make continuations use heap memory instead of stack memory. As far as I can tell there is no direct mechanism for maki... |
Am exploring options of adopting feature flag based development to deliver builds faster instead of getting tangled in release branch management rabbit hole.
As of now I am not able to find a good architecture pattern for iOS & Android native app development which will make it easier to adopt feature flags. We can use ... |
Let's say this application has a User and each user must have a firstName and a lastName. We could simply call the service with two strings from the controller (method A):
class UserController {
function createUser(Request req) {
userService.createUser(req.firstName, req.lastName)
}
}
or we could pass... |
So I want to make an application in which a user will hit an endpoint to save a job model to storage that includes some metadata to perform a long computation against which will be offloaded to a distributed task queue, allowing users to lookup their job run statuses or computation results via ID of the saved model. Ho... |
PHP have what it calls "traits" which despite the name is not like traits in Rust, Scala or other languages.
In many other languages with support for traits, a trait create a is-a relation. So if class Foo implements the Bar trait then Foo is a Bar.
The same goes for "mixins" which also basically inheritance and create... |
I am looking to create a "my actions" block on the dashboard of the website.
This block would include all sort of dynamic actions that the user needs to do.
Some examples are:
The volunteer still needs to sign volunteer contract 1
The volunteer still needs to sign expense note 1
The volunteer still needs to sign expen... |
I think that I've taken the Open-Closed and Single Responsibility principles too far. Previously, I had one huge static class containing every method that has C# talk to stored procedures on my SQL Server. Here is one such method.
public static void DeletePerson(int PersonID)
{
CallCommandAndHandleErrors((Connection... |
I'm developing a doctor-patient system that consists of two microservices, namely the "doctor" and "patient" microservices. Both doctors and patients share some common attributes, so I introduced a third microservice called "users" to manage these shared attributes. However, I'm unsure about the most suitable approach ... |
I like the practice of naming boolean variables with a prefix like "is", "has", "should", or "can".
But what about the functions that produce those results?
Currently I'm using:
const isReadyForPublicProfile = checkWhetherIsReadyForPublicProfile(teacherOf);
const shouldWarnAboutProfileChangingToPrivate =
checkWheth... |
Currently, I have to define a general design approach concerning the future extensibility of a software written in C#. The software is built in modular design: A main part doing the general handling, and several manager/driver classes who operate the hardware, handle the database etc. The goal is to create the software... |
During this weekend I read "Get Your Hands Dirty on Clean Architecture" by Tom Hombergs. I am working on a microservice that was born with Hexagonal Architecture in mind, so I was able to recognize a lot of patterns already; anyway, I am still a bit unsure of the role that a Spring Application would play in such archit... |
I am wondering what some possible workflows are for writing database migrations for a team of developers. We seem to run into a problem where one person writes a migration, names it and gives it a number (the latter is done automatically by the migration package called Alembic). Prior to this migration being submitted ... |
The contents of search string are typically sent as part of the URI query:
https://domain.name/resource?search=something+i+am+searching+for
Those same contents can be sent as the value of a custom HTTP header:
$ curl -v "https://google.com" -H "custom-search-header: something i am searching for"
> GET / HTTP/2
> Host:... |
Context:
We have Java maven Multi Microservices Project.
The structure for each microservice is a contracts package and a service package.
When we update a version of a specific microservice the versions-maven-plugin knows to replace the version in all the dependents poms.
Once there is a change in one file of a servic... |
I have a SaaS application in which users can connect their RDBMS (postgres, mysql etc) and query data from it. I'm wondering what's the best practice to keep their connection details safe. Currently, I'm saving them to my application db (postgres) in plain text.
Maybe I can encrypt them?
Eventually, I'd like to achiev... |
I am working on design of a distributed system which will process some events. For simplicity lets say, multiple instance of same service will be consuming from same queue, every message will have a id for which the event has generated and it will read the current value of it from the DB and increment it by 1 and updat... |
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;
}
}
public class BarService
{
public BarService()
{
}
}
This library supports dependency injection, but it ... |
In my working project I have a CustomerRegisterUseCase, that has following steps:
validate email is already in use;
hash password;
save customer in temporary table(tranfered to customer table after email validation);
generate email validation code;
send email validation;
But other part of company wanna create a custo... |
I'm trying to design my new open source project I want to launch.
I want to be very careful with design/projecting because I had trouble maintaining software in the past.
I have code that works and now I want to rebuild it from scratch in a more organised way.
The project it self is based around a physics simulation en... |
The most popular answer is - it is an object whose state does not change after creation.
What does it actually mean?
My understanding is that any method call on the object should give the same result. So, it makes me wonder could an immutable object refer to mutable data? For example, Is an immutable object referring t... |
I'm new to Git, having worked with TFS for nearly 20 years, and I'm currently trying to get my head around "rebase". I broadly understand what it's doing, but there are a couple of caveats/warnnings that I keep seeing, but I don't really understand them:
"don't rebase after pushing"
So if I've rebased my master branch ... |
I often see/write classes that contain every part of the application where the application will talk to a SQL server. For example, you may have a class like this
public class Data
{
private Func<IDbConnection> Factory { get; }
public Data(Func<IDbConnection> factory)
{
Factory = factory;
}
... |
Scenario:
An application is going to perform operations on an entity. That means retrieving it from storage, possibly making modifications, and then persisting those changes back to storage.
I'm hearing conflicting approaches.
We should retrieve an entire entity from storage (like a repository), our application logic ... |
If i understand NAT correctly, by default a device outside of the NAT cannot reach a device inside it. If the two devices use a central server to connect however they can obviously communicate. My question is whether it is possible to remove the central server after establishing the connection if the central server sim... |
I am a react developer and writing the client on pure JS. I have sometimes missions to received data from server and send data to server. Now between the client team and backend rough discussion regrading how to send the data.
The server use map object for almost every thing, even for small data sets of information, th... |
I can write an enum with properties besides the name and ordinal. A very generic example would be:
public enum ExampleEnum {
EXAMPLE0(Example.example0),
EXAMPLE1(Example.example1),
EXAMPLE2(Example.example2);
public final Example identifier;
private ExampleEnum(final Example identifier) {
... |
I am building a chat app using flutter and sqflite. In the chats screen we display a list of chats, each contain name and last message. Every time a user sends a message, should I update the last message column in the local storage? Or maybe when disposing the screen I update the last message? What is the best practice... |
I'm working on an event-driven system and I'm facing a problem I never considered before.
There is a particular user command - let's call it "A" - that must be processed possibly with a delay of 10 minutes because user wants to be able to cancel that action issuing a new command - say "C" - until that delay has passed.... |
I’m working on a system where we have several scheduled long running operations.
In our case this is website crawls that we perform for customers. The current setup is pragmatic where we have one service running that is responsible for distributing the work to four different “crawlers” that is running as threads in the... |
I've started work on a web application personal project that is more a learning opportunity more than anything and I'm brainstorming the stack. My number one priority is to not overcomplicate things especially splitting up things into too many services. My second priority is to make sure that if, necessary, the entire ... |
In my embedded project I am designing a framework that allows the user to create widgets at compile time. All widgets must provide the same base functionality. Further, there are multiple widget categories which may share common code.
The user is supposed to create instances of the specific implementations ("the startu... |
Does it make sense to implement TLS encryption for a service which will always be behind a reverse proxy? The reverse proxy will be able to handle encryption to users directly.
+-------------------------------+
| +---------+ +---------+ |
| | service |<--->| reverse |<--O---> Internet
| | | |... |
Consider this Java code:
int rowIndex=8;
int offset=0;
libFuncCall.populate("B"+rowIndex+offset, data);
Here I mistakenly missed the fact that, resulting argument is a String though I had rowIndex and offset both integers. The actual code would have been:
libFuncCall.populate("B"+(int)(rowIndex+offset), data);
Until... |
When implementing projects in Spring Boot (especially CRUD applications), I often find myself writing a lot of repetitive code that just calls functions and services from lower layers. For example, when implementing a web service with some REST API, you end up with a controller, a service, a repository, and a model for... |
The following sequence diagram is rendered by Sparx Enterprise Architect. Is the start of the new activation (blue) correct? Shouldn't it rather continue with the existing activation on the Object2?
Please note that the flow starts with the asynchronous (red) call.
If the diagram is correct, why the new activation is ... |
I am building a .NET Framework WPF application, however, I want to use IConfigurationBuilder, which is a part of the newer (.NET Core and up) Microsoft.Extensions.Configuration namespace. My understanding is that .NET Framework apps traditionally use the app.config file in conjunction with ConfigurationManager class.
U... |
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. Things are going great. Each package has its own dist folder and each of those are published to the GitHub artifact store f... |
If I'm writing Scala functions and have to check for nulls in situations where I can't avoid it (say, working with Spark UDFs and some legacy Java types), is it better to turn things into Option or to write conditional branches?
Example:
case class Foo (
bars: Seq[Bar]
)
case class Bar(s: String)
def findBarWithCon... |
Designing a SaaS application that will be used by multiple business customers (tenants). Decided to use the single tenant model - a single instance of the application and database is deployed for each customer.
The problem deals with monitoring and managing the instances. We can easily create an admin portal (for CRUD... |
I am working on improving the code quality and portability of my C library, specifically a ring buffer implementation, that will be used in larger applications. I have encountered a dilemma regarding error code handling, and I would like to seek advice on industry best practices.
In some of my libraries, I currently us... |
We have a .NET c# solution that uses AliaSQL to run database migrations / to build the backend. I have a situation where we need to write some SQL Server logic that will
copy records from Table A to Table B based on some logic. It's not a straight copy.
must be triggered at a specific point in time, not by the pipeli... |
Imagine I have graph data that is beyond the size of a single machine.
How would you shard a graph database?
I asked on Hacker News and people suggested sharding based on a hash of the predicate-subject-object, ala RDF triples.
I could partition the graph across replicas and query all replicas to aggregate answers.
But... |
The SLF4J documentation says that it's best practice for libraries to not include a concrete logging binding.
I'm wondering what to do about transitive dependencies though.
Let's say my library A depends on another library B which depends on commons-logging.
Should the pom.xml for A have an <exclude> for commons-loggin... |
In interpreted languages like R and Python if I import and module, and use its functions, is that considered as dynamic linking of my program to that module?
|
I'm working on a .Net core API for product configuration and ordering. The ticket for Permissions has come up and I've been tasked with developing a solution, ideas of middleware have been mentioned.
Considering:
Clean Architecture
Don't repeat yourself
Singular Responsibility
When should I, (or at which layer should... |
While practicing System Design, I decided to create a hypothetical proximity service (like Google Maps) with a microservice architecture. Suppose we have 3 core categories of functionality:
CRUD operations for new Businesses (Stores, Restaurants, etc.)
CRUD operations for users
Search for and retrieve a list of Busine... |
Please consider the following sample
#include <cstdio>
#include <functional>
#include <memory>
#include <utility>
class PaintDelegate {
public:
virtual ~PaintDelegate() = default;
virtual void draw(){}
};
class PaintDelegateActions {
public:
PaintDelegateActions(std::function<void()>&&... |
We have an object Root, which references many other objects. Which eventually is translated into FKs on the DB level. We came up with an ACL scheme where there's a separate permissions table with the user,resource,access_level. And so we change our logic to look at this table before returning the data to the user.
Prob... |
Java never had immutable primitive arrays. However Java does have an immutable List or Map or other collection classes and of course final primitive fields and variables. In Java if you try to make an Object or array final you only make the reference final. The reference will only point to the same actual object but th... |
I wondered if it's possible to reverse engineer a Botnet "Node" (aka the Client/Malware), to find hard-coded values, like the IP of the Command Server (CnC Server) to catch the Operator of the Botnet?
Like if there's some variable let server = "some_ip_goes_here" and it was compiled to an .EXE and you "de-compile" it?
|
This is a clarification of a closed question. I've limited the scope as requested.
First, a few definitions, following e.g. A modular module system. Consider any programming language with a selected subtheory of its native type theory. Let a signature be two collections of named types, allowing for polymorphism; the fi... |
I am trying to wrap my head around what the ECMAScript specification suggests about variable assignment.
Introduction:
Coming from Java, this is pretty straight forward. Variables get stored at a memory location and assigning one variable to another one copies the value of the first into the memory location of the seco... |
I am coming into a project that uses an Amazon S3 Bucket for a process.
For my application, I need to know (within a reasonable time - order of a few minutes, at most) whether a new file has beeen added to the bucket, and then download that file.
Currently, an SQS queue already serves this purpose for another applicati... |
Let's say I am writing a python module module.py. Which provides functionalities for other parts of my code. Of course, the module has to import other modules. A simple example:
import abc as _abc
import typing as _typing
class BaseFunctionality(_abc.ABC):
def get_sequence(self) -> _typing.Sequence[float]:
... |
I created an abstract class to represent a vertex in a tree structure. Later, a requirement was introduced where certain types of vertices are not allowed as descendants of certain other vertices. So I updated the class. Here is something like what it looks like:
<?php
abstract class AbstractVertex
{
protected arr... |
I'm creating a web app and looking to have a feature to show a history of updates/activities of other users to the current user. For example if another user creates a project. The user should see something like:
"User A created Project 1 - Date, Time"
Another example of such feature in Postman:
How can I implement thi... |
I am talking about these two testing strategies :
Have a pyramid of tests (with many more unit tests than high-level tests), because high level tests are harder to maintain and slower (see also : https://blog.octo.com/the-test-pyramid-in-practice-1-5/)
vs
Test behaviors (high level tests), not implementation details... |
There are several questions related to presence field tracking of scalar fields in protobuf 3, but I didn't find any with generic default approach recommendation.
It may be useful to be able to track field presence in protobuf message. I see at least those cases, where it may be useful:
API usage simplicity. In this c... |
I'm confused about the meaning of API, specially in the context of REST. I'm thinking of one example.
My company creates an application that runs on a server (the "backend"). (JavaScript in Node.js)
To use it, my company also creates a user interface that runs on the browser of the client's computer (the "frontend").(R... |
Let's say we want to return a paginated list of document id that a user can view. In DB, we have:
doc_id
user_id
ABC
user_1
def
user_1
...
...
We use an external authorization service, so we can query if the user has view permission on specific doc_id, by using doc_id and user_id
<doc_id>::<user_id>::vi... |
I have a large (>1,000 LOC) Python ETL script - call it fetch_and_transform_data.py - that fetches data from a remote database, appends the raw data to a local table, does some transformations and appends the transformed data to another local table. Currently the fetch_and_transform_data module has a class with a main ... |
Sometimes we have to use multiple databases in one project
with the intentions of:
Denormalizing data or read models
Using the advantages of that database (technology)
There has been a lot of talk about the 1st case, but I haven't found anything about the 2nd case
Example 1:
To solve the complexities of access in a... |
CreateCustomer is clearly a mutation.
GetCustomer is clearly a query.
But what would be some CalculateProductPriceForThisAmazingCustomer?
Is it a query, because no price is stored (no data written), it is just calculated?
Or is it a mutation, because price was not stored anywhere previously, we are "creating" it in mem... |
I have application X that can create "topics" where users can do operations, I want each "topic" to be a new "queue", so every "topic" operations are independent from another. I can create new queue on the moment of "topic" creation from this application.
What is the optimal solution for the receiving application Y - i... |
About tests:
I have the following view on nomenclature:
Unit tests are the kind of testes where you have a function
ExtractBacon, where there is a function with an entry parameter Pig
and a return of type Bacon. What you test, is for the Pig with A, you
expect a Bacon with feature X=1 and Y=2. And you assert that what... |
An application has a multifactor login.
The user logs in with its e-mail and password, and then the following screen asks for a one time password received via e-mail or generated by a mobile app.
In that second screen there's also a link called "cancel login" that points to, for example /login/cancel. The user can clic... |
In my company, we are would like to recommend OpenAPI and using the design first approach to API development. We would also like to use the OpenAPI Generator to generated server stubs and DTOs from OpenAPI specs.
We are using the OpenAPI Generator maven plugin as our projects are Java based.
It seems though that the au... |
I have a web service. When a user makes a request, traefik first redirects it to my users micro service, to pass through an authentication function.
The token (or username+password, on first request) is checked against my users database. If found, the authentication sets the context and passes on the request. If not fo... |
I've seen a ton of examples of how to do DI, and the example always shows two dependencies. But what about when you have 50 or 100 dependencies (or more) in a large-ish application? The Program.cs file will get unwieldy with 100+ lines of builder.Services.AddScoped<IDependency1, Dependency1>();, not to mention problems... |
NOTE: Please don't respond by telling me that I probably don't understand what I am looking at. You can't possibly know that and it's wrong. Just don't answer if that's all you have to say.
I'm looking for a term akin to the "N+1 problem" but for a different issue.
I know that the term 'anti-pattern' may raise some h... |
Sometimes, I have a hard time deciding between two good code traits: debuggability and readability. The snippets below are an oversimplification, but they illustrate my pain.
Example 1:
if(isSomethingThere(somethingParam)
|| isTheOtherThingThere(otherParam)
|| isWhatever(whatever))
{
// some logic
}
Example 2:
b... |
We build up a microservice architecture which is called from above by a REACT SPA. All is deployed in the AWS Cloud, that is to say in an AWS EKS (K8S). We have at most 600 users in parallel.
Do you see an urgency to apply primarily a sync over async (via messaging) communication in such a high performant K8S environme... |
In the picture below there are some regions which are very bright (i.e. more white). Some bright regions are wide and some are narrow or thin. The red box covers one such wide bright spot, and blue box covers one thin bright spot. Thin bright spots are called edges and wide bright spots are called hot-spots.
I want to ... |
I'm facing a problem with handling different timezones in MySQL. I have looked into similar questions that were previously raised, but I couldn't find a proper answer.
The issue I'm encountering is as follows: I have multiple microservices and a MySQL server. For instance, my mobile application runs in the timezone "+0... |
Context: I am building a site that is essentially just a UI for eBird's API.
My first question is about naming. Wikipedia defines a client as "a piece of computer hardware or software that accesses a service made available by a server as part of the client–server model of computer networks." So by this definition, my s... |
I have many abstract classes that describe many abstract ideas and objects. These classes have many complex relationships with each other, and I realize that while writing code with some of the derived classes can get confusing. For example, it isn't completely clear at first glance if class C is derived from class A, ... |
I have some classes like so
class User{
Preferences
List<Participants>
BlueFontParticipants
PropertyThatComputesFromAListOfParticipants<Participants>
}
class Preferences{
PrefersBlueFont //really only applicable if you have a bluefontparticipant
PlayAudioAutomatically //only applicable if you h... |
I have a Delphi software application that uses non standard port nnnnn to nnnnn+50 with the FTPS protocol TLS 1.3
Until now I was suggesting my customers that the Server Side application needs to have
Public Static IP
Physical Firewall
Port Forwarding
No sharing of any Drives/Folders
Machine to be used exclusively for... |
I've just started learning to use this architecture and I'm trying to build a simple project management app. The App works such that a user after registering, creates a workspace. This Workspace is made to contain the administrator (The user who creates the workspace) and other users he invites via email. Every user is... |
I asked this questions on StackOverflow but it's definitely a bit too broad.
Even for this website, although the question is about software design, it might not be enough "focused".
I am working on a family of java 8 applications where a bit of refactoring is definitely overdue.
Right now I'm focusing on the error hand... |
Most of the articles I read state that the average number of defects per KLOC is 10-15 (most of the data seems to come from Microsoft). How does that number correlate with code coverage?
If my project has for example 80% code coverage would that translate into 5x less defects per KLOC ? If not, how would I focus testin... |
Originally posted here, moved to code review, redirected from code review back here as there is no code to review. I think the question is enough abstract to be asked here.
I have a mono repo with multiple nano services integrated with Kafka. The system data vesel is JsonMessage. There Are multiple formats Of json mess... |
My company* wants
to move from using long-running feature branching (~up to a few weeks) to continuous integration with trunk-based development, and
to break up our monolith into microservices.
We're unsure which to do first to best achieve both: 1) moving to trunk-based continuous delivery, albeit dealing with a sev... |
I need to build a data pipeline to populate a database from various files. This is a common scenario. However, I want to have expert opinions for implementing a pipeline that is robust, modular and resilient to future variations.
There are several clients
Each client shares daily data in different formats:
Excel work... |
We have a microservices application and our User management service is the source of truth for user's first and last name. But we also need these in the Reporting service, where we generate reports for the users that should contain their first/last name. Our Billing service also needs these names when sending claims to... |
SQL-92 says:
16)For the <exact numeric type>s DECIMAL and NUMERIC:
a) The maximum value of <precision> is implementation-defined.
<precision> shall not be greater than this value.
And yet it's 38 in Oracle, MS SQL Server, PostgreSQL, Snowflake, Teradata. Only MySQL and DB2 are diffe... |
In most descriptions of unit testing as a methodology there's an idea of unit tests being as independent of implementation as possible. This is easy to understand and implement in cases when code does some actual computing, and may be represented as a math formula to certain degree. When input is correlated to output.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.