instruction stringlengths 34 36.1k |
|---|
Say I have an application/service A. This application will continuously take in some input X, process it and store it in some database T. This process is quite resource intensive.
Now you also wish, as a user, to have access to the data in T so you need endpoints for retrieving and updating this data from the database.... |
What is the "best way" to implement something like this:
I have a list of steps that will be iterated and ran for an IContext instance. But, some steps will only apply to a specific instance derived from IContext, while other steps can apply to any instance implementing IContext.
I could create an abstract class Contex... |
I am reading “Building Event Driven Microservices”.
It states a requirement of the event broker is:
Infinite retention: Event streams must be able to retain events for an infinite period of time. This property is foundational for maintaining state in an event stream.
However this does not seem to be standardly availa... |
I am working on an application right now, which is fully paginated. The application basically providers the client (a browser SPA) with a list of all data items other users added, and it does that in chunks of 50. So when entering the page, the user gets to see 50 items, and once scrolled to the bottom, 50 more items a... |
For a school project, I need to make a DFD for an educational game, where both students and teachers need to be able to view the game's leaderboard.
Currently in my diagram, "Student" and "Teacher" are seperate external entities, "View leaderboard" is a process, and the leaderboard data is stored in a data store called... |
I am looking for a way to show duplicate data-stores in data-flow diagrams (DFD). With "duplicate" I mean multiple occurrences of the same symbol to avoid too many crossing flows.
In Gane & Sarson's DFD notation, duplicate data-stores are indicated by adding an extra vertical line to the left of the open ended data-st... |
Suppose we need to ensure that a sequence of database operations - currently implemented as A followed by B followed by C - executes either all together, or not at all. We can achieve this using a database transaction - but how can we write an automated test to verify that this atomicity property is satisfied, which is... |
Imagine we have microservice A and B. A has and endpoint in its rest API that will execute some CPU-bound operations and will formulate the return afterwards based on the actual state of some objects. This operation is actually requested for a bunch of other microservices. I can't see how I could decouple microservice ... |
We currently have a hotel and a restaurant management software (named Top-Sys and Pointex CHR), and they are working completely without server software.
These are designed to be installed locally but their databases are located in shared folders, currently installed on a Synology NAS and shared over smb. Now, I'm devel... |
I have an application made of several microservices with independent databases
So let's consider 2 microservices
Users and Documents
The users microservice manages the users and handles everything related to them and the documents microservice contains the document info, properties, file ....
Now each document belongs ... |
I have a class which aggregates some temporal data from a database and provides a bunch of methods to query said data. It looks like this:
public class InfoProvider
{
public IEnumerable<Contract> GetContracts() => GetContracts(DateTime.Today);
public IEnumerable<Contract> GetContracts(DateTime at) => GetContrac... |
I want to understand the difference between Kruchten's Logical and Development view when using a microservice architecture.
Krutchen describes the software architecture model 4+1 model with four different views.
Logical
The logical architecture primarily supports the functional
requirements — what the system should p... |
I have an application with an external configuration. Basically, there are a few basic environment variables, then the rest of the application's configuration gets pulled from AWS S3, is checked for validity, and then cached locally.
Given this is a PHP app, I can easily pass a query parameter to a page (ie. ?refresh_c... |
What is a good way to mix non-dev content, like FAQ text or internationalization text, into a development pipeline?
For example, suppose you have an app that is being coded by software engineers, but it provides a lot of text to the user and that text is authored by non-engineers. The text could be a FAQ that is writte... |
I've inherited some research code where there's already a fair amount of code duplication: on several occasions, the original author duplicated a file and changed minor things to calculate a variation of the original problem. I'm tasked with making modifications to calculate a different variation. Following the style t... |
Java source code is compiled into bytecode for the JVM. But, how does JVM convert bytecode into machine code? Does it re-compile bytecode into machine code and then run it? Or does it simply just run the bytecode, directly?
|
I've read the Fielding's thesis that defines the REST architectural style and noticed that the defined style appears to significantly conflicts with the so called "archetype controller", that a definition can be found in many places, like here.
The first thing to highlight here is that the "resources archetypes" is not... |
Situation:
VB.NET WinForms application, using the WinForms as a presentation layer project. Another class library project containing the business layer, in the form of CQS and Service classes, plus a data access layer.
Summary:
I'm attempting to follow CQS for new features being added to the legacy application. Conside... |
In (the most widely used) programming languages there is a distinction between "statements" (function or loops bodies, assignments... basically "the stuff that ends with a ';'") and "expression" (simple calculations, function / method invocation ... "the stuff you can assign to a variable"),
so far so good.
When I use ... |
I am trying to assess which of Apache Kafka, RabbitMQ, and Apache Pulsar will meet my throughput requirements for a system with multiple producers and multiple consumers for a single topic.
How can throughput even be compared if systems can be scaled to whatever throughput is needed? In benchmark tests I saw that Rabbi... |
i have as a mechanical engineering student in my practice semester to create a database that includes about 100k+ paths to images in our network. Every, lets say week, i have to synchronize all changes in the network with my DB. So i have to delete Data from the DB if someone deleted a Image in the network or i have to... |
I am building an application with ASP.NET Core 5.0 following DDD and the CQRS pattern. I internationalize on the presentational layer but when I send emails I send them in the application layer via an email sender service. This service doesnt know anything about internationalization because I have that capsuled on the ... |
The "VDA Automotive SPICE Guidelines" (excerpts: https://vda-qmc.de/fileadmin/redakteur/Software/Automotive_SPICE/Veroeffentlichungen/VDA_Guideline_Rules_and_Recommendations_2017.xlsx) tells to lower the score "If the verification results (…) contain only a pure passed/failed information without a supporting verificati... |
I'm honestly not even sure how to go about how to ask what I'm looking for/need. lol.
I'm currently using Sql Server for my database and the 'new' .net 5. There are multiple pricing tables that each have their own purpose for pricing lineitems on an order. These pricings get updated quite often, ranging from either mon... |
There are plenty of articles about parsing full Markdown/CommonMark/etc, but I'm interested only in a specific limited subset, so I'm wondering if a better approach is available to me, and would much appreciate any tips or advice.
I only need to support:
*italic* / _italic_
**bold** / **bold**
[link text](url)
`inline... |
Checkout this HTML using the attribute action, method and target from <form></form> tag:
<form action="/action_page.php" method="get" target="_blank">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<button type="submit"></button>
</form>
Is a good practice using form t... |
In the past I've mainly worked with monorepos, specifically a Vue.js app that was served by a rails backend.
Setting up E2E/integration tests in the CI was simple, because all the required parts were kept in one place anyway and the testing tools provided by rails did most of the heavy lifting. Now I'm working on a pol... |
My group in school is tasked with creating an application of our own choosing which follows good object oriented design principles. The group has chosen to make a tower defense game with help of libGDX (a Java game framework) and we are currently debating whether the update loop of the game (code that is executed each ... |
I'm developing an intranet application and I'm trying to use some concepts from Domain Driven Design (DDD) and Command and Query Responsibility Segregation (CQRS) in .NET Core, with EFCore.
But, to avoid weird exceptions from the API, on every Command and on every Query I'm first checking if the database is online (usi... |
I couldn't decide if the question belongs on Stack Overflow, but I went with SE Stack Exchange for the higher quality, broader answers. Bare with me.
Examples are in Node but I guess applies to a multitude of languages
I'm big on writing pure code without side effects. It's easy to reason about and to test. Yet, the fo... |
I have an application that is receiving a live stream of files, I am using active MQ for listening to the file arrival in s3. As soon as the file arrives in s3 my application downloads the file and starts processing for it.
Now, I require to pause the processing for certain types of files (*Xyz*.txt, pause window is 8 ... |
Context
In many GUI frameworks, it is very common that widgets are placed in a container to arrange them visually in a window. For example, in Gtkmm, a window with a label and a button (side by side) will look like this:
int main(int argc, char *argv[])
{
auto app = Gtk::Application::create(argc, argv, "no.abstract... |
I am building a database, and have implemented a transaction log system to ensure that writes are atomic, idempotent & consistent.
When a transaction is 'committed' it is appended to a log file before it is considered 'committed'. The log file is eventually persisted to the disk file, once it is marked as "full" during... |
Let's use https://github.com/dotnet-architecture/eShopOnContainers as an example. There are CatalogService, BasketService and there is ApiGateway. In api gateway in BasketController there is AddItemToBasket handler (https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/src/ApiGateways/Web.Bff.Shopping/aggre... |
I am developing a desktop application that utilises Tensorflow. The aim of the application is to let users easily train a given model and use it for inference within the app. I want to support training and inference via the GPU, if available on the end-user's machine.
The primary issue appears to be setting up Nvidia d... |
I'm working on a microservice application and I need to describe the complete execution graph of a specific event being published, where each node in the graph is a specific microservice subscription to this first event.
This diagram should be able to describe new events that are eventually published in response of thi... |
I have an app written using MVVM and RxSwift.
For navigation I'm using coordinator
What is the best way to store user's credentials and pass them to Network Layer.
I don't want to sore them in DB or keychain. I want them to persist in memory while app is running. Also wanted to omit having singleton with Credentials.
|
We have been in the process of scaling up my companies infrastructure, we have graduated from single servers and moved everything off to scalable AWS Ec2 servers that auto scale, there is one little item that has not scaled well though
Before, we had the server OS firing off a script that sent out emails via a cron tas... |
I've seen this problem in a few different contexts now but I'm not sure what it's called or how to think about it.
Suppose I have a service, AccountService, that serves accounts from a database, e.g.
account.id
account.fname
account.lname
account.email
account.business_address
account.tax_id
account.invoiced
...and so... |
We are a wholesale marketplace and we have three main products in our startup. The products are:
1- the marketplace app that allows customers to view products and purchase online.
2- the seller app that allows the sellers to list their products and see review incoming orders.
3- the courier app that allows drivers to r... |
In the announcement of Linux 5.15-rc1 Linus said:
At only just over 10k non-merge commits, this is in fact the smallest rc1 we have had in the 5.x series.
What is a non-merge commit? What's the opposite of a non-merge commit?
|
These are my class designs:
I also have Controllers where I can create table, create users add users to table, deal hands simulate user bets using PostMan (Above classes are game engine classes, I did not share controllers in spring boot. It is all API)
Somehow, I am not able to stitch them all together as a complete ... |
I am designing a workflow, and am trying to avoid parallel deployments of the same service. Thus I am looking to have one service that handles both interactive and batch traffic. My main concern is how to ensure that my service can horizontally scale fast enough, with large batch runs, and not interfere with the inte... |
Here's an analogy of our concrete problem to demonstrate the issue at hand.
We need to manufacture cars, with either petrol or diesel related parts (the parts can be the engine and the exhaust - e.g. different requirements for exhaust for diesel engines).
Engine
+ engineCapacity: Integer
DieselEngine: Engine
PetrolEn... |
I'm deploying a serverless/lambda-based HTTP API via AWS API Gateway. My goal is to minimize latency in handling requests. I am considering two architectures, and I'm wondering which best meets this goal. Here are the options:
Deploy one edge-optimized API Gateway application. AWS will then create a CloudFront distrib... |
"Designing Google Docs" is a popular system design interview question, and there are plenty of articles on it on the web. However, those mostly touch on merging changes, but don't explain how to swiftly notify a user of a change made by another user in the same document. Supposedly, for collaborative editing getting no... |
Its not exactly my use case (would take too long too explain), but imagine a task management application where tasks for employees are displayed in a list along with some information about that task. These are some of the Task types.
Simple Note like "take out the trash" or "refill fridge"
Customer Support Ticket for ... |
In our ASP.NET Core application, we have many APIs which are calling public method from the service class. Service class is implementing an Interface. Each service method (depending upon complexity and requirement) may call any number of internal or private or helper methods. While each of these internal/private/or hel... |
I am unsure where/how to specify the behavior of a mock in a test scenario when using the Given-When-Then syntax.
It seems to me both Given and When could be correct.
Consider the following example:
I want to test the control panel for a car.
This panel has a start button for the engine and a LED that shows the engine... |
Understanding that it is less load on the server to not have to parse HTML, when does it work the other way, as far as server performance.
The majority of my Web sites are database-driven - often the same cosmetic structure with entirely different information. Separating the HTML, which is minimal compared to the PHP i... |
I have an event pubblished in a bus(rabbit) and two application that are subscribed to this Event.
public class CreationEvent
{
public int CreationEventID {get; set; }
... other properties
}
Application A and Application B are subscribed to this event, and listen from a rabbit queue.
Application A save the pr... |
Note: I am not sure of the correct terminology for what I am describing, so if you have suggestions for a better title please feel free to edit it.
"Favor composition over inheritance" is generally a good rule to follow, but there are some cases where inheritance is a must, like in the following case:
Node a = ...
Node... |
about those objects and arraylists inside the classes, derived from one-to-many relationships, using the ORM techniques, what's the best way to deal with them at the time of setters and validation methods? for instance: for me to save PurchaseItem inside Purchase, how and when do I chech that PurchaseItem is valid? wha... |
At the moment, the application I work on relies on an ISettingsService which is injected via the constructor; classic dependency injection. As time goes and the application's capabilities (understand complexities) build-up, the quantity and diversity of the settings exposed by the service have grown.
Some classes requi... |
According to my experience, there are two types of problems:
For some problems I have been able to use some quick/dirty workarounds. Users are happy. Since the outcome quality has been acceptable for them.
For some problems, no matter what I did with quick/dirty workarounds, I couldn't reach an acceptable quality.
A... |
I work as a Website developer. We use a framework for building the backend of our sites.
This framework recently released a new major version with lots of breaking changes. We have some sites using the old and many sites using the new major version.
I am currently tasked with writing a module that needs to work with bo... |
As we know HTTP codes are used in HTTP response. Usually with this code we can have an idea about what happened. For example if I make a get request and I obtain a 404 I can figure out that the resource that I requested doesn't exist on the server side.
Suppose that I want to encode the status of an object in the DB. F... |
As I am creating different database connections on the basis of database credentials (i.e. JSON or POJO with all the credentials required to create a DB connection).
e.g.
Imagine a Map containing these (UUID and Connection)
{
(UUID1, connection1)
(UUID2, connection2)
(UUID3, connection3)
(UUID4, connection4)
}
For... |
I have a Node.js micro-service architecture-based back-end. Services communicate with each other via PubSub. E.g. upon a request to service A, service A messages either service B or service C via PubSub. B and C can message other services and so on.
What exactly is to happen is for the user to decide. The problem is: I... |
I have a question about where should I get the info required for making an api call.
Let's say I have this :
Presenter --> Use Case --> DataSource --> Api
Ok now to do my api call, I need a userId, languagueCode, etc.. for instance, and I have use-case to get that info, also a datasource . My question is, where should ... |
I need to consume several APIs concurrently. In order to do that I decided to containerize each API client code and manage them using Kubernetes. Some of those APIs need to be "walked". They basically have this one endpoint from which you get more endpoints and so on. These "trees" are not that deep, but are constantly... |
We are using microservices(read a lot of GIT repositories) and our department has 90+ java developers. All of them write code which mean there are a lot of PR`s every day. We are using BitBucket and Also we have a self written bot that listen BB events and can sends a PR review notification to slack.
Notify every devel... |
Our team has started to use AWS and one of our projects will require storing approval statuses of various recommendations in a table.
There are various things that identify a single recommendation, let's say they're : State, ApplicationDate, LocationID, and Phase. And then a bunch of attributes corresponding to the rec... |
I'm having trouble with modeling the association between movies and DVD disks - it's my homework for university.
So I have a "Film" class and a "Disk" class.
One film can be on multiple disks (at least one)
Each disk can have only one film
Is my diagram correct?
Perhaps the second option is beeter?
|
I have an app with many individualistic features which behavior is controlled by settings.
Let's say these are a few utility services with the following settings that are historically stored in separate JSON files.
Property values can be bools, integers, doubles, and also some complex types such as lists of JSON object... |
I want to know is if we should perform authentication at the API gateway, at the individual service, or both.
Let's frame this question and descussion in the context of new development. Specifically, in my current scenario we're rewriting our software to be a SaaS offering in the cloud using current technologies.
I don... |
I have a database full of ModelNumbers that I want a user to be able to search for. The tricky part is that some of the model numbers have lots of funny characters including:
* - Alphanumeric wildcard
# - Numeric wildcard
(AB,CD) - List of options
So for example model number 1234#*(AB,CD)
The following searches shoul... |
Considering this question and the most upvoted answer, and his specific example of
public static final int THREE = 3;
might it make sense to allow this sort of usage if we added units to the declaration? I mean like this:
public static final int THREE_MINUTES = 3;
or maybe this:
public static final int THREE_GALLONS... |
I am developing a REST API and I would like to allow the users to remove a field of the object through PATCH.
My idea was to use a null field on the PATCH body as a signal to remove this field of the object. Is that a good approach? Is there a better way to allow a user to remove a field from an object using a REST API... |
One of the alternatives for managing common data between microservices is replicating the data needed by multiple services in their own databases but there are large data sets that we do not want to replicate.
I'm using as an example the Food Ordering Application used in the book Microservices Patterns by Chris Richard... |
My question is about DDD, the Infrastructure layer, it's relation to the Domain, and specifically how we can take advantage of the ability to "swap out" one persistence implementation for another.
I have a .NET5 solution designed using Onion Architecture, that follows all of your basic guidelines:
A Domain layer with ... |
Suppose user A creates a private resource at, for example, /books/somebooktitle
If user B attempts to access the resource at /books/somebooktitle what code should be returned?
HTTP403: Permission denied seems obvious BUT, does this not leak information to user B that someone has created a book and named that book with ... |
Where do you like to draw the line for modeling a single value as a Value Object v.s. a primitive? For example if I have an internal order number and a customer order number, would you model them both as Value Objects even if they only contain a single string attribute and no special validation? I see the benefit it ad... |
I'm looking at Segment's documentation right now and they have something called a "write key" that you include in your client-side JavaScript in order to send analytics data to the backend. If I include Segment in my website, what stops one of my customers from copying my write key and sending spoofed "analytics" data ... |
I am learning about various causes that lead to software failures. So far, two prominent causes of failures seem to be managerial and technical. An example of the resources I have looked at is this file. But I am looking for a more specific explanation.
Could you please give me a short, comprehensive explanation about ... |
You have the backend for a web application. I'd like to keep this is as disconnected from specific programming lanuages as possible, but if necessary, assume we're talking about PHP.
You need to write code that generates or fills documents with data from a database, so that these documents can be stored as files. These... |
Not sure if this is the correct forum for this question - but I could really use some advice.
I need to design a system (within certain constraints).
The system must implement the following logic:
A producer will drop JSON messages on a Kafka topic for me to consume. Each message will contain an image (something like ... |
G´Day,
So I am making this website out of basic HTML. I wanted to add a Moderator/Administrator script for it and was wondering if there was any way I could Create a script myself easily. (Keep in mind that I only took one Web Design class and im still in High School.)
I did have a look at How can I design an efficient... |
I'm struggling to understand how, for example, the IETF is a "standards organization" but the standards are "voluntary" meaning there is no civil or criminal penalties for not following the standards.
I don't understand how those are standards. Why would anyone follow them?
|
I have been searching about this topic for a few days and have not yet found anything on books, courses or tutorials.
What is a way to make data pipelines more scalable, that doesn't involve NoSql or major investments like hadoop clusters?
Most of our pipelines are currently made with Python. They're pretty simple in n... |
I have a checkout process that 1) creates a user account in Stripe and my database, 2) creates a paymentMethod in Stripe and logs the last4 in the database, 3) creates the subscription in Stripe and logs the subscription to database, 4) sends welcome email and creates a job record in the database to build the service f... |
In a design book I was reading they describe a method to determine a database sharding scheme by taking the hash (MD5, SHA1, whatever) of a userid (integers or uuids) and then (whether encoded or not) doing mod shard number.
So it looks like this: Hash(userid) % number_of_shards.
The output of the hash function includ... |
My bot currently listens to new messages coming in, and if a message contains a keyword (different from a command) it will automatically log information about who posted that unique key into a database. If another person in that same server posted the same YT video, the bot would flag it as a repost (and reference the ... |
Note: Controller here refers to one from MVCs
Bear with me, I know these are seemingly unrelated. However, I'm inclined to think both are analogous to each other being that they're means to the same end (i.e. safe product release).
Background: you want to safely push new updates without breaking existing product. Assum... |
I have a $c variable that is calculated at the beginning of the request. After calculating this several nested methods use it as a part of their job. Is it better that I pass down the $c variable to every method or store it based on the request (cache it maybe?) and use the stored value in each method to get the value ... |
At my current workplace there are some projects that when preparing a release will
backup the current RELEASE branch by making a branch from it with the current date (this isnt technically required, so this is optional. It does happen more often but its not 100% of the time)
delete the current RELEASE branch
take the ... |
I'm trying to design a system that inject configuration of each component into each class.
project structure:
|features
--|component-a
component-a.service.js
component-a.config.json
--|component-b
component-b.service.js
component-b.config.json
--|component-c
component-... |
I want to know how variables are stored in JavaScript (what I mean is, how JavaScript stores the type and the value of the variable and stuff like that).
But I was only able to find a tutorial about how the first version of JavaScript stores variables. Do newer versions of JavaScript stores variables in the same way as... |
I am working on a course design and I'm preparing the project that the students will have to work on all along the course.
Each student will create a GIT repository a the beginning of the course and they will add files and modify them to add features as they learn new things. It has various milestones that will happen ... |
If you wish to perform the same action using different parameters, you can either make differently named functions:
public Apple findAppleById(long id){
return repo.findById(id);
}
public Apple findAppleByCultivar(String cultivar){
return repo.findByCultivar(cultivar);
}
Or you can overload a function and make... |
I want a configuration file for a .NET program.
This file is to configure pairs of regular expressions.
The regular expressions belong within a hierarchy of sections.
Section1
SubsectionA
regular expression
regular expression
SubsectionB
regular expression
regular expression
Sect... |
Well in a page in our spa application we need to request some dynamic data from the server. Besides this data for display purposes we also need to request explanations of the columns from the data (each set of data might have different columns which are not static).
Normally in any application those are two distinct th... |
I have a Java library which is deployed automatically to Maven central. Right now this library has Java-1.8 target SDK, I want to continue releasing source code with this target and add new target Java-17 with Java module support. Source code will be compatible with Java-1.8 versions, so both releases will be built fro... |
I'm writing an application in C#. I'm facing an InvalidConstraintException, but from that Exception, I seem not to be able to access the Constraint, causing the Exception. That specific question is currently being handled on StackOverflow.
Just out of curiosity, I've written this piece of code (don't laugh):
int a = 2;... |
C#'s primary error handling mechanism are exceptions and try pattern.
We don't have access to discriminated unions yet like in case of F# and Rust Option<T> and Result<T, E> types.
The official Microsoft guidelines mention that exceptions should be avoided for errors that can happen often.
The try pattern works only fo... |
Let's say that I have a service like that takes in some text, classifies it, and then outputs the classification. The critical path between entry and classifier is as follows:
Query -> QueryPreprocessor -> ML Model
Now, I've obtained some ground truth on a random set of queries, and I want to retune the classifier base... |
I'm working in a microservice application which has some level of coupling between the microservices (some of them talk with each other via rest api - I know it is bad, but it is what it is; also I think this question would still be the same if we changed this microservice intercommunication problem with the normal fro... |
Is it under the rules of REST to return a different model of 'order' if someone call:
/me/orders/222
Return values:
- OrderId
- Price
or
/customers/111/orders/222
Return values:
- OrderId
- Price
- Tags
- Risk
- Comment
Maybe the model of 'order' should always be the same instead of different endpoints? Or it can d... |
I recently joined a new company. After working on some projects I noticed a pattern. Every project contains a lot of static classes. A lot of static Helper classes. ApiHelper JsonHelper UmbracoHelper ContextHelper DbContextHelper. Etcetera.
Now I know that this is not a good sign, and I tried to explain. They really wa... |
Hello im about to create dasbord for my website..
Dashboard will have multiple subpages like users, posts, roles etc..
I was thinking i would use only one rest api endpoint for those resources like
/admin/{users}
/admin/{projects}
/admin/{roles}
and create enum for each of those which will be used later on to query dat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.