instruction stringlengths 34 36.1k |
|---|
In tests, state verification or collaboration verification is usually undertaken. One of the drawbacks of this approach is the coupling of tests to the design of constructs. Consequently, when business-specific signals exist in the application - for instance, at the debug level of logs - verification could be focused s... |
Let’s say I have a booking microservice (single instance) with its own DB.
If I want to horizontally scale the service with multiple instances(exact same copy of the business logic code) running on multiple servers(with zookeeper keeping a track of service registry and centralized configuration)
What efficient changes ... |
I have a series of .NET kubernetes services that all need to retrieve dynamically a series of configurations from a database, since the deployment of this infrastructure is going to be on-prem for multiple clients each with a different configuration.
This means that configuration-as-code and all the cloud-based solutio... |
I inherited some code that I have spent some time reviewing to get a better handle on its design.
There is one class that I came across that I have an idea for refactoring, but I am wondering if it I could get an opinion on whether or not it would make the design clearer.
The class basically contains 4 properties:
publ... |
I'm a Software Engineer who sometimes need to review the code of my fellow team members. I often look at the source code and think; this looks fine. I'm having a hard time to think critical about it. I can be very critical when writing code myself since I'm active/highly involved with the code, but looking at it more p... |
During my limited professional experience, I have been involved in microservices projects with a common structure:
The Controller takes a request and validates it using the jakarta.validation.Valid annotation. After validation, it passes the request to the service.
Inside the service layer, a Mapper component maps the... |
I need to create a WPF application that gives me the possibility to connect to other computers in the same network. I'm looking into Windows Remote Desktop Services, but it seems like it doesn't have a screen sharing feature, necessary for me since I don't want the remote machine user to be logged out of their session.... |
I read a question about using a 32bit random number as a "unique" identifier. One of the answers asserted that a "rough guide" to estimating collision likelihood is that there's a 50% chance of a collision once about sqrt(n) numbers have been chosen.
This would mean that for a 32bit number you'd have about a 50% chanc... |
I have a process in golang that I want to kickoff through a RPC call but then have the function return early whilst the process continues in the background. Specifically it’s just a basic db transfer from one db instance to another.
At the moment they way its working is I have my function kickoff a go routine and retu... |
We have an API that allows clients to POST some request which takes some time to complete, so the API simply places it on a message queue and returns a 202 (Accepted) and a new GUID in the body.
The client then can use this GUID to call a GET endpoint to check on the status of their POST request.
Suppose they call the ... |
I am currently writing an application that is going to be an adaptive quiz-like site for studying. The idea is a user is studying some topic and they are given questions on the site and enter their answers. As they enter in answers, the site's backend does some logic to compare the questions they missed with the rest o... |
I maintain a large legacy app working with SQL database. The app uses raw SQL queries to query the database. Together with app rewrite I plan to introduce ORM to work with the database.
The simplest solution would be to keep the database in current state and build ORM mappings based on the existing database. It seems t... |
For context, I'm trying to make a span type that has a size type parameter, which mimics much of the std::span api.
std::dynamic_extent is not zero in C++, instead being defined as -1ull or std::numeric_limits<std::size_t>::max(). when the Extent ntt parameter of a std::span is std::dynamic_extent, a size member variab... |
In my understanding, the strengths of not using type are flexible and newbie-friendly, and the strengths of using type are easier to debug and reading code. However now you can use types on dynamically typed languages like Python or Javascript (technically on Typescript) which seems to me having the best of both worlds... |
I'm trying to learn Observer Design Pattern and I started to watch the series which belongs to codewithmosh called "The Ultimate Design Pattern Series".
in the lesson which was about Observer, he says:
This is what we call a "Push" style of communication. because the
"Subject" pushes the changes to the observers.
How... |
I have been working almost for a year in my current place. It is a product team over some domain.
Here are some example reviews I am getting every now and then (Scala).
Removing unneeded wrapping curly brackets from a function definition with single expression inside which does not even give a warning or anything. Sho... |
If I have for example a User POJO like the following
@AllArgsConstructor
public class User {
@Id
private final String id;
private String username;
private String password;
private Date createdDate;
private Boolean enabled;
//getters and setters
}
And I want to post a User and have an API like the following
@Po... |
We have a DB Service (Apache Druid) running along with prometheus,druid-exporter and Grafana deployments all being managed in the same namespace using k8s. We often see our prometheus or Grafana deplyments go down, and we need to set up alerting for the same. But when I look up k8s observability I see that it is again ... |
My vanilla PHP backend app needs to be rewritten due to very poor design and lot of unstructured code. The legacy app is very large and the team small, so doing full rewrite in limited time is quite risky.
I need to introduce PHP framework into the codebase and as a result the design of almost everything will change (r... |
How important is the minor version of the Java Build SDK vs. the JDK version at runtime, is it a problem if the minor version is a bit outdated, if the run time version is still up to date?
More details:
We are using Java 17 to build an application, but it is an outdated Version of OpenJDK, i.e. 17 GA (build 17+35). Th... |
I want to express a functional requirement along with some extra detail to constrain the functional requirement more but i can't seem to find out where to put the extra detail.
E.g. if i have a functional requirement "The system shall calculate the total number of users" for a web-based shop and i want to express that ... |
I have multiple maven projects ( rest services ) with common domain model. I would not say micro services. Structure is build this way to eventually move towards mircoservices.
All the maven projects have dependency on domain model package.
All custom validators are part of domain models package only. For validation o... |
My question is focused on CMake C++ projects and separating out code into multiple repositories for re-usability, and somewhat mimicking a naive package management system. For now I would like to ignore any possible package managers like Conan or vcpkg.
Suppose I have a C++ repository PackageA that uses CMake and suppl... |
I recently changed my job to a big MNC and the code I am exposed to is highly complicated, difficult to read and understand. Although it is divided in microservices and runs on local I have to keep running it on local step by step and many times the methods are tediously long and not just abstract with bunch of hacks a... |
We are migrating a template that was a mere questions array questions
[
{
type:text,
name:first,
value:What is our name
},{
type:radio,
name:favourite fruits,
value:[
{banana},
{apple},
{pears}
]
}
]
to a library like SurveyJS (this Json is complex, can maintain page... |
I recently fell in love with Factor , a programming language in the Forth family that enforces use of whitespace around identifiers, this allows creation of "functions" with extremely terse yet readable names, like [1..b] (it generates a range of integers from 1 to argument (inclusive), there is of course also [1..b)) ... |
I'm facing the classic chicken/egg problem of where to store the keys to the kingdom.
I'm building an application for retail distribution that will rely on receiving a cadence of regularly-issued Let's Encrypt certificates via a central website's REST API. The website will perform the regular task of renewing and stori... |
I have certain dependencies in my project like sequelize-auto which are not required in production, since we only need to generate the models once during development. Even if we make changes to the database, we won't need to use sequelize-auto again in production.
In my package.json file, I can make a distinction betwe... |
After reading the whole question, you might think why I even need this, but believe me, it has a crucial usage in my project, which is very broad and complex, so I will only include the things directly related to the actual question.
I am working with metaprograming, so to ease things enough, I declared a helper class ... |
There are two ways to provide a way unsubscribe in Observer Design Pattern.
1. Provide a simple void UnSubscribe method:
public void UnSubscribe(IObserver observer){
// remove observer from List of Observers in current observable class
}
2. Return a UnSubscribe class upon subscription
private class Unsubscrib... |
I'm learning DDD and I have a question.
Suppose there is a Graph entity with associated Node and Edge entities, corresponding to the vertices and edges of the graph. A node represents some business domain process, and an edge represents the interaction between processes.
There are some business logic rules. For example... |
I am working on digitizing old photographs, articles, ephemera, etc. related to my town's history, and I've been tasked to put these scans I've made onto a website for the public to see. There are several hundred scans that need to be made and was wondering if this is the right approach when working with the metadata f... |
I have an idea for a mobile app, but As I'm not from a Software background, I need to know how much the backend operations will cost before I commit time and resources to develop this idea. In this manner, I will be able to determine the likelihood of success for this project. I'm hoping this group's experts can assist... |
When my website sends emails to set or reset the password, they sometimes don't arrive at the recipient.
This problem does not arise for email addresses at large providers (as Google or Microsoft), but often email servers of schools or state institutions.
I guess that this is due to some bad spam filtering, where the e... |
In a scenario with multiple teams, each overseeing a few microservices that collectively create a larger system, and where these services frequently use MongoDB databases, is it advisable for each service to set up and manage its own MongoDB database server?
This approach seems rather complex. Alternatively, what if th... |
Abstract (virtual) interfaces allow you to explicitly declare a set of methods which a child class must implement in order to compile and be used with other parts of the code. This works great for most problems, except with one drawback, you must pass/store pointers/references to the interface class rather than the cl... |
TL;DR: Given a repo with a lot of big fixture tests, when should I look for a solution where the golden files are not part of the repo anymore? Where should they be stored?
The setup
Testing a complex data processing project with very diverse input sources
Around 10^2 CSV files as fixture tests, each a few MB in size ... |
I have two microservices, say "students" and "courses", they represent separate entities that are managed separately by different teams.
A given student can be enrolled in multiple courses. In a monolythic app, I'd just use a students-to-courses table to do the mapping and would be done with it. What's the recommended ... |
TLDR;
what if you are tasked with taking out a feature and making it app 2 to reduce memory/compute foot print from app 1? Making an API contract between app 1 & 2 would defeat the purpose because APIs run on app 1.
How then could we split a feature from a monolith that relies on the same data of app 1?
I need to rev... |
We have multiple developers contributing to a project, using Git as our repository. We have a QA branch that matches our QA environment and a master branch that matches production.
Features can be in QA for weeks, because other more urgent requests come up, or there are issues with a particular feature that take the de... |
I've tried web search and wiki and could not find mentioning history records.
I don't buy an argument stated in Is there any practical trick to remember the difference between big-endian and little-endian? that there are two ends of a sequence.
Try to ask somebody to open a book at the end and see how often the person ... |
So I have two identical classes, say ClassA and ClassB. In both classes, they operate on the same kind of data classes, and the method bodies are exactly the same. The only difference is that the imported classes, which identically named in both ClassA and `ClassB, come from different packages/projects. That is,
//Clas... |
I'm looking for advice on how to design the data model for a project I'm working on. I'm not really sure where to ask such a question. I've been using StackOverflow for years, but this problem is a bit too abstract and theoretical for that site. I hope found the right place here.
I will first try to explain what I'm tr... |
The traditional non AI software with if-then-else and loop statements can be fully controlled. In contrast, machine learning software behaviour is unpredictable since the developer cannot control what the software learns from the data. In particular, large language models (LLM), which are a form of neural networks, are... |
I have an app with "clean architecture" classic layers:
Ports (such as HTTP, GRPC, GRAPHQL resolvers)
Services (CRUD methods and others)
Adapters
Domain
My app has of course multiple "models" such as:
Player
id: String (mandatory)
firstname: String (mandatory)
lastname: String (mandatory)
age: Number (NOT manda... |
I have a server(API) written in Flask and a client(mobile app) written in React Native. The application allows for logging in with either email/password OR with Google. The Google authentication flow works as such:
User presses on the Sign in with Google button;
Frontend sends the user to the API endpoint /api/google/... |
I'm building a reddit clone on top of software that must incorporate a legacy neo4j graph database to track user actions. I also want to use it to store the comment/post data. Assuming this new app is basically used like any other content aggregator site, would it be better to store all comment data in each node or onl... |
TL;DR: Using GitFlow, which commit do you tag to identify the build of your next release? If you tag the merge commit on main, you'll need to rebuild and deploy something you didn't test on QA (and this contradicts "build-once, deploy anywhere"). If you tag the last commit on the release branch, your commits on the mai... |
We are developing a multi-user web-based application, where the users can join a "room" and a complicated handshake has to be set up between them, to be able to use a library on each frontend side. This session/room logic and the handshake that has to be set up goes through a backend server with WebSocket communication... |
I did research about this and I'm facing with two challenges:
how to handle version deprecation in my CI/CD pipeline, when we have more than one major versions officially functional and others deprecated.
how to handle documentation of the project
The project is a .net web API(uses Swashbuckle for docs) that uses Git... |
I've been working at this company for about a year now. it's a growth company working in B2B. I'm one year out of university, with a major in computer science. I work in the web team, using an Angular frontend and node as the backend. Throughout my time here it's always irked me how little effort seems to be put into t... |
I have lots of devices, each identified by a unique UUID. For each device, I have one or more timeseries data (potentially up to millions of entries).
What's the best way to store these entries? Whatever I do, it seems to me that:
either I store the UUID of the device with each time series entry, which wastes a lot of... |
I make sure when designing software/firmware to make heavy use of dependency injection so that different pieces of the application are not directly coupled to one another. This also allows me to (potentially) unit test each piece of code using mock dependencies.
However, the dependencies that need to be passed into co... |
I am designing an aggregate that has list of keywords as its property, and it has constraint that two aggregate cannot have same keywords as its property.
I use repository that has save and saveAll method when persisting aggregate, and each run in a single transaction. And Factory pattern is used when creating an aggre... |
I'm converting some old MVC/Service code to CQRS/DDD.
To create a user, I need to:
call an external service to create an account in that system, and retrieve the guid associated with that new external account.
create my local user domain object (which requires the externally created guid) - and store it in the local d... |
Behavior-driven development is meant to be used at the business/user level.
However, I find the keywords "Given - When - Then" a good format for technical stories as well, but I am very green, and so maybe I'm missing something?
Is there a better format to track technical debt, or tasks under user stories?
|
I have an offline-first mobile app. The user enters data, data is saved into local SQLite database.
The server has Postgres database. I need to build a two-directional sync strategy that keeps data on the server and on the client in sync. Here's what I want more precisely:
Bi-directional sync.
Small data volume (hundr... |
Our codebase has a typical base-class with a ton of sub-classes. The base-class already has many default functions for the sub-classes.
However, one particular function has the same verbatim implementation in almost all of the sub-classes. (Each of the rare cases has its own unique implementation.) The rationale I hear... |
I am an engineering manager and I manage an engineer who is responsible for a backlog with long lasting development tasks and many bugs arriving a few times a week. We work in scrum sprints but when a bug is arriving we prioritise it over the sprint items. Lately the developer is complaining that they are constantly in... |
I have a good understanding of when coroutines in Kotlin are superior to threads. I know that coroutines are lightweight and are great for massive concurrency when, in contrast, spinning up lots of threads is costly in compute resources, memory consumption, and possibly other ways.
I also know that coroutines are ultim... |
This is a simplified representation of the existing data structure I have in my code (The actual data structure is composed of classes), the data of which I need to display and modify via multiple views:
struct StopData {
QString name;
int id;
QList<Amenity> amenities;
...
}
struct Amenity {
QStrin... |
I took over a development team working on life-safety critical software earlier in the year. The product has been in development for about 8 years, but the current team has only been working on the product for about 2 years. I’m not a software engineer by trade, but have been a system administrator for a ~300 person or... |
I'm a novice in architecture. Now I’m reading Clean Architecture and I don’t understand one thing. I'm wondering at what stage should I create components? Before any design or when I already have some design and implementation, something like this:
P.S.
It seems to me that the answer is somewhere in the middle. Compon... |
I'm working on adding unit/integration tests to an existing project (Java/Spring Boot) and I've been investigating on how they are "separated" in order to cover the test cases and how to focus each type of tests based on what they are written for.
To put things simple, my two questions are:
Is it a good strategy to co... |
Given a system where users can access different services through the API for conducting business transactions, I am currently working on integrating a read-write lock into the system. One approach I am considering is manually adding the locking logic to each method within the service:
class SomeService {
func DoBus... |
A pattern I have noticed in many big C and C++ programs - including Microsoft Windows (REG_SZ type in Registry) and Valve's Source SDK (names of practically every string variable) - is that "sz" is used as an abbreviation for "string". Why is it "sz"? What does the "z" stand for? Where did this naming convention origin... |
I have a wide CSV file of about 350mb, and want to load it into a SQL database and properly model the data to make it easier to use for analysis.
I could split the data into tables with python and then loaded into sql
Or load the file into the database as a table, and then split it using sql.
What would be the standa... |
I have several million booking rows in a table and would now like to save the totals of the booking amounts in another table depending on the customer, account no., product, etc.
Should this necessarily be done at application level, or can the database (MySQL InnoDB) also do this reliably with INSERT INTO SELECT? I cou... |
If a lambda is frequently used, it is considered to reuse the same instance instead of creating new instances repeatedly.
How can I minimize the number of captured variables in lambda expressions?
|
I'm writing a C++ class, CBookSpellDef which has the following methods:
int GetIndexOf(const char *psz);
char* GetNameAtIndex(int index) { return m_spellTypes[index].szName; }
char* GetWeaponNameAtIndex(int index) { return m_spellTypes[index].szWeaponName; }
int GetBasePowerAtIndex(int index... |
In my current monorepo structure for frontend, this is how it looks:
apps\
jira\
confljuence\
packages
ui
utils\src (contains common utils like useDebounce.ts, isEmptyObject.ts, etc.)
From what i have seen in most monorepo examples(open source) people put only non business logic stuff in utils package. I ne... |
I'm refactoring a common web app (not spa but traditional server side html rendering).
The design/code organization follows more or the less the Clean architecture concepts (ie:
controller calls a use case layer then pass the UC response to a presentation layer).
The technical environment is PHP/Symfony 6.
about vocabu... |
I am making a .net Maui QR code business card application and the application will not have authorization features such as member login and registration.
And my app needs to be able to create business cards for my user, store those business cards, and save new business cards.
How can I provide this feature? Is it possi... |
Update: Forget the 'best' way, any way to start with is good enough. I am new to this and figuring it out all by myself is taking too long. I don't even know where to start.
I am new to this and unsure where to start.
I have 5 ML models deployed as 5 microservices, each with its own Docker image. Together they form a p... |
I'm trying to practice BDD by applying it to a simple problem—in this case, the flocking algorithm, better known as "boids".
Before any of the rules (cohesion, alignment, etc.) comes the most fundamental behavior: movement. The rules mutate a boid's velocity, but that means nothing unless the velocity mutates the boid'... |
This question is language/framework agnostic. EDIT: The comments and answers have highlighted how different languages approach events differently, which made me realize this question isn't really neutral across languages or frameworks. To clarify, I'm using Vanilla JS, and my components are built with Web Components. W... |
I've been at my current job for about 4-5 months, mainly working with Go, and I have no prior experience with Kafka. Before this, my background was in JavaScript, Node.js, React, etc. I recently got a simple task: write a Kafka-based agent that listens to a topic and stores all events from this topic in a database. I b... |
Not sure whether this is a fitting place to ask such a question, but here goes...
I learned about simple machine learning and supervised/unsupervised training back in Uni, where I specialized in machine learning, but haven't been able to utilize/practice that in my day-to-day work - which I am trying to do now.
What I ... |
I have been working on launching high-altitude balloons (HABs, or weather balloons) and I have been using LoRa to enable long-range communication with my balloons. It's been great and pretty reliable, but in the best case, I get about 50 kbps and usually a bit less or a lot less when we start getting to really far hori... |
I've set up a ternary operator in place of a pile of if-else's, the final expression being nullptr in order to finish the loop, like so:
int menuSelect;
std::string operation="";
(menuSelect==1)? operation= "string1":
(menuSelect==2)? operation= "string2":
(menuSelect==3)? operation= "string3":
(menuSelect==4)? opera... |
So I am working on this mobile application using MAUI, which is backed by a Rest API in ASP.NET Core.
I want to be able to use the app offline, and the user can create/edit some data. This data is store in a SQL lite database, locally on the device. But it has to be synced to the Rest API as well, so the user can get a... |
I'm a beginner, but competent at code and have some setbacks like this where it doesn't really matter- but I like making it easier and legible to understand my code.
Anyways, yeah. I just have problems with three word sentence fragments - should they be amountOfColors or amountofColors?
|
When Visual Basic came out, it was revolutionary for its drag-and-drop GUI designer, allowing users to quickly create GUI programs. This video shows Bill Gates introducing it in 1991. Did drag-and-drop GUI designers exist before this? For example, did Apple have a similar tool to design GUIs for the Macintosh 128K, or ... |
I was going through this blog - https://www.notion.so/blog/data-model-behind-notion
Which talks about how each page can inherit permission from parent page.
we use an “upward pointer” — the parent attribute — for the permission system.
Take for the following hierarchy:
Here if at Root page 3 users have access rights... |
I am developing a package that requires some very large (>50 Mb in some cases) artifacts to work for some of its features. This makes distributing this package annoying, as if I include these artifacts inside my bundled package, users will have to install a huge dependency even if they might not even need said artifact... |
I'm trying to model a specific domain using DDD techniques and have some doubts. To better contextualize, a brief description:
It's a domain of deliveries and delivery confirmation. We have two main actors:
Customers who bought products and need to track their deliveries
Drivers who receive travel schedules with mult... |
Anybody have advice on splitting up a large SQLAlchemy model into smaller parts? I have a ~2000 line model called Article that is becoming difficult to manage. We often have to scroll and scroll to find code that needs updating. It's doing four main things, with each of these methods calling smaller methods, all on the... |
I was reading these best practices for Angular project specifically for understanding models and DTOs.
What I have understood in general from different resources and the above one also is that
We should have DTO to match exact response structure coming from backend APIs
We should have model classes to use to show data... |
From what I've read, domain services typically don't import or rely on Repository directly in theory,The responsibilities of domain services focus on handling business logic and coordinating interactions between domain objects.
But in actual development, I found that I had to call the data warehousing interface in the ... |
For instance, I've started working on a new feature and created a featureX branch. Later, we decided that we no longer needed the feature. What should I do with featureX?
I see value in keeping the branch around in case we change our mind on it again.
My strategy is to push that branch back to the remote and delete it ... |
I made some changes that, after testing, I decided not to use for now.
Thus I don't want them in the main branch.
However, I don't want to discard them altogether (maybe I will need them later?)
What should I do?
The easiest option is to commit them and immediately revert (don't laugh).
I suspect that what I am suppose... |
Abstracted problem
I would like to be able to quickly refer to some (most likely non-hashable) objects. At the same time, I would like them to be aware of their own identity. The 2-way search should be consistent, so at no point should an object give out an identity, which would return another object, had someone reque... |
I'm currently implementing clean architecture in my project.
My application includes various types of communication protocols (TCP, HTTPS, etc.) implemented in the infrastructure layer.
These communication protocols are responsible for handling incoming and outgoing network communications.
I need to process the incomin... |
We have a large(ish) real-time embedded system. It's VxWorks, if that makes any difference. It has some C code in DKMs, but is 95%+ in C++.
It has absolutely no exception handling, nor Posix signal handling. It is multi-threaded, so if one thread/process/subsystem dereferences a null pointer, or access a non-existent v... |
I have the following use case. We have both a frontend application and a backend application. Earlier, events on the frontend application directly call the backend application. Now we want to introduce an orchestrator (like Camunda or similar in-house product) between the frontend and backend applications. Following wi... |
Consider Chess as an example. Say, we have a lot of domain objects that are alike, in this case chess pieces. I have two proposes to implementing the behaviour of chess pieces. Both uses the following interface.
interface IPiece {
// ... shared behaviour
bool IsValidMove(int targetX, int targetY);
// ... mo... |
Hobby coder here, so please be gentle! My coding is taking me into the necessary realms of architecture due to increasingly complex apps. I'm wondering how to structure my solutions which will involve separating off layers to separate libraries whilst implementing the MVP model (specifically, the 'observing presenter s... |
From Ch 12 (Resiliency) of the book "Building Microservices"
In the context of how much resiliency is too much resiliency
How long should various operations take? It can be useful to measure this with different numbers of users to understand how increasing load will impact the response time. Given the nature of networ... |
I'm working on designing a shopping cart system that respects the single responsibility principle. However, I'm facing a challenge when it comes to handling cart creation and updating separately.
Scenario:
When a user logs into the website and adds products to the cart. Currently, the "add to cart" operation also impli... |
According to Eric's definition of entities: "An object that is not fundamentally defined by its attributes, but rather by a thread of continuity and identity"
Does that mean apart from all the attributes every entity should also have some sort of status enumeration in them?
e.g. Order entity going to have OrderStatus, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.