instruction stringlengths 34 36.1k |
|---|
Question about the 12 factor principles and, specifically, the dependencies step:
https://12factor.net/dependencies
From how I read this, the general idea is that you want code that doesn't rely on system wide packages (so centralized libraries following a DRY principle is what I gather) and those dependencies should b... |
So let's take the Facebook Messenger app for example. When you send a message it instantly gets sent to the other user you are writing to.I believe they use some kind of WebSockets to send these messages (correct me if I'm wrong). But when the other user closes the app, does he still receive the message? Does Messenger... |
I am trying to give examples of a use case and a scenario for a library management software system, I was reading this question: Difference between scenario and use-case and I got confused.
Namely, in the scenario section put the following:
A student looking for supplementary material about a subject comes
asking for... |
I'm on the way to build a modular Java web project with some pluggable modules - like Jira and Confluence for example.
My first thought was to build a project with Spring and OSGi, I started finding a workable OSGi framework that can suit Spring. It led me to Spring Dynamic Module (SDM) and Gemini Blueprint (GB). SDM i... |
I would like to create GUI + API that calls third party API as follows:
third party API is consumed once a day by my API,
GUI user doesn’t have to log in every day (eg. can log in only once every 30 days to request data from my API)
design my API scalable
The flow of system:
desktop/browser GUI sends request with 3r... |
I would love to hear some more expert opinions on a problem related to bulk real time information, here some details:
Use Case
The users view in real time a map with determined places.
The users can create a post if they find themselves in that place (via geolocation)
Posts for a place will get removed after some time... |
A few alternative twists on the question title to contextualize further:
What to archive of the "sources" for a given software build?
Should I include all transitive packages in my repository?
Is it OK to rely on the package manager to be able to reproduce a build at all?
Should I archive a ZIP file of my git repo rel... |
Suppose that we have a Post resource (this is just a dummy example):
GET /api/posts/1
{
"id": 1,
"header": null,
"content": null
}
And now we'd like to create a Header inside the Post#1.
POST /api/posts/1/header
{
"color": "blue",
"title": "Some title"
}
Now, is it okay for the POST request above to return ... |
In my application, we record audio of people speaking, send this to a speech-to-text (STT) service, and present the text to the user for editing.
Simplifying a bit, the STT service returns results in the form of a long list of words with timings:
"words": [
{
"value": "Today",
"from": ... |
In open source projects handling user data in a secure manner can be managed, for example through encryption and password protected functionality. What I'd like to create is a way for the user to publish content, which can be read by other users, but not manipulated.
In case a program has some safeguards against temper... |
One big customer asked me to supply my program to run within a balanced VM-images structure; I mean, the program will be recorded into an image which will be launched in "instances" to process a huge amount of data. So, we will have the same "image" running sometimes in 10 VM's (instances), sometimes in 100 VM.
My soft... |
My application is deployed on several servers that all read data from a single database.
Following safe deployment practices, code deployments happen first on a subset of servers and only continue to the remaining servers if no issues are detected.
I'd like to also employ safe deployment practices for some critical dat... |
Assume that there is a question where a string needs to be passed. Some modification needs to be done on the string and then returned back.
For the programming languages like C where a string is a character array, making the modifications, swapping characters is not a problem as all of them can be done in place.
But fo... |
In a C# console application of mine (which uses CliFx for the command line processing), I'm setting up dependency injection using Autofac. What I've learned about IoC is that you should have a single composition root with all of your types known and registered there.
I'll be honest, the idea of having a single location... |
The issue at hand is that I don't want to repeatedly hit the DB to look up user information for the logged in user over the course of the many requests made within a single session.
My first inclination is to use Session Scoped Dependency Injection, however this isn't possible with out of the box DI features provided b... |
I want to create a little todo app, with a "pedagogic focus" on clean software design.
I spent some time reading about design patterns lately and I am trying to wrap my mind about which of them I could and should use.
Features I want my "todo items" to provide:
Timing
has a due date
has a due date and due time
is "ti... |
I have an Exam class that represents an examination/test:
public class Exam
{
public int Id { get; set; }
[Required]
[StringLength(maximumLength: 30, MinimumLength = 1]
public string Name { get; set; }
[Required]
public Subject Subject { get; init; }
[Required]
public Enrollment En... |
In JS, code runs single-threaded, that's why asynchronicity is necessary. I cannot use code like result = someRequest(), instead I need to give it a callback someRequest(resultCallback) or write a Promise result = await someRequest().
But why was the language designed like this? Wouldn't it be much simpler if everythin... |
In other words, should the raising of an HTTP 4xx code be considered an error, and should the job of sending an HTTP 4xx code to a client be delegated to an error handler?
Or is it simpler to just send such codes from whichever local code block we happen to be in, when the need arises, instead of delegating this to an ... |
Suppose I have data that easily fits in memory in a redis database. The redis server runs as a single service on a single process on a single machine. Let's say I have a 100 different machines connect to it often for various reasons. What benefits would I get by having "a cluster of redis nodes" as opposed to just the ... |
I'm working on a rich client desktop application. I'm trying to use MVC to decouple the model, view and controller responsabilities.
Problem is I can't seem to find a clean solution for handling communication between nested components.
Most of the answers I've read online were either confusing or were dealing with "web... |
There exists different composition arts/techniques, i will present in the following some of them.
The question then is do you know more techniques additional to my presented ones?
And then the important question is, what kind of different makes it from the client perspective, how should i access from a client a composi... |
I have some logic that needs to be called by multiple applications ( mobile, web, ...). Instead of duplicating this logic, I thought of putting it in a Rest API so that I could call it from any of the applications.
The "logic" that I wish to put on my Rest API basically reads, creates and deletes multiple rows from mul... |
So now i have a really concrete example;
its highly related to that question here: Tell one, but ask the others?
the important statements there are:
In the comment section https://softwareengineering.stackexchange.com/a/418453/347781 :
But what you would say if both sides pull out the data?, ok i put the behaviour to... |
I am working on a program that needs to work on floating point values that are fetched from different database types: currently we support 12 different DBMS (for example, two of them are Sqlite3 and MariaDB).
My code applies some business logic to the values fetched from the database, a floating point score is calculat... |
I am in the process of developing some software using CQRS, ES and DDD. A part of the system is writing services for controlling devices and collecting data from them.
Consider a "Start" command coming from a user interface. The success of this command depends on the execution of the start() command on the device API i... |
I'm looking for a way to share a React Native component with 3rd parties without having to share the actual source code.
Something like a .jar in Java or a .dll for C#.
So assuming we have company A and company B, i (as company B) am looking for a way to provide a react native library to company A without being able t... |
Suppose we have a project consisting of many microservices, all of which use a common library. The common library has been put into a separate git repository, and each microservice is also in its own individual git repository.
When the time comes to make a change to the common library, how should that be done? Because ... |
Let's assume we have a use case where ServiceA needs to make several calls to ServiceB. I know it would be best if the calls could be consolidated as one request, but let's say that's just not possible for this use case.
My question is who should be concerned with not overloading ServiceB? Should ServiceA trust that ... |
Hello Fellow Programmers,
We are converting our monolithic application into microservice based. One challenge which we are facing is that one of our component is stateful. We cannot make this component stateless as of now (Due to high migration cost) so we have decided to horizontally scale this particular component on... |
Consider an interface:
interface Auth {
fun doAuth()
}
this can be implemented for multiple APIs:
class GoogleAuth : Auth {
override fun doAuth(){
throw NoGoogleAuthImpl();
}
}
class TwitterAuth : Auth {
override fun doAuth(){
throw NoTwitterAuthImpl();
}
}
Now, a class might want to use one Auth ... |
I have just a few tenants on my application right now, but the number is going to increase over time. The processing logic for each tenant is slightly different from each other and right now the logic for each tenant is residing in the same microservice.
From a best practice viewpoint, is it a good idea to create an in... |
I am building an API for webshop. I need to implement following scenario:
There are x (let's say 500) digital items, which will have same price (let's say each item costs 10$), but unique serial number. There will be a sale on specific date. I need to prepare for "optimistic" scenario, where there will be more than x (... |
Are there best practices about how to prepare lightweight viewmodels with dummy data, that could be used in SwiftUI previews?
Right now, I have a viewmodel for an in-app purchase screen, that needs to fetch products from the app store, but for mocking it in preview (without needing a whole fetching code), I added secon... |
v = |x1-x2| with 0<=xj<=C for j=1,2, C constant
I was trying to moel this relation by linear constraints. This is what I've done
equality is equivalente to superior and inferior relation.
begining with v>=|x1-x2| :
this "superior" relation can be modeled as follow:
v>=x1-x2 (I)
v>=x2-x1 (II)
for v<=|x1-x2| :
this "infe... |
We have a Spring-Boot Web application currently deployed to 7 environments (DEV, SIT, UAT, Pre-Prod, Prod, etc.). This application connects to other REST services, which has different URLs for each of 7 environments and are maintained in environment specific property file for our application.
We are planning to reduce ... |
I have a lot of classes that are just a CRUD interface for microservices. They only have a param for the endpoint and some of the methods get_list / get_item / create / update / delete / activate / deactivate. To be DRY, the methods that are necessary for the microservice calls are all grouped in a BaseAPI class. A sma... |
I'm a little confused about how to handle cookies between frontend and backend.
I have a
frontend react application
a backend node express application.
The frontend is hosted on Netlify and the backend on Heroku.
It seems that you cannot put these apps on the same domain- www.mydomain.com (not sure if correct). So in... |
I was going through https://docs.microsoft.com/en-us/azure/architecture/patterns/choreography, the document mentions in the drawbacks of having a central orchestrator that it can become a performance bottleneck. This is something I didn't get, because even if we move towards the choreography pattern as described, any w... |
I have read in a DDD book that using message queues between communicating services can make the whole architecture more scalable, amazon's documentation mentions that queues provide granular scalability. I don't see how it is 'more' scalable than services communicating synchronously using http. I agree that it scales m... |
I'm building a forum application using the Django web framework but I'm not sure how to design the entity relationship diagram when it comes to the Post model. Since one Post can have many replies, should I model the replies as Post objects so that there is a 1 to many relationship on the same model(Post model in this ... |
I'm creating a .Net 5 API backend and use EF Core for the database part. The simple CRUD way I know:
API layer calling a command or query from the application layer using MediatR
Application layer calling CRUD actions from repository interfaces
As we all know the CRUD actions are struggling with the real world proble... |
I am trying to work out the best practice for structuring a series of Azure durable functions for reuse across future development work within my organisation.
From the doc's it seems like the desired approach is to setup single use activity functions, and then reuse them within different orchestrations, but what is the... |
I am trying to come up with an algorithm that generates every possible combination of Scrabble tile sequence on a player’s rack. I want the sequence to be comprised of n number of indices depending on the number of tiles on a player’s rack.
So for example, in Scrabble, a player MUST have at least 1 tile on his rack but... |
I have a notifications app which sends users notifications. It uses a .NET core backend, an angular frontend and Cosmos DB. Within this I have an API endpoint function which is linked to a button used to clean up inactive users' records from the DB based on a selected time period.
This database job takes a long time to... |
I've had a question for a while. I know that the Array prototype method filter is generally preferred over forEach, and I believe it is typically faster at the job as well.
But what about if I have an array and I'm trying to partition each element into either bucket A or bucket B.
Say array elements with property P ar... |
I have a web application that has Users that belong to Companies. A User can only belong to 1 Company at a time and they can manage their own company information. I'm using java spring and I'm following Hexagonal Architecture.
So, I came up to the conclusion that i should check if the User really belongs to the Company... |
I'm working with a codebase that is almost 4y old, just a little under 2000 source files and roughly 100 developers have committed to it.
One of our third-party dependencies is not actively maintained anymore and we suspect that it will no longer work as we keep upgrading our stack. We would like to estimate how much e... |
I want to wrap a C library, libcookie, in C++.
Setting
The library has an object-like structure like so
struct Cookie;
typedef struct Cookie COOKIE;
int CookieGetTemperature(COOKIE*);
// ...
COOKIE* CookieGetBest(); // Meant as reference
So I want to wrap it with something like the following:
struct ObjCookie {
C... |
I am having such a hard time with OOP and databases. Both in C++ with SQL and even more so with Node.js and MongoDB. For this question I will use Node/Mongo.
Let's say we have a user object. Over time user objects can get pretty big..
class User {
constructor(){
this.name = '';
this.id = '';
this.c... |
I'm building at a Build and Deployment pipeline and looking for clarification on a couple points. In addition, I'm trying to implement Trunk Based Development with short-lived branches.
The process I have thus far:
Local development is done on the main branch.
Developer, before pushing to remote, rebases on remote ma... |
First, let me explain what I mean by inversion of control and tell, don't ask in this context. I have 4 classes MailController, UserData, Subscription and MailService. MailController is a consumer of object MailService.
Inversion of control here means two things:
passing in required arguments into each method on the o... |
We have all heard of Don't Repeat Yourself and Write Everything Twice, but I've never understood why anyone would prefer the latter of those. Obviously you can go overkill with DRY, with the code ending up unreadable and hard to debug. But why would you want to strive to write more code than is required to perform a ta... |
Consider that when working on an Application which is modelled using DDD and implemented using Onion Architecture, you come along a following business case:
The Application, as one of its features, allows you to write Movie Scripts. When working with a given Movie Script, you have Characters, to which you can assign Ac... |
I am creating a vectorized reinforcement learning environment. It handles multiple instances of a board game in synchron. Up until now, the state of the environment was a specific representation of the board. However, the need arose for running tests with different board representations and later it might expand to inc... |
What's the best practice around updating information received from the request?
Update all the columns with the values received in the request object? What if there are columns that should be updated when posted by admin and not by the regular user? We have a lot of such situations.
Should the backend check what attr... |
I have a set of array, containing a large number of objects (products), which has lately grown so large, searching in it takes about a minute, which is considered too long, since one search is expected at every minute.
I'm looking for a way to reformat the engine for a more modern/faster one. The objects does have a un... |
I've got a 2D map, on which entities interact.
Should an entity's position be kept on the map object, or on the entity object itself, or both? Why? What does decide where a property is kept? What questions am I supposed to ask myself when deciding that?
Some use cases are:
checking what entities are on a given tile (p... |
In my current project we try to use DDD as development process and foundation of our architecture. For the REST-Interfaces it has been decided, that JSON:API is our way to go.
Since DDD, REST and JSON:API are all rather new concepts for us, I might have some major missconceptions about them.
In the example from jsonapi... |
Those textboxes, datepickers, textareas, etc... or DB fields.
Does anyone know the etymology of it? Why those are "fields"? Is it because a field is an open space area that has no trees growing on it thus representing a textbox with no data in it? I can get why a mouse controller is called this way - it looks like a mo... |
Something which has always confused me is this. I keep hearing about how these big, old corporations which were around in the 1950s (for example) and early on started using COBOL-coded business logic on IBM mainframes, which are apparently unable to "migrate to something modern", even though they want to and it's expen... |
I read a lot about using ongoing numbers vs UUIDs as the primary key and had an idea how it might be possible to combine both and profit from their advantages, without their disadvantages.
The table would have an id column that is auto-incremented and another column that contains a random string [A-Za-z0-9].
A blog art... |
I was watching youtube and squinted at the text in the video and wondered what happens when I switch from 720p to 1080p.
Does the streaming service, Youtube and or any other, just have the files in different resolution at the time of creation and then ping the client to see how fast the connection is before deciding ... |
I started to write a function which had a pointer to a vector as a parameter so that it could modify that vector to output results (as the actual return value was an error code), when I started to think about the memory behind that.
Edit: Adding a new example here to make this clearer - I think I mostly have the idea f... |
What's the name of the relationship opposite to "inherits"?
Subclass inherits from superclass
Superclass ______ subclass
|
I am working on processing of documents and storing their hash in Redis to identify duplicate records and some system files.
Recently we migrated to MongoDB from SQL Server as our primary database.
So now does it make sense to manage both Redis and MongoDB? as we can also run MongoDB in memory?
|
I am getting worried I have some terrible design pattern here in JS/Node.js/MongoDB. It seems to that to create an object, I need an object that looks like that object. This includes data that comes from the user or data that comes from the database. It is just a lot of duplication, but I have not figured another way a... |
Hello to everyone and thank you for any suggestion.
I have a family of subclasses of Track (Track is abstract).
Every concrete Track has a different number and types of fields (attributes) that extend the basic abstract track-fields.
Then I have a family of file-types that implement some methods (saveRow() etc..).
Ever... |
I am using some C# pseudo to illustrate here. Below, you will see a Service and a Client (in the context of using DI).
The service has a required property that will need to be initialized by the Client.
Typically, the client would instantiate an object, and pass any required data through the constructor.
Using DI, howe... |
I have a web application like this:
An angular frontend for client and a spring MVC backend for admin panel.
A angular web application requests a JWT token from tomcat/spring MVC.
The angular application the uses the token as Bearer for HTTP requests.
But now a requirement has come up:
The user will use that token ... |
I need some advice on the scale-up issue. we have a java application currently it works as below
the current system is using the Thread Per Request Model.
each client connection (long-running and streaming data from us) will create a new thread in the thread pool and a java internal blocked queue. the disruptor work t... |
I'm implementing the validation layer for a certain method on a controller, namely I need to check if certain image ids passed do really belong to the user making a request. In order to do that I need to retrieve the userId from the jwt and then execute a DB query. The problem is that I need to know that userId, unfort... |
I have a small project that has 6 service classes and a main class. Since they are service classes and does not store any state in it, I declared one static method in each one:
class Main calls A.foo1(param)
A calls (in static foo1 method) B.foo2(param2)
B calls (in static foo2 method) C.foo3(param3)
and so on...
Rec... |
I have recently inherited a codebase which has a weird problem and I am trying to search for an extensible solution that can solve my issue.
Consider I have a model class that is used as a model to populate data in the UI which looks something like this.
public class Person
{
public string FirstName { get; set; }
... |
Is it usually recommended to define default values for Boolean arguments?
I mean, is it usually recommended to define a function like this
someFunction(a, b, x) {
// a and b are strings, x is true or false
...
}
or like this?
someFunction(a, b, x = false) {
// a and b are strings, x is true or false
...
}
... |
Hi I am very new to using DTOs, and I am starting to understand it slowly, but there are still some missing puzzles for me.
I understand the use of DTOs in the way of decoupling the persistence data model from the data model (representation) offered to the consumers. Also, that the aim beneath DTOs is to gather in a si... |
I am writing a c# program where I need to print a lot of small barcodes in a 100x100 grid on a piece of paper. I then scan/photograph the paper and read the barcodes again. Each barcode only need to contain a simple ID code so that I know which which code I am reading and hence where it is on the paper. So a barcode on... |
I know that Inline CSS styling gets so much hate from many developers, and I understand that some of this hate is justified by the following facts:
Inline styles increase page size as they don't get cashed like CSS files do. But isn't the difference in size minor in most practical cases ?
It's hard to maintain inline ... |
Typically in any application, the way a user (human) is authenticated is using a username/id and a password, whereas programmatic or api based access is authenticated using API keys (based on system designs that I have seen online).
Other than one reason that usernames and passwords work for humans because they're easy... |
What is the best way to create dynamic user roles that can have toggleable permissions?
I am currently creating my very first website which has a react front end with redux toolkit and redux saga and my back end is Django rest framework. Companies will be able to have their own pages on the website, the owner can then ... |
I was trying to understand the use of multi-methods recently and saw several claims that they solve the Expression Problem. However, I ended concluding that it is not the multi-methods that solve it, but the open methods, which usually accompany the multi-methods. Open methods being the methods that are defined outside... |
What I need
I need a suitable and scalable solution to manage data flow between the classes in my C++ program.
Why I need it
Upon new feature requests, I'm continually adding new classes to the program. I initially registered callback functions to classes and injected a dependency to the class via an interface:
Now, a... |
I'm working on a Swift-project (an iOS-app) where a webview is used to show an HTML-document. This document is manipulated by some JS, which is compiled and minified from TypeScript. There's also SASS being compiled to CSS.
There's obviously quite some building going on here. There's also quite a bit of package managem... |
We have a battery manager implementation which uses a fuel gauge driver and a charger driver. Currently both of these drivers are hard-references to the fuel gauge and charger driver we currently support.
Now for new projects, another fuel gauge and another charger have been selected. We would like to keep the logic of... |
Should I restrict my backend API (api.cool-domain.com) to be only accessible by my frontend (cool-domain.com)? Seems like it will provide some amount of additional security, I am just asking is it worth the hassle, because we all know about hundreds of public apis without such CORS restrictions.
|
We all know Joel Spolsky's famous article to never rewrite working code.
How about if we don't consider overall program but a module within? Module can be e.g.:
payment handling microservice in e-commerce application
data access layer (inline SQL to ORM)
front-end layer (MVC to Angular)
Are there circumstances that j... |
I have noticed that JavaScript and PHP and Python do not support function overloading.
Do all dynamically typed languages not support function overloading? If the answer is yes, then why is that?
|
I have multiple WPF applications running different programs some of them are interconnected so one might have to start another at some stage. I need a way to communicate and share large amounts of information fast between them. So far i have tested using gRPC and using one application as a service to talk to a client b... |
We have set of common types (mostly structs, scalars, string IDs) that are used across different packages in a project written in Golang. Currently we define them in a package named "models" in the root of the project. It was made to reduce cohesion of different packages and to avoid circular dependencies. Is it consid... |
In our team we are currently discussing which technology makes more sense for an upcoming feature - HTTP polling vs WebSocket.
To give some context:
We are developing a TV streaming application (server and mobile clients).
We currently have about 60 TV channels.
On some channels we need to prohibit the user from seeki... |
I'm working on some tooling that will help speed up the process of setting up a new computer for new developers. I want the user to be able to execute many tasks either as one task or grouped together with other tasks. For example, setting up the server might consist of the tasks A, B, C and D. Let's say that A is inst... |
I'm having an issue with dependencies in a C# app that I'm creating.
I have an assembly for my authentication process, and a separate assembly for starting up the main program once authentication is complete.
My issue is where to put the interfaces between these two systems. The main program assembly doesn't need to kn... |
We are developing a serverless application (AWS API Gateway, Lambda, and Dynamo) keeping users and groups in the same microservice as they are being stored in the same DynamoDB table. REST endpoints for the users look like this:
/user/invites
/user/:userId/save
/user/:userId/activate
Is the a good idea to have endpoin... |
With threads you could use Semaphore, mutex, ManualResetEvent, etc... to sync a shared data, how do you accomplish the same thing with tasks? Essentially, if I have shared data between different tasks that run on the thread pool with Task.run() or that resume on the thread pool on a random thread after an async event,... |
So, let's say you've got a function foobar() which can function with a variable number of parameters inputted into it, and has different behavior for each of them. How do you get this to function properly in Python? Are you forced to name every possible combination of parameters something different?
For instance, let's... |
I'm kind of new to this "separate your methods from models" (yes I was one of those developers). From what I understand I have to separate everything into models, services and factories. A factory creates stuff (where every "new" keyword of your project should be) which is straight forward, but a service takes somethin... |
After studying some basics about n-layer architecture, I face to a new proyect where my database is an ERP and the way to connect with it is via API calls. I can perform queries to obtain data but the only way to insert and update is using the API.
I have to write two applications, a website and a web service. Obviousl... |
We have 1 frontend developer and 2 backend developers and 1 QA. QA is responsible for writing the end-to-end tests using Cypress. FE developer writes the unit tests. Backend developers write the unit tests in the backend repo while QA writes the microservice integration and e2e tests.
I'd like for QA and developers to ... |
tl;dr: Is it a unit test or an integration test, to ensure that the inputs to a mocked dependency were correct?
More details:
Suppose I'm given a requirement like this:
Create a function that returns the current temperature somewhere on Earth, given the latitude and longitude of that place. Signature has to be int get... |
I am setting up a Github repository for a project that will have multiple Microservices.
I have created a sub-directory for each microservice under One Repository.
ProjectRepository
\Services
\MicroService1
\MicroService2
\MicroService3
\OtherThings
Every MicroService will be develop... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.