instruction
stringlengths
34
36.1k
We currently have an architectural setup as described below. Our plan is to conduct a load test, but we face a challenge due to the high cost of real switches. We have two options: either build the architecture directly or create a simulation. However, our tasks must pass through a cloud server that only recognizes rea...
Lets say I have students and classes which are 2 entities. A student can take many classes and a class can have many students. This would be a many to many relationship. To solve this with an RDBMS my understanding is that one would create a joining table, so the tables would be: student table student_id | student_nam...
We develop an online booking system and it may be embedded in customer websites in an iframe. It is very simple to use, you just include a JavaScript file on the page and call the initialisation method in a script. In the instructions for website developers (or website admins if they know what they're doing) we indicat...
I have Controller that basically publishes different Event based on some input criteria, simplified version of the logic is here: [HttpPost] public async Task<ActionResult> Create(CreateRequestDto request) { IRegistrationEvent createAppEvent; switch (request.Kind) { case RegistrationKind.Client: ...
There is a back end application with a few development teams working on it. The application is a monolith. Before releasing any new features they need to be system tested on the last application's version(to avoid bugs). That said, the current process is teams taking turns, doing manual testing and then releasing. This...
Courtesy link: What Are The Specific Meanings Of The Terms: Functions, Methods, Procedures, and Subroutines? What's the difference between a function and a method? In the linked question: function, procedure These are often used interchangeably, but in some languages there's a distinction. In Pascal, a function is a ...
I have found another similar question, but the answer there talks mainly about C/C++, and does not mention about the division operator. So, in C/C++ and Java, dividing an integer by an integer returns an integer. On the other hand, in Python, a single slash will return a floating point while a double slash will return ...
Recently, I was charged with making about 9000 Selenium tests start running in CI/CD nightly. These tests had built up over about 8 years and had up until then been run in an ad hoc way. It was important that failures in the CI/CD be genuine failures, which meant that you could run the test as many times as you liked a...
About formatting Here are two scenarios in which the details of the formatting are described. How should in the clean code way, this be formatted Scenario 1: Dependent functions of dependent functions function main () { firstFunction(); secondFunction(); thirdFunction(); } function firstFunction () { fourthFu...
I have a budget entity in my domain which can be closed by the user if the budget is open. This means if the budget opens today and closes in seven days, in between this time I can close it, not before (I'd have to delete it), not after (can't do any action). This time constraint raised a doubt: should I add a validati...
Using Moq framework, it is not allowed to mock a class in C# which is sealed. Same goes for many other frameworks as well. But why is it not allowed?
In a web application with a frontend and a backend part, how exactly is the cancellation token mechanism implemented over HTTP? HTTP is a stateless protocol and it does not allow "sharing" any data between the parties. So, how can the frontend create objects which then somehow "monitored" by the backend?
I am currently developing an application in Python that has a match making functionality to form sports teams of 4 and group them by skill. The following has been implemented and works. E.g. Form full matches of four level 5 players until there are non left If there are some left, form a match with the remaining leve...
I have a base class "People" which two other classes inherit from: Employee and Student. The Student class includes a GPA (type double) and the Employee class does not. I have an ArrayList of People, containing both Employees and Students. I want to sort the Students by GPA in descending order, but I'm struggling to ma...
I have to design a part of a system in responsible for creating tickets for attractions and then sell them. Basically there are three different parts: Product: to create the tickets for sale for each attraction. Prices: to assign prices according to some criterias. Qutoas: to manage the available quotas. I have to ta...
I have just started my first position as a software engineer after finishing my degree, and, as warned, software is much different in industry than in academia. The startup that hired me does not have such robust documentation due to the pace of the work, and that is a piece that I would like to take on, and I want to ...
I'm building an API that allows people to search for books (just for simplicity). There is an endpoint that takes a query string and returns the top 10 matched results. For example: /api/v1/book/find?title=Ha It will return Hangover Hammer of the Gods Harry Potter and The Sorcerer's Stone Harry Potter and The Chamber ...
I am new to React and web development generally so please try to understand if the question seems dumb. So, I am currently making a simple e-commerce app and I was thinking of using state management either using redux or react context. However, I also thought if I have a database, why would I need global state manageme...
this is a robotics team with some questions. Here's our current setup, using GitLab: Currently, we have a main branch as well as a separate branch for each of our programmers. When they want to start working, they pull main and merge local main into their local personal branch (personal meaning the branch that has thei...
Attribute references and instantiation In this link, that is part of the official Python documentation, I have found the following information: Class objects support two kinds of operations: attribute references and instantiation. Attribute references use the standard syntax used for all attribute references in Python...
Bit of context: I'm an Economics major that somehow ended up developing an API that's becoming a whole software project, so please bear with me. So, after I got asked to add logs I noticed I should have a development and a production environment so my logs don't get dirtied by my tests. After reading a bit I added a .e...
This is more a curiosity/query-for-information than anything; apologies if it's thus a little malformed: This is relevant to a useful API-querying library that can be shared across multiple teams within the company. Consider the scenario wherein all configuration is propagated via environment variables. Anything that n...
I'm writing a validator class to validate certain request objects against a known format. Rule declarations and the validator will both be written entirely in Python, and I don't need to store the structures in the DB or go across the wire in JSON or anything of that type. I'm considering using the builtin function any...
I would like to write a program that essentially handles text data and metadata of files locally on a machine's filesystem. There is no need for any network activity. I am working with large quantities of sound files in complex directory structures. Information that the program should be able to quickly access include:...
I have a proprietary protocol that describes the exchange of messages of two participants (applications) via a messaging broker (mqtt). A participant is of type A or B. Each type is allowed to send and receive a specific set of messages. The protocol defines a strict sequence in which the messages are allowed to be exc...
In my project I have several "basic" interfaces whose behavior is fixed, i.e. the default implementation will always be good for every puropse. So I defined them as concrete classes with data members, Configurable, Named, DataUser etc., e.g.: class Configurable { public: void SetParameter(int i) { _prop = i; } int ...
In my company, we use a separate cron server to run mission-critical background jobs that run on a single ec2 instance: the whole platform is then vulnerable to anything going wrong on this instance. We want to change the design of the system. Based on that, I need to modify the system in order to make it more reliable...
I really don't like media queries in CSS - they have limitations, and on top of that they make the code a lot more confusing. In addition, the restrictions are so strong that when using CSS preprocessors, it is impossible to use, for example, @extend from SCSS inside a media query: @media (max-width: 768px) { #ele...
Currently, I'm working on a graduation project about designing a Document Management System (DMS) that incorporates some functionalities as follows: It won't use folders to organize documents; instead, they will be stored in a flat structure. Document organization heavily relies on assigning suitable metadata. Searchi...
Let's use PHP here for examples and illustraion purposes but the question is language and framework agnostic. Many experts say Service Locator (anti)pattern should be avoided and recommend using Dependency Injection instead. Then we can find 3 ways of injection: constructor injection setter injection field (property) ...
Say I have a complex entity (class) called Quote. We have one representation that has just 3-4 fields used to hold minimal amount of data to identify a quote. Is there any convention to call an entity that does the latter? We were considering QuoteGet (data to "get" a quote), QuoteDef, QuoteDefinition or QuoteReference...
In the book "Inside Microsoft® SQL Server® 2008: T-SQL Programming" the behaviour of a sql query is explained. The following picture is taken from the book. I have some questions about the explanation. How is a sql query processed when there are indexes, that is, would this behavior change? My doubt is because I am a...
I am writing a recursive function. Some of the parameter data is different for each recursive call but some of the data only need to have one copy existing at any one time during the recursive call. For example a variable to keep track of the recursion depth when iterating/recursing on a recursive data structure (octre...
At present moment, my desktop application operates purely on file names. That is, it parses file names and then reasons about the data contained therein. However, in the future, I see that there is a great possibility that I will bring in libraries which are capable of parsing file data, to improve my application for u...
We have a server that receives queries. We use the command pattern for this, e.g. q := NewQuery(database) q.Execute(request1) q.Execute(request2) The queries read a "model" from the database type database interface { ReadModel(id string) *Model } Problem #1: The model is stored raw. But when executing the query,...
I would like to add functionality to an existing .NET 6, WinForms app (currently migrating to .NET 8 if that is of any relevance), to periodically upload user usage metrics, in addition to providing capability for users to 'push' log files etc to a server where we can access them immediately, rather than users exportin...
I'm using argparse.ArgumentParser extensively; however, it comes with a lot of boilerplate to set up, and this is especially noticeable when you've got more than a few common arguments that probably exist between functionally different, but effectively the "same" update scripts. In detail, I am writing a common update_...
I have a custom repository for each entity/module (I'm working with NestJS). I know that this is a lot of repeated code and I may refactor it in order to use a generic repository later, but currently I'm focused on making a simple working MVP. My current doubt is: I have some entity specific scenarios to get data. eg. ...
I am writing my first application using DDD (in Node with TS) and I started writing all the domain first -- before starting the repositories/DB and then the application, while writing unit tests for each entity. As my domain developed, I started to have more doubts about my business logic. I'll give examples below. One...
We have a layered application with (basically): WebAPI, App Services, Domain and Repository layers. This fits for most situations, but now we face a slightly different challenge on where we need to build a query based on what we retrieve from the database. Usually, when we use the repository, we know what query to use....
Recently I've had an argument with a teammate that I wanted to have a reverted commit on the master branch from where releases are made as a standalone commit and not merged with future changes. My point of view was that I wanted explicitly show that I reverted another's teammates work and then on top of that I introd...
I've began studying how the .NET Code Analysis works. It seems that it can be either enabled via a NuGet package or a property in the SDK-style *.csproj files. Also, starting in .NET 5, it is enabled by default. I'm surprised to discover that most of the rules are disabled by default. I can understand that some of them...
as per request, I'll reduce this whole set of questions to 1-2 core points (thanks for the feedback ;)). I'm considering using insert-only tables for keeping the history of my data. while the productive usage is pretty clear to me by now, I'm still struggling to find a solution for some problems from a continued develo...
I'm working on a project in Python and want to get it hosted for others to use, the internal recommendation has been to host it on AzureML (it is a non-machine learning model, but follows the same practices of having a model and scoring script). A Python script on a single request would return the result in 0.1seconds....
I hope this is the correct sub StackExchange to post this question. In our company, we are currently using a Spring Cloud Config server for Spring boot apps to be able to fetch their configuration values (application properties). We also have Hashicorp vault for secrets management. So far this has worked out fine. Howe...
I've been trying for days to upload plain text files to a web server (both IIS and NGINX) via HTTP PUT/POST, from a C# desktop app, unsuccessfully However, I'm no further along. I have had various threads here, and on StackOverflow regarding specific issues), but given how trivial it was to GET files from the file serv...
I'm building a mobile app in Flutter, and the project has several distinct layers. The top part is something better described as MVVM: dumb View layer that performs rendering and delegates actions to reactive stateful ViewModel. The ViewModel itself is kept rather lean too, with all the actual logic pushed down to Mode...
I'm relatively new to Go but I come from a C#/OOP background where unit testing private methods isn't something that's generally done. I currently have a senior developer telling me it's "bad design" if private package methods can't be tested. Is this generally true of Go?
there are a vehicle class and customer class . In short, in the customer class there is a function that shows 'can this person or company rent that car'.The function uses a object of vehicle and compares with the customer so my question is in the class diagram which association should be there to show this connection b...
I'm trying to make sense of the docs located at: https://developer.mozilla.org/en-US/docs/Web/API/Response/redirected It says Note: Relying on redirected to filter out redirects makes it easy for a forged redirect to prevent your content from working as expected. Instead, you should do the filtering when you call fetc...
Often, when a program is starting it shows a modal window which has program logo, copyright information etc. For example, NetBeans shows the following window at startup: Could anyone say how such windows are called? I've heard that there is a special term for them.
I am going back and forth on an aspect of our FluentValidation and MediatR pipeline behavior implementation. We receive requests which, in a Mediator pattern, are mapped to command or query objects, which are, in turn, validated before being presented to the service layer/business logic. I can mostly validate everythi...
I am pretty new to async programming and the whole stream stuff, since i have a web programming background with php, where async programming and streams isn't really a big topic most time. I try to implement clean archtiecture in my next application where i use the concept of use cases to invoke business logic and rece...
A conceptual question... I have a XML configuration file used to set various behaviours in an application (colours, supressing help prompts etc). On starting the application, the XML is deserialized into memory, in a class whose structure matches the XML file's structure. For info, the application is a C# WinForms GUI...
I have a template class in c++ that depends on a few nontype template parameters. The implementation of some methods, and some field member, depend on the value of the template parameters, in a nontrivial way. This essentially require partial template specialization of the methods, which (being not directly doable in c...
We are generally following the package-by-feature approach, which is great. However, one specific case is constantly causing confusion and inconsistencies, and I'd like to know your approaches in this regard: Packaging API implementations that import, export or import and export data (by feature) We have had multiple...
Wikipedia says "increase key" is O(log n) for a binary heap, but it is referring to an internal function. I'm not asking about that: Imagine the data structure had an external/public function named modifyElement(currentElement, newElement). Some constraints: The currentElement is in the data structure already, but it...
When would you consider sharing a database to be fine? What are your rules? Our team in-charge of in-store credits. We: Calculate how much credit the customer earned Keep track of how much credit the customer earned and spent. Think of a bank but for in-store credits instead of money. Expire unspent credit. Think of g...
Had a discussion today in how to implement services that work with messages coming in from event queues. We call these services processors. One of us argues for using several functions, while the other argues for fewer functions that do more things, according to idiomatic go. To make things more difficult, there's a he...
We discuss about POSIX compliant shell script here. While we are writing more and more shell scripts, we build some helper functions to reuse the codes. We are considering putting a few helper functions (around 10 functions of the same category) into a library file (e.g. string_lib.sh) or splitting each functions into ...
I have worked with Scrum in various IT companies on software development projects. This framework has become the standard in several companies, but I have not yet managed to make friends with it because it causes me a lot of stress. Estimates We estimated the backlog items in hours. I often struggled with the fact that...
In Flask you can run a "webserver". Well really it's a "WSGI Server". Well really you shouldn't be using core server features like serving files through HTTP at all, you should be using a "real web server" like Apache. That has load balancing, multithreading, etc. In Node.js you can use Express as a webserver. Actually...
Generally print statements are frowned upon in favor to logging. But are there any situations where I should prefer using print statements? In a interactive command line application, if I ask for user input and he gives me wrong input, should I print the error message or should I log it? If I should print it, to where,...
I have a system where Client(C) sends request to Server(S0). S0 then sends the response back to Client that "request received" and closes the connection. C can regularly poll S0 to check on status of the task. The task to perform contains several asynchronous tasks (T1, T2, T3, etc.) that can take many hours to complet...
Azure Managed Identity provides a mean to only allow explicitly defined users/apps to access a given resource. For instance I can setup that no-one can access my database except the Managed Identities A and B. If C (or someone with no identity) tries to access the database, they are blocked. Even if they have the conne...
Presume a desktop application presents a Problem Reporting interface as part of it's GUI, and I wish to allow users to upload files as part of that PR. One would hope this is only ever used for constructive purposes, however - this raises several questions: How does an organisation deal with 'content policy' - i.e. us...
So I am working on my first project using SQLite and SQLModel as ORM. Creating and handling the first table in my database was easily structured: A function for each CRUD-Operation. But now I have added a second table to my DB and am starting to think about structure a bit. Essentially I want to do the same thing for a...
I have the following module structure: core persistence extension In my core module, I have an interface: Handler. This interface has multiple implementations in the core module as well as extension module. Some implementations depend on other complex types. I would like to persist instances of Handler in a database....
Lately, I have been playing with this idiom: Changing a private member variable into a local static variable when: member to singleton class used in only one function member is mutex for a shared resource used in only one function. member is constant expression used in only one function. Looking through my code, I pi...
I am new to backend development and I was building a feature for my project where I can send notifications to various channels (for example slack). I have a written notification class, which loads the service config from database and send the message. The project I am building is managing users across various services ...
I am looking for a way to let Web QA tester to test website with specific version. So, Web QA tester can say things like "this X is broken since version A.B.C". The current test/release process: developer create a feature branch from staging. commit to the feature branch. developer merge the feature branch to the dev ...
I have few questions on the go's answer to c10K problem. How is an event loop different from the network poller described in this blog? I see a striking similarity between waiting threads and waiting goroutines. And, non-blocking IO. I understand that it happens all under hood and transparently. But, at the sockets lev...
I'm currently refactoring our instance startup code, which is currently a 2,000 line mud method. The issue is that that method needs to create a large number (>50) of components/service objects, each with their own dependency requirements on other created components. Something of the style var service1 = createService1...
I am designing REST API for users and teams of users. One user can belong to multiple teams . One of the requirements is to be able to sort the users belonging to team in alphabetical order. Teams can be huge and contain a lot of users. We came with the idea to have sth like that: POST /users/{user-uuid}/teams-membersh...
I'm building a ASP.NET Core Web API and the application consists of 3 main modules. Data module: Contains the entities and DbContext Web API: Contains the controllers Service module: Contains all the data processing logic between the data module and the web API. I'm not using repository pattern to access data from th...
I am designing a database for localization standardizations. It contains Languages, Regions, Cultures, etc. For the region, I have a hierarchical structure that contains a name and a parent which is a parent name. Name in this case is the primary key. The parent region is the region that contains the given region. Each...
I'm in the very conceptual phase of designing an open source password manager that provides distributed Vaults that can be simultaneously accessed and managed from multiple devices with the promise of never storing passwords in the cloud and never having a monthly subscription fee. I ultimately plan to support all of t...
About 10 to 15 records are processed per day with the time interval of 5 minutes between each record. System A inserts a record in DB and sends id of that record to active mq. System B Listener receives id from mq and pulls records from DB System B processes that record and posts to System C using rest api call If 1,...
I am designing rate limiting in my application in which the rules can be dynamic. I have a basic design in which every request is validated against the rate limiting quota, which is stored in redis. As the system scales, redis will become the bottleneck and I want to cache the quotas in memory to speed up the response ...
The problem: We have a business process where we need to record many transactions between parties. At the same time, the products&services that transactions are for can fall into many categories at the same time. For example, we might have a transaction for iron rebar which falls into multiple categories at the same ti...
We've leveraged WCF Azure Service Bus Relay fairly heavily in the past and have a number of C# services that rely on it. All of these services relay REST requests to small on-site servers that sit behind corporate firewalls and are hosted on networks with dynamic public IPs. We are rapidly approaching the point where w...
There's a lot of free or member predicate-like functions (that returns boolean value) in different programming languages and popular libraries/frameworks that have "is" as a prefix, e.g.: isalpha C, python isEmpty C++ Qt C# ... Sometime such function names don't have "is" at all, for instance empty for C++ std::basic...
I am working on a project implemented in DDD style, and I use Repository architecture pattern to persist domain changes. I have multiple roles in domain layer, and that's what raises my question - how should my Repository handle this? Three solutions come to my mind: Separate Repositories for separate objects - (proba...
I am writing a service and a library that I need to make framework agnostic because it will be used by some client services. The client services will be written in both Micronaut and Spring frameworks. So I must probably avoid DI in a container. The library wraps the communication to the service, giving the client serv...
I have an Azure App Service running a .NET (Core) API for an inhouse application, which I'm integrating with Twilio to handle Whatsapp communication. To handle the web hook responsible for receiving a message, I can't think of a secure way to allow communication to my API, and thus thought that I could build an Azure F...
I'm writing my own dynamic programming language. So far I've been using a tagged union for all values. Since this boxes primitive types needlessly, I've begun researching tagged pointers which seem to be a common solution. It works by taking advantage of pointer alignment requirements which result in a certain number o...
Big and Little Endians represent the way we store bytes of multibyte numbers (int16, int32, etc.) in memory, transfer over the network, serialize, and so on. I know how they work, what they represent and what problems we can face if we don't understand them. For example, one problem could be if we use a library that wo...
<div> tags are display: block per default. <span> tags are display: inline per default. Could there be a tag that is display: flex per default? I don't mean a class, like bootstrap has. I mean a tag, like <flex>. Or better yet, a <row> and a <column> tag with the corresponding directions set per default. I've heard tha...
I'm studying for an exam and one of the questions, is about the concepts Separation of concerns and Modularity. But I struggle to see the difference between the two concepts, since both of them seem to be about reducing complexity in data by dividing it into smaller parts/modules? So is there a way where these two conc...
Reading Peter Van Roy's "Paradigms for Dummies", I am a bit stuck with the second footnote. Van Roy presents a graph depicting paradigms with different combinations of attributes for state. Named and unnamed, deterministic and nondeterministic, concurrent and sequential. The footnote states that two combinations are no...
New to the microservices architecture - but what I've picked up so far doing some research while designing a microservices architecture for a home rental system is these: Individual microservice should be as loosely coupled as possible - that doesn't mean they shouldn't communicate but not to the level that one micros...
As mentioned in some StackOverflow posts (like this one), I'm dealing with a difficult situation: My company is developing some C# applications (being a client-server application). We have migrated the server application from one computer to another one, and on the starting computer, everything was working fine but on ...
I have made a small project to try and learn to implement SQLite-DBs into my projects. For the DB part, I use sqlmodel and followed their tutorial. For the creation of the engine however, they use a module variable. This turned out to be a problem for me when trying to implement proper tests (see stackoverflow question...
Python is the language I use most in this period. My background in Java Before start learning Python I have programmed in Java language. In Java all code is written inside the methods of a class and variables are attributes of a class. In general is a best practice to avoid using static methods, public variables and so...
Many people come from frameworks that implement Dependency Injection and IoC containers for everything (in my case Angular 2+), so, this group of people will try to use dependency injection and IoC containers in everything even outside those frameworks. But, most of the implementation using DI is not using it to implem...
Our android application is built on java. And while sending push notifications we're using tomcat as a server. And it is doing more harm than good. Currently all the push notifications (FCM/APN) are pushed all at once. As I said they're not real time notifications that need to be delivered all at once. They can be deli...
I use MariaDB to store data using EAV model. I need EAV, because each attribute of each entity can have its own validity (validFrom, validTo). For example, I have entity person and I track changes made to their homeCity and degree attributes: attributes table: attributeId name ------------------------ 1 'ho...
This is a question which I have had in the back of my mind for a significant length of time, but never found an answer to, and never thought to directly ask - until today. I am interested to understand why HTTP supports multiple different methods, GET, PUT, POST, etc. My thoughts on this are: http methods are a way of...
This is a design problem that has plagued me from web apps to embedded systems. It seems that my fellow developers don't really care at all, so I've never seen an established pattern. In short: how does one decide if the parameters of a function should take an ID related to an object or parts of/the entire object itsel...
I'm trying to a create a "Task Queue" that has the following behaviour. Work is added via a Func such that the task is only started when the item is popped off the queue (no when it is added to the queue) Only a single item in the queue should be executing at any one time. If a new item is added, anything in the queue...