instruction stringlengths 34 36.1k |
|---|
As a consultant working for multiple companies that are using maven multi modules I have made the same discovery with all of them that I find strange. Lets say they want to build a webapp for a hospital that manages staff and patients. Assume that they are separate domains. The project would look like this:
hospital
... |
I am developing an API backend using ASP.NET Core Minimal API (.NET 7) with Entity Framework Core, HotChocolate (for GraphQL), and a Microsoft SQL Server database. I've encountered a specific challenge regarding data mutations and would appreciate any guidance or suggestions.
Problem:
In my application, users can submi... |
I am trying to design a system and bounded contexts.
I have 3 microservices: Security, ProductsCatalog and Customers.
Each microservice own its database.
Security is a cross cutting concern used in other 2 microservices.
Question:
How to implement a search that depends on Security microservice?
For example, there is a ... |
Serialization and deserialization in .NET applications can be achieved using several libraries, e.g.
Newtonsoft.Json
System.Text.Json
Assuming I'm developing a new application where I want to use Newtonsoft.Json but I want to keep the flexibility to switch to System.Text.Json (or another library) at a later point in ... |
I've been wondering about code expressiveness vs. conciseness lately. What I mean by that is that a lot of modern programming languages offer features to express statements in a very short manner, which is cool, but I feel like it can also make it hard to read sometimes. At the same time, working in a team with others ... |
I'm not sure how common of a scenario this is, but what are some approaches to creating associated entities before you have the actual main entity they're supposed to be linked to? (basically having separate endpoints for the associated & main entity creation, with the associated entities having to be executed first, a... |
I know you can't inherit static methods, and it seems the consensus is that if you feel like you need to, you're doing something wrong.
However, I don't know what the alternative is in my case. Please see the abstract example below:
public abstract class A
{
protected static int defaultX;
public int x = def... |
Client sends request to deduct his account balance for registering with a service.
balance=balance-fee
Server takes a lot of time to process the request.
Since server was taking lot of time, client is notified by a middleman between client and server (the one who's negotiating with both client and server), "Timeout"... |
I'm writing a program in Java where I need to represent the position, scale, and other 3-dimensional properties of objects in a world using vectors.
I can use either of these two approaches:
Represent vectors as an array of doubles with 3 elements (procedural approach)
Represent vectors using a dedicated class, with d... |
I'm creating the UI for a "Point of Sale" type page. You can add orders, grouped orders, and custom items to your transaction, and it should display these in a list so you can see what you have selected.
They all have the same basic details:
Type
Description
Price
But they also have major differences. E.g.
Orders mu... |
We are finishing up a long (over 1 year) project to retire our monolith. We have been moving pieces of functionality into microservices guided by domain driven design.
So far we have been leaving the data model unchanged (we have been moving the tables owned by microservices into their own schemas). My question revol... |
In UML statecharts, an event may how zero or more "parameters" (i.e., additional data associated with the event). The classic example would be a key press event with a parameter containing the key that was pressed.
When designing state machines, I often come across the following scenario. An event with parameters is re... |
I have a repository which reads and writes to Firestore, and some tests to make sure data is sent and comes back in the correct way.
In order to test this I added a protected function which returns the root collection I'm working with, i.e. protected open fun users() = firestore.collection("users"), which is overridden... |
I came across a piece of legacy code, almost on the line of this (sample)
int foo() {
try {
int id = generateID();
if (isIDUsed(id)) throw id;
return id;
} catch (int id) {
std::cerr << "exception: Used Event ID Generated" << id << std::endl;
}
}
Here generateID() and isIDUs... |
What I mean by "closed class hierarchy" is a set of known base/derived classes used only for an implementation of something with no public API, i.e., the classes are not meant to be derived from by users. Another possible term might "non-extensible class hierarchy." But is there a proper term for this?
|
I am creating an API proxy that acts as a bridge between our frontend application and an AWS opensearch server. This proxy has additional features such as retries and timeouts.
One of the features I'm considering is request body validation. This API accepts 2 types of data: JSON when Content-Type is set to application/... |
If there are many tasks in the backlog and the product owner keeps adding them, some of the tasks become outdated and in practice they are never implemented by the team. Why don't we borrow some techniques that are used in thread scheduling to prevent thread starvation like:
aging – task's priority could be automatica... |
Let's say we have a group chat in a chat app build with websockets. And 3 users (A, B and C) chatting in that group.
All 3 users send their message one after another with an interval of 1 second (it looks like the time is in h:mm format but it doesn't matter in our case):
The server recieves those messages in the same... |
What are some commonly used strategies when it comes to divide software into modules, other than there should not be any cyclic dependency between any modules? Some ways I think of
Group everything that relates to a set of related classes into one module. I could have one module for 1d data (curves), and one module fo... |
In Python there are basically two ways to get a value from a dictionary:
dictionary["key"]
dictionary.get("key")
Is there any - maybe historical - reason for this behavior?
I sometimes stumble upon this while switching from JavaScript frontend development to Python backend development forgetting that dictionary["ke... |
Given that there are no checked exceptions in Kotlin, are Result types the correct way to indicate an exception occurred to the caller?
For example, I have the following function in my code:
suspend fun addUserToSignInHistory(user: User): Result<Unit> {
return try {
preferencesStore.edit { preferences ->
... |
This is a conceptual question about whether my specific use-case warrants the use of an asynchronous API.
Language: Python 3.11
Framework: FastAPI (ASGI)
I believe I am confused about what an asynchronous API really means, differentiated from asynchronous processing (multi-threading, event-loops, futures).
I am under t... |
Is it possible to design a distributed system to generate unique ids where there is a requirement that every generated id is guaranteed to be unique with no possibility of collision?
I didn't think that this was possible, given the fact that there is a finite number of ids which can fit into some structure. So for ins... |
Let's say you are running a query on your database.
In development and staging, where the amount of data is small, everything looks good.
Unit and integration tests are also fine and the logic is correct.
But when you get to production, where the database is much bigger, all of a sudden it turns out the query is not ef... |
A scenario often arises when attempting to make some existing code reusable. I introduce an interface to represent the commonality between some new feature I'm implementing and some existing functionality, but I become stuck when trying to access the existing concrete object.
Hopefully the following C# example can expl... |
I am designing my next project, which will do various domain-specific tasks, but all that will be controlled and used via a generic crud web app.
I have been professionally using Java with Spring for over 3 years now with the usual corporate applications, but these domain-specific tasks absolutely have to be done in Py... |
Merge Sort contains basically two important routines:
(i) split
(ii) merge.
I get the general idea. But I dont understand how this is more efficient than some random bad sort algorithm, like selection sort, for example. I kind understand the maths behind, I know why one is O(n*lg(n)) and the other is O(n²). I know lg32... |
We are a small software team with 6 members. We are working on different software projects in our company.
Before I joined the team no version control system was used. It was/is my task to reorganize the team and daily work to use a vcs (git with own Gitea server).
I'm now at that point where I have to find an appropri... |
Suppose I am developing a class which implements some high-level application logic. I want the "configuration"/"attributes" of this logic to be modifiable at run-time (with some default values). Some attributes may be read-only, others may be read-write.
I am going to use a custom "networking" layer as an example:
cl... |
I am writing a little C library for the Raspberry Pi for controlling 433MHz transmitters/receivers. While receiving data the whole application would block, so I decided to put this code into a separate thread and synchronize it with the main thread.
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <... |
I am looking for a concept that handles the needs of some data to be distributed in several environments (lets say we have dev, test, stage and prod).
Example:
We are setting up planned outages of banks we are using and share that information through REST API with our clients. Now banks basically do not provide sandbox... |
I have a class hierarchy of elements (more static) with different operations on them in another class hierarchy (more flexible). During execution there is exactly one element given, and based on it's type I want to perform a given operation. Instead of using some chained conditional like
if (elem instanceof ElementA) {... |
I'm trying to wrap my head around the ASP.NET Core Configuration system.
If I understand the default configuration correctly, non-prefixed environment variables will override appsettings.json entries.
For example, if
I have an appSettings.json file like this
{
"SmtpServer": "myserver.example.com"
}
and some other,... |
We have a huge amount of queries hitting our API that request a minor or major extract of some huge files lying around on our mounted hard drives. The data needs to be extracted from the files and processed before handing it back to the customer. My goal is to make this operation as blazingly fast as possible.
To piece... |
I want to collect a lot of files (file data + metadata) from local servers to a central server. Files are important, need to ensure that no files are lost
Local servers: implement a collector to collect files, 10k files/day/local server
Center servers:
minio storage: save files
ingestion service: provide an API to re... |
I am working for a medium-sized development and construction company and we are looking to upgrade our data and BI. Currently, all project data is managed via Excel (data, project management, and performance) while financials are captured via Acumatica. We are in the process of adopting a true project management system... |
I'm building a ToDo list while practicing in different patterns and adding more complexity to the project.
The problem which I'm currently facing is to how to apply (and later use, validate and enforce) different permissions for different classes of users (PM, Dev, Admin) and for different users of the same class.
I bu... |
I am looking to create an application which will have following architecture:
Site Database (Which will run on-prem or cloud). If multiple sites then multiple database instances for each site. In other words site is tenant.
Cloud central database -> which will retrieve and push all data from sites used for company rep... |
We are producing configuration files for a production system.
The configuration files have a dynamic set of variables. Optional values and other values that only need to exist based on other values.
The system using these configuration files are depending on the parameters coming in the expected order. The current syst... |
We have a internal system (lets call it system B) that responds "No" as a response to a request from external-facing system (lets call system A) based on elapse of 48 hours from earlier request if a token was not attached with the earlier request.
.
More Context:
We have an external system which receives requests from ... |
I'm building an application that allows the creation of users. These users can have profiles which define their permissions, as well as be given specific permissions.
Now I'm struggling on deciding where these permissions should be stored.
Of course they will be stored in a database, but when a user makes an API reques... |
Suppose an organization is developing an enterprise assistance and management platform with instant messaging, video conferencing, file cloud, online documentation, process approval, and more. The implementation of each function requires a complex technology, so how do you identify the subdomains of the platform? Or to... |
When domain modelling, should a valid constraint - or "natural" constraint - be modelled, even if there are no current business processes which rely on the constraint being asserted.
As an example:
A model contains a class Person, with sub-types Adult and Child. Child has the attributes father and mother, which are bot... |
Say I have the following stream:
List<Other> list = Stream
.of(
new MyObject(),
new MyObject()
)
.map(this::mapToOther)
.collect(toList())
;
So after this is executed, I will certainly get a list of Other in memory, but I wonder whether the source objects (i.e. MyObject) are still "ali... |
According to one definition of "interface segregation principle" that states currently in Two contradicting definitions of Interface Segregation Principle – which one is correct?, a client should not depend on the methods that it doesn't call at all, for example:
public interface IData{
public void create(String na... |
When I search the internet people said there was a 'study' that says developers write 10 lines of code per day come. Other results claim the mythical man month says it. I searched a digital copy of the book and didn't find it. Is this quote made up and went viral? If it was real what year/system/language/hardware were ... |
As new code is released to production, without enough direct access to production execution environments I rely only on user traffic for monitoring. However not all use cases get covered via user traffic. In such scenario what is the recommended approach to perform thorough full-fledged monitoring (including an automat... |
I work for a standards organization that publishes an exchange standard using XSD files.
These XSD files are being generated from a model with a tool, and now we want to change to a new tool.
Because these XSD's are part of a published standard, we can't change them functionally. Every XML that is valid for the old XSD... |
If I'm not mistaken, a major part of testing software is deploying and using it on your platform of choice. For critical system software such as UNIX utils, package managers, desktop environments/window managers, kernel modules, etc., how would a developer reliably test the software without bricking their development e... |
In Scrum we do a 2 week sprint and ship the features after the sprint. I have heard a lot of good things about TBD, but does it conflict with Scrum? Can anyone share your workflow if it is possible for me to switch from feature branch development workflow to TBD, when our development team is using Scrum?
|
I've been reading Refactoring (2nd) by Martin Fowler. In the first chapter, he shows an example of refactoring a function where he extracts other functions from it and places them inside that function as nested functions.
Specifically, starting from this function:
function statement(invoice, plays) {
let totalAmoun... |
We have a monolith C++ application and I consider doing some major refactorings. Since we're not completely ready to go full "microservices only" (maybe in about two years time), I want to structure the new architecture in a way so that the application can be run as both, a monolith with every microservice compiled to ... |
I've generally understood the SRP to roughly mean:
Each class should do one thing
Exactly what "one thing" is is up for debate.
However, I've recently seen claims that the entire SRP has been misunderstood and misquoted so severely that its meaning has changed. In fact, its original meaning was:
Each class should be... |
I have been asked to get involved with a Team that is currently having delivery issues for various reasons. During my review I came across an acceptance criteria on a user story;
If you call v1 of the API with Field1 it should fail with a
validation message
Field1 does not currently exist in v1 of the API, it is bein... |
I currently have a solution that requires leadership election for HA. It processes files as they arrive in an SFTP server, and Subscribe to an Active MQ feed; and therefore we don't want multiple running instances trying to act at the same time.
I am currently using Apache Zookeeper with the Curator library to manage l... |
Recently I read about ISP and wanted to implement it into my project. While implementing my design I think I found a flaw which violates LSP but I'm not sure.
Given I have a game project, in which players can walk around and use items. I currently use the interface Item as a base, which has the subclass Weapon, which h... |
To explain what I'm trying to accomplish.
Sometimes I visit website1.com, here I can download Linux ISOs but it's a bit annoying because it has a lot of ads, some of which are launched via javascript when I click the download button.
Sometimes I visit spotify.com but I hate green, so I'd like to modify all the images a... |
I am very new to Git and trying to follow along with Git Prodigy by Ebenezer Don to learn about it. I am at the (early) stage wherein I am learning about git revert.
I produce the text file prac.txt
This is a random text file
I then make this my first commit (git add . followed by git commit -m "First commit."), with ... |
I need to compare versions of a software. The requirement is that I need to know if a given version is older (smaller), same or newer (higher) than another one.
The version format is XX.X.XX where:
the first two digits are the major release. Major release can be between 01 and 99.
The next digit is the minor release a... |
I am working through an example of best-first search on a graph, and I'm having some trouble understanding exactly what the process should be.
This is the graph I have:
The heuristic values are in the boxes next to the applicable nodes. So from my understanding from the textbook I'm working through, calculating the pa... |
I need some guidance on how to send error responses to client from WebAPI controller for an update operation. I need to check if data is changed and if it has duplicate data. I have service class that does database operations.
Below is psuedo code
Approach 1
CustomerController.cs
public Task<IActionResult> UpdateCustom... |
I am looking for feedback on a design problem I encountered when processing batches of db entries. The issue at hand is efficiency and throughput of an application.
The application looks like this simple pseudo-code
// The loop is done outside of the application by some sort of orchestration
while (true){
void Mai... |
We have a GraphQL server which sends data to the front end client.
We have other tenants who will use our sever and host their code.
I want to create a system where they all can create any custom exceptions if they want or they can use some of the exceptions that the server can provide like DependencyFailure. Also erro... |
Assume we are designing a typical bank account management system. Customers can have one or more accounts. Customers can deposit cash, withdraw cash or transfer money to another account (and, of course, view the balance).
If all accounts are contained in the same bank, one could, for example, design a Customer class an... |
I'm working on an application which has a feature of syncing records between two environments. For example, a record A is created in environment A. After a user verifies it, the user can use the sync feature to transfer the record from environment A to B. The solution has been implemented using Django API and requests ... |
I am trying to learn a little Python by myself and came accross this book Data Structures and Algorithms Using Python Rance D. Necaise 2011 , to get some proper/formal/correct definitions/terminology in Computer Programming Languages.
First pages introduce Data Structure and Abstract Data Types , and at some point quot... |
I was reading Google's Architectural overview of Pub/Sub and I was curious how
publisher and subscription servers were connected.
From what I understand:
When a message is published, it is stored, and then once all subscriptions have acknowledged that message is deleted.
subscription servers can use a pull or push mod... |
I am told everywhere that entities are only to represent the data structure, then entities should be mapped to a model and then the model possibly to a DTO.
The other way is similar, DTO -> model -> entity.
It seems simple, but when it comes to working on a lot of highly nested entities, it is very tedious to track cha... |
Scenario:
A web application that wants to implement geographically high availability (HA), has multiple web servers in different cities around the globe. Each server is connected to a database in the same city. These databases are configured in an active-active DB cluster, meaning each database will handle its own read... |
I am currently developing a feature for my web application that tracks the amount of time a user spends on a specific page. Our backend is built with Django, and the frontend is using React and PostgreSQL as the database. I'm looking for advice on the best practices or approaches to implement this feature efficiently.
... |
Suppose I have an application where I can manage clients (just companies I offer my services to) and what services I offer for them. I also have the functionality to create timebookings, which means I can say "I did 3h of Service X for Client Y". The timebooking needs to know which employee did this. Now in the ubiquit... |
We have a release cycle about three to four weeks for a new release then a bug fix sprint to make the product stable, then new features sprint to kick off another round of release cycle.
What should I, as their developer manager, do during the bug fix sprint when my team members are busy in fixing bugs ?
I have tried s... |
According to Should we avoid custom objects as parameters?, for example, if I have an object to show:
public class Student{
public int _id;
public String name;
public int age;
public float score;
}
and I need to pass the information of the object to a window to show, passing the whole object as paramet... |
Prelude
Recently, I helped a friend of mine in coding him a problem for his university Algorithms course, where problems are submitted in Java. I sent him code with good O notation complexity, sequential memory accesses (as I thought) and etc, all the common in C++ world good practices, and kept hitting Time Limit Exce... |
I have an aggregate, let's call it Party. For a party, I can have many People which is an aggregate as well as they can exist on their own without the Party. But specifically for the Party , I want to keep track of how much Food was eaten by each person.
How can I model this? The Food cannot exist without the People at... |
Context: The software development company I work for develops an application which is released with SemVer versions. Typically customers use the last 2-3 minor releases, so for an example if the latest released version is 3.6 there is still a relevant user base using releases 3.5 and 3.4. For these versions, we guarant... |
Lets say you have a ItemView and a ItemModel.
Would it make sense to have a ItemWidget encapsulating those two, so code using ItemWidget don’t have to deal with ItemView and a ItemModel specifics?
What would you miss doing so?
|
I need assistance with the QueryBuilder that generates OData query. Following is my implementation and it approach has couple of issues
If user forgets to SetRootTable then it will cause serious issues.
Task.WhenAll since it is a single QueryBuilder instance and queries gets corrupted.
Please suggest alternatives t... |
I'm looking for a way in C# that finds all the possible combinations with constraints.
I've got a list of machines. The machines have capabilities and limitations. I also have a document that defines the starting material and end result.
The machine capabilities is a flag enum with cut, print, joint. Constraints are sp... |
I have little app that i plan to run behind load balancer, with up to 5-8 instances.
Inside the app has service, that needs to generate unique number that has up to 10 digits ( so 1-10 digits) each time user triggers the process.
There will be approximately 10-50k invocations of this function per month.
In non-distribu... |
I'm struggling to (integration) test a component that makes use of an infinite generator.
Background:
At a really high level, this component is essentially a "middleman" in a kafka workflow. It subscribes to a kafka topic, consumes messages, does some operations on the messages, and re-publishes them on a different top... |
I have been reading about clean architecture and following Domain-Driven Design. In all the examples I have found, the interfaces of the repository are defined in the domain.
However, it is in the application layer where the repository interface is injected, and the interface is implemented in the infrastructure layer.... |
I am a student and am currently programming an API in Python. Among other things, it is possible to register, log in, create a user profile with data, etc.
I would like to be able to store and retrieve sensor data as time-efficiently as possible. For example, the data from a light sensor. It should also be possible to ... |
I was assigned a task to change the communication mechanism between two parties, from Azure Event Hub to Azure Queue + Blob Storage.
On the way, I thought redesigning a bit the components to make it easier to understand what the repo does/what is going on.
We are talking about a Service Fabric Application, with a coupl... |
I have an event, let's say order.placed The payload consists of some general information about the order and 3 confidential fields. For example part of the message should only be visible to consumer A, part to consumer B and part to consumer C.
Does any pattern exist to handle this kind of requirement?
I considered enc... |
I know there are already some questions about replacing if else with polymorphism, for example:
Applying Replace Conditional with Composition in functional programming
Is it wrong to use any type of parameter to determine behavior?
Should conditional logic be always coded via type system where possible?
which the follo... |
Let's say that I have a class with a service that is going to be injected at runtime:
class Thing {
private magic: IMagic; // Magically injected service
public doStuff(){
// Do a lot of stuff
const value = this.magic.performFireworks()
// Do a lot of other stuff with `value`, eventuall... |
A test program should post a json object to a rest service OrderRequest and receives an OrderResponse. The test program should tests against the quality assurance stage (qa) and against the production stage (prod).
type Endpoint struct {
Login string
CheckOrder string
}
// https://go.dev/play/p/3vCgU2rA7iR... |
I'm not encountering any issue in prod or anything, I'm just reading about Kafka and I'm curious about this case.
As I understand,
A producer sends messages to the leader.
The replicas copy the messages and inform the leader about how far they have read up. Let's say I have sent 6 messages to the leader and the repli... |
I'm studying architecture patterns and I don't understand which type of scenario is more preferable to use clean architecture or hexagonal architecture. Is there something like that? For example, "If my application has a lot of business logic, is it better to use clean architecture than hexagonal architecture" or is th... |
Is trunk-based development (TBD) viable for development of software where versioning, compatibility, long term support and service level agreements (SLA) play a big role for business (e.g. libraries, frameworks, drivers, SDKs)?
Some context
I'm interested in TBD in context of different types of software projects. The p... |
I have a web app which authenticates the user using an external identity provider (Microsoft Entra with MSAL library).
This give us an access token to access our API.
After authentication (so, we already have the token), the user must select the company he wants to work with. The "company list" shows only those for whi... |
I've found that many codebases in large companies degrade over time, only adding new features and never improving the design of the codebase. Gradually, these codebases degrade to what is considered "that legacy system no one wants to work on".
However, I do know that one can refactor a code base: "improving design wit... |
I'm developing a data pipeline in Python. We receive a variety of different types of data set that we need to process (e.g. xml, json, csv and some Excel workbooks) - where processing involves parsing the data into a usable structure, some data cleaning, removing some sensitive info, and uploading the output to cloud s... |
I have a project where there is a primary, high-level, opaque struct with many functions that operate on it. Maybe I am simulating a CPU.
How might the corresponding source code be organized?
One way to organize the source is to put the entire interface in one ".h" file and the definitions for all the functions in a si... |
I'm working on a library of C++ wrappers/bindings, for another, C-ish, API.
The C'ish API has a "launch" function, which, among other things, takes a launch configuration structure (well, sort of, I'm simplifying things). Not every point in the space of values for this structure is valid. For example, it has a num_widg... |
I have an algorithm I am trying to implement that has steps 1 to 5. There are several different ways I could implement each step. Each calculation step is essentially just an astronomy calculation, and I could either depend on any one of the astronomy libraries or implement my own astronomy calculation.
My current desi... |
In the context of a software update system, suppose we have the following:
a.tar: an archive file containing an old version of an application
b-a.patch: a file containing the binary difference of the old a.tar and the new b.tar (from bsdiff)
Both files are present on the same system, and the authenticity and integrit... |
I am fairly new to MVVM. I am writing an application in which user creates a study for a physics simulation, inputs some data, runs the sim, and then views the results in graphs and tables. The application needs to have Save As / Open functionality to save the study into a single file and load it back after restarting ... |
I was tasked to create an API client library for our already existing API. I tried to research some ways how to approach this but couldn't find anything. Are there some best practices how to build such client library, or are there some already existing clients from which I can get some inspiration?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.