instruction stringlengths 34 36.1k |
|---|
I am trying to come up with a branching strategy.
We have two teams working on the same product which is kept in one repository. Both teams have different release plans and if both teams merge on develop then it will be create or problems for another team to release as release branch created from develop will contain c... |
I have a repository with various tools/scripts written with ts-node and used in many projects.
Initially, it contained several automation/analytics scripts, one package.json file at the root, and one index.ts file as an entry point.
I just uncomment the one call to the function I need and type npm start. Debugging in V... |
We are working on a big feature, because we don't know how to make it any smaller. I got to a point, when I need to merge my changes from our feature branch into develop branch (we're using Git Flow), but there are many conflicts, some of them are in the GUI which I have no idea what is doing, some of them are in code ... |
We have 2 systems Legacy & New and I have to migrate the data from the legacy system to the new system.
The legacy system exports the data in .csv format while the new system accepts the data in XML format. I've built a converter to read the data from the CSV files and consolidate them into XML.
Some of the CSV files ... |
I am trying to build an IVR system that requires some form of username & password/pin entry to access sensitive data. My naïve solution seemed obvious enough, until I realized that username/pass over a keypad essentially reduces to a long string of digits (0-9) -> easy to attack.
The application is designed to be a sor... |
It's obvious why you should track ongoing bugs. It's not at all obvious to me why you should track solved bugs. If a bug is solved, then just email the person who submitted it, delete the bug once they're happy, and maybe give your boss a thumbs up. Despite this, every bug-tracking guide I've seen suggests to track whe... |
We are trying to implement an authorization and authentication service for our product.
Now, we would have to cater to different kinds of IAM systems like SSO, LDAP and Basic Username+Password in Database for accessing our product since we have different kinds of client applications that use either one of these securit... |
I have done thru where do bug fixes go in git flow and the git flow and github flow pages.
There are scenarios many times when we need to show demo of new functionality and on same day fix issues of prod. So for a few hours have one branch in QA and for a few hours another.
Or pushing to beta/ UAT we want to test in st... |
I am developing a .NET Windows application and I need to make requests to a SQL Server instance. How do I secure the authentication data in my code in case someone decompiles my application?
I know there are ways to encrypt the connection string, but if someone decompiles the application, they gain access to the encryp... |
Looking for ideas in how to go about providing an estimate for project completion, when a fairly large percentage of backlog is not defined enough to confidently assign story points. This is a management request and we have to provide something. For the portion of the backlog that is defined enough to assign story poi... |
For example, let's say that I have an endpoint to get a list of buildings, that can be either apartment or house. The client can filter by apartment or house. Apartment has a property floor that house doesn't have, so floor will be null for all houses. For a response with a list of houses we would have
{
[
{
... |
I am developing a micro service that saves votes to a relational database. I have a use case with an entity that represents an aggregation of votes. I receive events from voters saying that they vote in favour of, or against X. This will increase values on the given entity, and these changes need to be persisted to DB ... |
I have an application in which a client interacts with a backend, which interacts with blockchain. Since blockchain executions can be time-consuming, they are executed asynchronously within different services. I have one shared database. There are total of 3 services.
Rest API service: this layer serves all the reques... |
I'm trying to design and develop a software (part of a bigger application) that should compute and render a spectrogram.
The spectrogram can be rendered either from live microphone or a file (assuming its content has been turned into a float array) and using two different algorithms, i.e. FFT or DCT.
In case the spectr... |
I am working on a class design question - design a simple grocery store with a self-checkout system
I am a beginner
After briefly jotting down requirements, I started with the Product class as follows -
class Product{
String barcode;
int price;
String description;
...
}
However, some products like vege... |
Something that's bugged me for years now about ASP.NET (Core) is that it's standard practice to set up dependency injection in the Web project, whether through the Startup class's ConfigureServices method or through the newer WebApplication.CreateBuilder's .Services.Add... style.
I recently experimented with adding the... |
I have realized that PHP can treat string variables as numbers (as long as int or float values are stored in the string variables), for example:
<?php
// Declaring two int numbers and one float number as string variables
$i = "10";
$j = "3";
$f = "5.2";
// Adding an int number and a float numbe... |
I have the following requirements :
A player in an FPS Shooter game has health points, where he can take damage and regain health.
One of the ways to regain health is by using a Health Booster that has been purchased from the store.
One of the packages is a SmallHealthBooster that increase the health by 10 (or to ma... |
I have recently started working with a new large company, which has lots of different teams, working on different products, which are largely self-managed and are run quite differently.
My team is apparently "not using estimates", which, as initially explained to me meant that we have a "rough project delivery date" an... |
In MVC, I often seen all models in a models.py module, all views in a views.py module, and the controller - you guessed it - in a controller.py module. In other projects, I sometimes see all exception types grouped in an errors.py module. In a recent project, I saw all SQL query strings for all tables in a queries.py m... |
When writing code in a programming language that has the option of creating standalone functions vs. methods of a class or struct, what is the most relevant objectively-quantifiable reason to choose to implement any specific functionality as a method of the class or type instead of using an independent function that ju... |
I'm reviewing changes to a widely used library, which are supposed to be refactorings, and so we want to minimize the risk of introducing any accidental regression. Of course, there are changes from this:
if (!BlobExists())
to this:
if (!await BlobExists(cancellationToken))
This looks like an impure refactor... |
It is possible to nest many decorators.
@decorator_one
@decorator_two
@decorator_three
@decorator_four
def some_silly_function():
pass
How do we write a decorator class so that the order in which the decorators is applied is inconsequential?
Ideally, for this application, we could permute the order in which the de... |
Background
I'm currently working on a project using domain-driven design and Dapper as my ORM. The entities are naturally slightly different than the tables in which they are stored (e.g. _id is protected rather than public, collections are read-only, etc.), and I'm struggling to find a good approach for restoring the ... |
I am currently working on a C# Azure Function that is triggered by an HTTP request. The function's purpose is to extract raw data from Azure Table Storage and output it to the user in the form of a large JSON object. However, I have observed that as the amount of data I am processing grows, it takes an increasingly lon... |
I am trying to build a file editor, and I wanted to build the UI using Flutter. However I wanted to implement IO operations (reading a file, applying changes, etc) in Rust.
The reason I would like to use Rust is that it would be faster for expensive operations and also seems to have a better serialization framework (th... |
I have recently stumbled upon a use case of extension methods and wanted to gather some design thoughts.
The problem:
A IEnumerable of a POCO and within that list there should exist a POCO that satisfies a condition say POCO.IsTheRightOne == true.
You could write and extension class for this query
public static class P... |
Couple of years ago, I designed an API service which has a limit on the number of requests per month per user. To track the monthly usage of each user, I used a table called monthly_usage. The table structure is as follows:
Column name
Type
Description
id
integer
A unique identifier for the user
current_perio... |
There is a coding anti-pattern I've noticed (while using .Net). You declare a data class, which is supposed to have a dictionary field (or get/set Property), and lets call it 'Properties', for the sake of example. It has a string key type.
public System.Collections.Generic.Dictionary<string, object> Properties { ge... |
We are a team of around 60 software engineers divided into almost 6 teams. We are working on an ecommerce project and following microservice architecture. Each team is responsible for their own service.
As team size is growing and we are moving towards bigger and complex features, inter team dependencies and communicat... |
Background:
We're providing an API that provides information about all users within a given group. Our API is a high level facade over another low-level REST API.
To gather those information we first have to get a list of all users in the group via REST call to the low-level API and then for each user do two additional... |
I am creating a platform which allows multiple users to edit a file simultaneously and I was wondering if using a web server with routes could be the correct architecture for this goal. I am trying to achieve something similar to Figma or Google Docs, where they allow multiple users to edit a single file concurrently.
... |
Let's assume we need to send a message, and to do so we would like our client to be concerned only with constructing the message (DTO) and using a facade service to send it.
We already know that we could have various services capable of sending messages of different types and we want to avoid going to change our struct... |
Imagine there is an Order entity that has a lot of states and conditional transitions between them. At the moment it is stored in a relational DB.
There are multiple consumers of Orders that perform a select for update within a transactional method and then run a huge spaghetti of code to handle all the possible transi... |
Many languages such as C or even C++ or C# or Java have no natively supported vector (SIMD) types or functionality. In such languages, one would have to either use non-standard extensions or third-party libraries to access vector types/instructions, or make due without them and just hope that their compiler is smart en... |
Overall cost and simplicity are the primary strengths of the layered architecture style. Being monolithic in nature, layered architectures don’t have the complexities associated with distributed architecture styles, are simple and easy to understand, and are relatively low cost to build and maintain. However, as a cau... |
I'm trying to make this function called walk in C. The idea is that the function takes as parameters a point in space (represented by an array), a function (pointer), and a step size / learning rate and moves from the provided point in a direction that minimizes the provided function. The problem that I faced is regar... |
When I read about DDD, it is always said that it is about behaviors, said in another way, actions than can be performed.
My doubt is that who should start the actions.
Suppose I have a bounded context (BC) about orders. For the example I will tell just a very few rules.
An employee receives an order.
The employee crea... |
When does it make sense to put data in elastic search vs creating secondary indexing on Primary datastore?
Elastic search with another primary store
Pros:
Primary datastore can be optimised for read write usecases.
Elastic search suports more than just key value matching like fuzzy match, etc.
Cons:
Out of sync with... |
I'm using a MacBook at work. Per company policy, no other devices are allowed. I am developing a Go application, the production environment is Linux and will be Linux only. But I run tests locally to determine whether my work is ready to be reviewed because the app, as far as I know, is not using OS-dependent features,... |
In this scenario, my renderer process' goal would be to make an HTTP request to an external web server and receive responses.
My question is: which options below would be more secure, give a future developer less headache in terms of the development process, and also be better as a general design approach (whether in c... |
Here is the design step by step:
User opens a webpage
Inputs few details in the form
Click submit
Request goes to API server
API server creates a pod in Kubernetes
Pod executes a script and stores the output in shared storage
Another pod keeps running and attached to the shared storage
API server waits for pod executi... |
I am trying to figure out how to design SaaS system that offers subdomain per customer (e.g. <customer>.example.com), where each customer is on specific region.
Due to compliance and regulation, some customers must have all data in specific regions. There are two deployments of existing system (US and EU) with differen... |
I am wondering about some architectonical decisions in our system.
There are situations where we are sending import business events through kafka which should be performed in every case.
All the cases are working just fine except one - deserialization issues.
We want to be informed when particular event has not been pr... |
Will anything that's written in c/c++ be rerwritten in rust?
for maintainance, even for performance?
|
Reading about DDD, i have read that it is needed to have a repository per each aggregate entity.
For example, in an ordering system, I should have a repository for the order and another repository for the buyer.
If i am not wrong, a unit of work it is to ensure that all the actions are processed as a unit, so if i do ... |
What is a good pattern to refactor a chunk of code where you can identify smaller chunks, but the results of these smaller chunks are used in other chunks?
An example should make things more clear. Let's say you have something like this (reduced in size to make things easier):
public Response CreateCustomer(CreateCusto... |
Background
I've been working with a team of 6 for the last couple of months doing enterprise software development. About half the team is very new (2-6 months). We loosely follow Kanban and manage/track work through Azure DevOps, with code reviews using pull requests.
Challenge
I'd like to get early feedback on my code... |
I would love an opinion on system design in a distributed system that operates under the same domain.
I have a bunch of microservices following the Database per Microservice pattern, and updated via events where each database stores a partial representation of an object, based on what information they need.
Due to chan... |
Let me first describe the situation
I have a component that uses dependency injection through a service locator. In the first scenario (image 1) the component needs a class that implements Interface0, so it just asks for it at the service locator, something like this (in pseudocode):
Inferface0 i0 = serviceLocator.get(... |
I have a question related to the best approach when resources are limited, such as on the Azure Function consumption plan.
I have an IoT device, and the number of IoT devices is likely to increase to several hundreds, then progressing to a few thousand. These IoT devices need to be instructed to switch on and off exter... |
Basically I have this class file which was getting quite large with functions and type definitions.
Is it best practice to keep all the code that works on the same aspect in the same file for "Single Responsibility Principle" or should you move parts out to different files, perhaps in a folder with the name of that old... |
Because I have multiple entities with unique fields, I need multiple repositories for each one even though each Entity will be handled exactly the same. What is the best way to handle these separate repos without repeating code, minimizing if statements, and avoiding code smells?
Originally I chose for the Service to h... |
I'm looking for some advice/recomendations on structuring an application which involved multiple classes that need access to each other for the sole purpose of tasking (i.e. class A needs to pass something to class B for processing, but class A doesn't care about the result. Class B may later produce a result which nee... |
(I am facing this issue with code written in Swift, but would appreciate any high-level pseudocode solution, just so that I may wrap my head around the architecture)
I need to find an architecture that would allow me to store generic data into instances of a specific type.
Consider the following example:
struct Project... |
As part of an migration from .NET Framework to .NET Core we're looking to decouple elements of our monolith into more manageable modules. Ideally following a clean architecture/DDD/microservice approach dependant on each module.
Two major elements of our system include a CMS and an Ecommerce Product Catalogue.
Currentl... |
I have recently read about the so-called "distributed enum anti-pattern." In particular, as it relates to using enums in conditional statements. (The idea is apparently that if you were to add a new enum value to the enum, you might forget to update all your code that consumes the enum, leading to bugs. Violates the "s... |
Imagine the following:
Persons table: (Id, FirstName, LastName)
PersonEmails table: (Id, PersonId, Address) (to allow a person to have multiple emails)
Contacts table: (Id, PersonId, UnsubscribeAll) (special table, because only some people are in the role which allows them to subscribe)
Subscribers table: (Id, Contact... |
I have seen information that at least one of reasons why type placed before variable name is that it allows compiler easier evaluate size and type of variable. If so then how (what way) it eases this work?
|
Building on this answer here, and its comments it entails that subscribers need to know and locate the publishers in a traditional pub/sub system. It also entails that publishers need to live at least as long as the consumers.
One of the most widely known pub/sub systems today is Kafka. However, in the case of Kafka, w... |
I’ll try my best to explain, but for the closest context I could think of, imagine that I am building an analytics platform that allows paying users to sign up, place a tracking script on their website and track their website visitors’ data. This would mean anyone who visits their site would need to be able to make an ... |
UML is generally taught as a standardized way of diagramming software, however, I've heard recently that there's an actual grammar behind it. I've searched the UML specification and haven't found much that was sufficient in terms of describing an actual grammar.
Tools like PlantUML seem to have a text-based conversion... |
This is just an example of an (still incomplete) real-world project written in Rust using a clean architecture: https://github.com/frederikhors/rust-clean-architecture-with-db-transactions.
Goals
My intent is to have an app build in 4 layers:
entities:
some call this layer "domain", not important for now, just the mi... |
I'm thinking through adding a lazy-loading cache to my API. Currently, REST objects are filtered out (scoped) based on the user's role, and additional constraints in the system. Users of the same role may have access to different objects based on constraints made by administrators, these are accounted for in the db fil... |
Consider the following python3 code:
from abc import ABC, abstractmethod
class Food(ABC):
_food_factory_map = {}
_recipes = {}
@classmethod
def getFood(cls, foodName):
return cls._food_factory_map[foodName]()
@classmethod
def registerFood(cls, foodName, recipe):
def callable(f... |
I'm in a situation where we strive in different directions on how we should use user stories.
As an example we have a Salesforce (and the user) requesting a document to be created, sent and archived and so on.
The workflow is like this: SF -> Gateway 1 -> Gateway 2 -> DocGen
The work is done by four different teams, de... |
Domain context and requirements
So let's say I have the following concepts in my domain:
Company: it's just a bunch of data related to a company. Name, creation date, assigned CSA, etc.
User: again, name, joining date, etc.
Now the business experts come with a new requirement: we want to show a list of companies in o... |
Reading this interesting paper it seems that a lot of performance loss is due to scheduling overhead in tight loops. To recap: There's a variable called "Chunksize" which determines how big of a chunk (amount of iterations) each processing unit (effectively a thread) will claim to later execute in private context.
The ... |
Situation
Object MyObject needs to be sent to one of our downstream systems depending on the enum value of its field myField.
public class MyObject {
private MyEnum myField;
public MyEnum getMyField() {return myField;}
}
For this we are using the strategy pattern implemented with lambdas, like so:
public class Pro... |
Based on the data structure of the AVL tree, I implemented a memory manager that does the best matching according to the size. I originally thought that the speed would be fast and the length of the memory heap would not be too large, because it was matched according to the optimal size. However, when I use the valgrin... |
Say there is an user that wants to query a random element during runtime from a dynamic struct. The type of the data is unknown, but all the data is either a integer (size unknown), float, string, or vector of one of the aft-mentioned structs, and the struct implements the queryable trait, which mandates that the struc... |
I want to understand what is the main difference in these two diagrams when it comes to the Model-View-Controller pattern. If there is a difference, how should I choose to construct my program? What conditions should make me choose the first design (or the second)?
But I am not even entirely sure if they are different,... |
I'm creating an application based on the microservice architecture and stuck on notifications microservice design. Basically it should be a service that notifies users about events happening in the app through multiple channels. Channel selection should be performed based on user preferences for particular notification... |
The system I'm working on started as a small training project within the company I work for but quickly caught interest from management as a means to help to standardize the existing excel-heavy workflows. I'm one of the lead developers on the project, despite having no lead experience prior and only being in my third ... |
how to support to vendor libraries. Apart from file changes, and APIs, the new version is 64 bit whereas the old is 32 bit
What's the best design and implementation effort to support two version of a library.
Lets call them Lib_v1, and Lib_v2. We want to reduce the amount of code base changes that call the existing 'L... |
I'm building a mobile, in which the user is able to create,modify and delete entries in a database. There are multiple screen where some of the entries are displayed: (here are some examples, not exhaustive)
Screen with the list of the entries
Screen with details about one particular entry
Screen with some statistics ... |
I have an endpoint that returns whether a resource is valid or not (true or false):
GET resource/{id}/valid
Where the returned value is not a field of the resource and is dynamic, it does not depend on the resource alone but on other factors that can change in time, meaning that if I call it today and returns true, to... |
Good software is always designed based on different modules before integration. I was wondering what rules/guidelines decide software partition into different, smaller modules during the design phase.
|
I have a function (written in Python) that processes a loosely structured log file.
The log file would have begin-end markers for different sections, with each section describing different things (e.g., errors, assertions, warnings, property dumps, etc.). Sections could repeat for different operations or different obj... |
I have a DigitalOcean droplet on which I have deployed a Docker container (Docker version: 20.10.14), but my app is sometimes slow, therefore I would like to allocate more resources to it.
The droplet has 16 CPUs. When I run docker stats, I can see that my container's CPU usage averages 120-140%.
When I monitor my drop... |
We're designing the architecture of an embedded device (esp32). One of the tasks is that the device should connect to the internet and use a preprovisioned redeem code to register itself with our web cloud. Within the same message the device will upload a random generated password to the server which is then stored in ... |
I realize this sounds similar to How is layer between MVC controller and back-end called?, but that didn't quite clarify the situation I'm facing.
I have a backend system - for the sake of an example, let's say it's a company calendar system.
The system has some core domain logic implemented in a service layer. There a... |
I have a distributed platform which allows customers to make purchases, and the items which are purchased are stored in an inventory:
Sales app -> PurchaseEvent -> Inventory app
The Sales app raises the PurchaseEvent onto a message bus, which is asynchronously consumed by the Inventory app. This all works great.
There'... |
I have the following piece of code. Line 1 is a container (for simplicity, one can think of it as a list of elements e1, e2, ..., en). Now there is a function function_fun which takes as input an element ei and returns a list of elements. So finally we need to recursively keep processing elements from container and app... |
I have a class Character who has a list of Spell objects that he can cast.
abstract class Spell {
name: string
manaCost: number
abstract cast() { ... }
}
class InvisibilitySpell extends Spell { ... }
class FireballSpell extends Spell { ... }
class Character {
mana: number
spells: Spell[]
add... |
What would make more sense, to use functions for exports/imports:
// globals/helpers.js
exports.fnOne = () => {}
// features/user.js
const {fnOne} = require()
Or class-based approach with static methods?
Same question goes for features development. Should I create functions within user.js and export/import them in my... |
In the picture above class of the type implementation will at some point receive a class of type C1. Classes that implement Contact will at some point hold references to C1.
So should the diagram be more like
|
I have simple wrapper class around C-style array. I don't want to use std::vector since I want to have only one array even if I do copy of the struct. With std::vector the vector is also copied.
struct RawDataArray {
double* data;
size_t size;
static RawDataArray CreateNew(size_t size){
return ... |
I have the following Supabase db structure for my web app
Project -> Stage -> Logbook
A project can have many stages (stage has a foreign key for project)
A stage can have many logs (logs have foreign keys for stage).
Now, in the UI I need to be able to show logs in terms of a selected stage or selected project – I'm... |
When reading through the ECMAScript specification, I noticed, it actually never mentions concepts like "pass by value" or "pass by reference".
When looking at the assignment operator, this is how it is specified:
An expression like
let a = 4
would lead to path 1.d. Which basically just sets the value of 4 to a. But sa... |
I'm building an app where I need access to quite large reports about different publicly accessible URLs, JSON objects about 200kb to 500kB in size. Each user would generate hundreds of these reports per month and I would need to store them for some months at least.
First I thought I'll just write them into to my Postgr... |
As an individual developer, I often find need to write a trivial (let's say, under 100 SLOC + tests + docs + build system config) library that helps me to write code of some other (large) project in a simpler and more readable way. The libraries are unrelated and often simply add some feature that was missed out in som... |
Kind of a yes/no question, if so, how?
If the customer is unsure of his requirements and keeps changing them, on what basis are the software testers supposed to test the software to assess its quality? Is it even possible to test the software?
|
I am wondering where do I need to put email delivering logic in DDD applications? I have the impression that it is in presentation, because it is showing stuff to users and the domain usually does not care about whether the data is presented through a web application, mobile application or email.
Though the channel mig... |
Here's an interesting scenario, consider a cache with many buckets, and resources that can be shared between buckets:
Bucket
Highest to lowest priority
Foo
A, B, C, D
Bar
B, C, D
Baz
A
In the example above Foo and Bar share the resources B, C, D; Foo and Baz share A; and Bar and Baz share no resources.
... |
I'm trying to understand the best practices of Github Actions when splitting a workflow into multiple jobs.
First of all, is it generally a good idea to split a workflow if the steps are logically indepentent?
The most classical example, let's take a project with a build, a test and a deploy step. Is it generally bette... |
I have a base abstract class that have many methods, and multiple subclasses that extends it and implementing the methods. I have another type of subclass that need to wrap the subclass and extend some of its methods.
Example:
abstract class AbstractClass {
item: Item;
constructor() {}
abstract setItemType()
... |
I am trying to explain and understand a way to create object which cannot have "default" instances. Typically I want classes which represent, as closely as possible, the real-life concept I am attempting to model in software. What I mean specifically is, if it doesn't make sense to create a "default" something in the... |
Assume I have a set of nodes of an n-ary tree, packed in a dense array in depth-first order.
This tree (I'm showing links between each parent and its list of children):
[A]
|
[B]--[E]--[F]
| |
[C]--[D] [G]
would be arranged in an array as [A, B, C, D, E, F, G].
I'm working in a memory-constrained ... |
I have around 6 years of experience in SharePoint, ASP.NET MVC, ASP.NET Core MVC & SQL Server. Now when I want to take a decision, if the project should be implemented using SharePoint/PowerApps or using SQL-Server/ASP.NET-MVC, is the complexity of the relation between the entities. The less complex the more I go with ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.