instruction stringlengths 34 36.1k |
|---|
I have a product listing service, and it will give a list of products for the logged-in users, and the list is paginated, with ten products per page. I implemented this pagination using MySQL LIMIT query.
Recently I got a requirement to integrate it with a relevancy service; this service will give product attributes re... |
I've been trying to better understand (at least at a high level) why the early versions of HTML were designed the way they were. Most of the decisions make sense; I can deduce (at least at a high level) the probable thought process that lead to the design.
But one design decision doesn't make sense to me - whitespace c... |
I've got a class that is a facade class (encapsulates complex-ish behaviour for reusability). It has a function called manage (the class is called Manager):
function manage()
{
$entityBuilder = 'Some builder';
$someData = 'Some data';
foreach ($someData as $someDatum) {
if (!$entityBuilder->doesNeed... |
I have a collection of many millions of objects, each with a unique id, each composed of tens to thousands of values. Values in this case are simply arrays of floats, with dimensions in the tens to a hundred.
The same value can be present in different objects, thus duplicate values are many, taking up to 70% of the vol... |
After doing some research regarding the actor model, Im still not really sure what an actor actually is.. and what its supposed to "replace".
From what I have understood an actor is supposed to be an entity of some sort.. (a thing), and we use the actor model to change state of entities by sending and consuming message... |
I'm wondering how a rule tailored for a specific UI is handled in a context of DDD and hexagonal/onion architecture?
For example, if you have a screen for an inventory app where you can create product which are displayed as a list. The specifications tell you that newly created item should appear at the top of the list... |
I'm struggling on how to name classes for use cases. Because I know that is "bad" to use verbs in classes names(Uncle Bob) but at the same time names of use case classes should explain what they do(Clean Architecture). So if I have an use case "create user" Is it ok to name it " Class CreateUserUseCase" or how should I... |
I have this use case (I've simplified it):
Each student can apply for one or multiple activities. As of now we only have Swimming activity onboarded on the system, but we expect to have more. Base activity is not abstract because it's the base activity if the student doesn't like any of the activities on the list.
I w... |
I'm not a frontend dev, but I recall that a few years ago, the this keyword was commonplace in frontend codebases.
In recent years, I haven't seen this get used anymore. In the last few frontend codebases I've worked on, I haven't seen it get invoked at all. Did it get obsoleted by recent developments in JavaScript, or... |
I have an application which is configured through a web management interface accessed from the same network as the application is running on. I've been asked to make it manageable from the cloud using an HTTPS outbound connection (the customer in mind is doing MITM decryption on their web firewall and wants to sniff th... |
To use a dumb example, assume that particular users (labourers) can move boxes around. How would you go about representing that in your system in a semantic way that scales. I'm currently inclined to do the following.
class User {
// ....
lift(box: Box) {
if(this.role === UserRoles.Labourer) {
box.setPosi... |
I have a function to be tested
fn doNothing(Student student) {
//do some other operations here. but student is unmodified
return student;
}
And my unit test is
var student = new Student("Deepak");
assertSame(student, doNothing(student));
But if someone calls a setter on the student in the source code (student... |
Here is the conundrum,
I have a fairly complex Value Object and I don't want to expose it's internals. It should not be an Entity since there is no need for attaching an identity to it. According to Eric Evans in his DDD Reference book it is Ok to use a Factory in order to create complex Value Objects:
Shift the respo... |
I have a system landscape consisting of multiple applications.
Each application provides REST interfaces to communicate with the outside world.
Each application has its own data storage (some kind of database).
Each application writes persistent messages for other applications to consume.
Each application builds its r... |
I have a repository, which is a fork of a public project. The fork contains several additional commits with custom features - nothing fancy. Recently, I have been wondering what would be the best approach of incorporating upstream changes into the fork. Currently the setup looks like the following:
The fork has the ma... |
I find myself often adding more and more methods to a specific class, is this class heading in an unmaintainable direction? Or is this class fine even if it has 50 or more methods?
let's call the class PowerSource182, it handles the details of creating commands that are sent to a "PowerSource182" power supply (an exter... |
Let's suppose I have a processing workflow of:
Where:
The workflow can have many instances running at the same time.
A1 -> B1, C1 -> D1
A2 -> B2, C2 -> D2
and so on...
Each node is an independent process
Result produced by each node can be stored in a buffer database
The node D relies on the result of both B and C... |
How does antivirus protect itself from malware?
Some types of malware will kill the running processes and since antivirus is just another software like any other why they can't just kill the antivirus process?
I understand that antivirus will scan the malware before it can kill the antivirus process but still it does n... |
In the company I'm working in, we try to make our monolothic application evolve into a microservice architecture.
The monolithic app has of course a user table, let's say it's called UserA, and it holds the main user information (name, email, password, ...). The module I'm working on is an application on its own, but ... |
I am implementing a CQRS pattern in ASP.NET Core with MediatR, and I am wondering what the general consensus is for handling duplicate validation logic for queries/commands which operate on the same underlying model/entity.
For more context, I am looking through Jason Taylor's clean architecture project here as a gener... |
I have an application that has use cases relative to where it is used. A local client and server, where all the server data is in a single location and the client queries that server knowing it is all from that single location.
However the 2nd use case, the client application may connect to several of these location-b... |
Feature branch names already contain the issue key (ticket number). Should commit messages also contain them?
Pro:
easy to see where a commit belongs to.
better for third-party software tracking commits for issues.
Contra:
developer needs to repeat themselves. Issue key is already in the branch name, and retyping it... |
In REST APIs, http error codes 4XX, 5XX are used to convey error messages on the server.
When the API itself is dependent on another backend API, is it a good practice to expose error codes or error information from the backend API call? Is there a standard for it?
Can we share the the following in the error response w... |
Context
Let's say I have a navigation service that allows me to navigate to a page.
The Navigate method is async because an animation (about 250ms) is involved.
public interface INavigator
{
Task<IViewModel> Navigate(Type viewModelType);
}
Problematic use-case: Concurrent calls
Now imagine that have a botto... |
So, this is probably a repeated question, but I couldn't find a question which solve my questions.
At the beginning of the year, I started as a Junior Java Developer in a company that is in the market for 20+ years, so I deal with a lot of legacy code.
So far, so good, but something in architecture is bothering me. We ... |
I'm writing a virtual CPU, and I decided to create a class for each command, to make it easier to replace/add/remove commands without changing too much.
The original idea was that ICommand would be given an ICPUState to operate on, but then I released I'll have more than one type of virtual CPU. Most of the VCPUs will ... |
I wanted to learn Kotlin but after reading online most experts seem to agree that learning Java first would be a first step in the roadmap of learning Kotlin. Their argument based on the fact that Kotlin developers may use Java Library. However, I don't understand what is the point of learning Java if I'm at the end on... |
By "Automatic Reference Counting", I am refering to the specific feature of the Clang compiler. By "Garbage Collection", I am refering to Tracing Garbage Collection, not to "Garbage Collection" in general.
The main difference as I understand is that ARC gives you control over making optimizations if needed, while in a ... |
In my domain there's a part where I have a root entity, with some fields, and then some other entity inside that aggregate, like this:
class AggregateRootEntity {
... some fields ...
Entity listOfInstancesOfThatEntity = [];
}
Given that the aggregate can have, for instance, 200 instances of Entity in that list, ... |
In front-end projects(made in frameworks like Angular or React), when we correctly encapsulate complex functionalities, the components that really have some relation to the business logic normally became simple as a Form with default validations provided by the framework(or lib).
So, does unit test as "testing if wrong... |
For instance, if we have a complex library with many functionalities, how can we make this lib a plugin such that it can be replaced with another lib more easily.
The answer obviously is the dependency inversion principle, but how would this be done.
If we try to create interfaces that have the same properties and meth... |
I am trying to figure out the best practice for manual testing where there are multiple valid routes to reach a step in the test.
For example, a test for changing a password could be:-
Test 1
User invited to the system via email
User creates login
User changes password
Test 2
User navigates to website and creates lo... |
In the beginning, I would like to state that this is not meant to be a discussion. But I would like to receive only suggestions for possible solutions or, at least, a comment on my proposed solution:
I'm in my first steps to create a small tool that should help evaluate data from my master thesis experiment.
In this ex... |
I am working on a project that generates an API with the possibility of doing CRUD operations based on a high-level description of the resources that the user would like to have in an application. In the process of generating the code, multiple steps have to be taken (for some context, I am generating Python code from ... |
I came upon a situation where multiple classes manifest duplicated logic. They all delegate to a worker object, but when interrupted they have to stop the worker.
class A {
Worker w;
public void OnSleep() { w.Stop(); }
}
class B {
Worker e;
public void OnSleep() { w.Stop(); }
}
class C { … }
The issu... |
I have an application in which the user can describe an analysis job via a yaml like
analysis:
learner:
name: LinearRegression
args:
solver: liblinear
and then it is parsed to instantiate an sklearn LinearRegression model. Basically I want a whitelisted eval where I am "instantiating" user-input strin... |
I am designing a multitenant SaaS platform where the database will hold information for different clients.
The application consists of an Angular frontend and a REST API Backend.
Some of the clients want to assure the confidentiality of their data, so even though we accessed the database tables as admins we couldn't re... |
In my formal employment in software engineering/development, I've noticed a pattern. When I understand the domain reasonably well for what I am developing for, I can be much more effective by at least one order of magnitude. For example, I recently worked on some SQL database systems and simply having used databases wh... |
TL; DR
Where/When to check data format in MVVM + Repository Pattern is the best practice? Any suggestion or theory?
The Scene
Our team is working on an Android Project. We have a MVVM+repo structure:
View > View Model > Repository > Model
In some feature, we need to pass data from View all way through the struct, such... |
In my domain model I've got two principal entities: User and Event, both which I've decided to make aggregate roots. Users and Events have a one-to-many relationship wherein Users can create several events. However, an Event does not necessarily have a corresponding User (i.e. created by the admin) and has its own set ... |
I am trying to store user preference for notifications.
One way to do is store types of notification in separate collection and store UUID of that notification type in user table.
e.g. notification-type
{
UUID: 'a81ef539-290b-4f28-b364-548970307a66'
name: 'newuser',
title: 'new user joined your project.'
}
and t... |
First a bit of context:
My company develops a software and middlewares to make our software interacts with other software.
One of a client has a proprietary software we should interact with, he gave us the .h/hpp and the .def file which are needed for the interaction. He has some dlls that are used when our software is... |
let's say I have the following aggregate:
class Road:
company_id: int # another aggregate
name: str
stops: List[Stop]
def add_stop(stop: Stop):
stops.append(stop)
class Stop:
precission: Precission
latitude: float
longitude: float
address: str
This is just a minified example. ... |
Goal
We have an app with different articles. I want to cache an article when the user has read it, but make sure that I display the latest data. I came up with this hook:
React.useEffect(() => {
(async function fetchArticle() {
const articleURL = `${BASE_URL}/services/node/${route.params.nid}`;
try {
... |
The use case I was thinking about was something like this.
I want to make a calendar for a month as a custom element, and I don't think passing up all the event data as JSON or something is the best idea. So I thought about making some custom elements that don't actually render anything, they're just there to provide t... |
I'm still learning DDD and trying to model in my domain layer a Product that is made by none or many Materials in different quantities.
Initially I create two aggregates, Product and Material and one entity ProductMaterial. Product has a list of ProductMaterial (that has the MaterialId and Quantity) and methods to add,... |
So, one of the backend system, having 5 resource types (tables) and some foreign keys as well, requires full text support for two of the tables.
Also, for some use-cases, we require inner-joins for some GET requests (depending on user-query).
What I wanted to understand is, for GET requests should we only rely on Elast... |
Suppose we have a resource which uses either MySQL or ElasticSearch, depending on whether the query params require full-text search or not.
For example the possible query filters are:
fk_id which is a foregien key ID of the table, name and description which requires full-text search.
Should the resource URLs be:
Optio... |
Refined description
Because of great contributions, the description mutated as follows:
My application's purpose is to register customers into a system.
The requirement is: enable traceability for registration attempts under certain conditions, and it can be implemented by creating a boolean flag which can be used for ... |
DDD targets software with complex domains, which is usually the case with enterprise information systems. Traditionally, in the organizations developing this kind of software, there is a "systems analyst" (SA) role which faces the stakeholders, translating their needs into software requirements which drive software dev... |
Sometimes computers stutter a bit when they're working hard, to the point where the mouse location freezes for a fraction of a second, or stutters intermittently for a few seconds. This sometimes happens with keyboard input too, even in very basic applications (i.e. presumably it's not a complicated/costly handling of ... |
I have a situation where I think it would be best to combine two architectures but I am not sure if this is possible or that it is a good thing to do.
By combining them I mean taking certain parts of the architecture and some other parts of the other architecture and combing them to form one hybrid architecture.
E.G
Ut... |
This question has been in my mind for a while now, especially in the context of high performance, interactive 3d applications. Just want to find out what is the general practices in DoD for referencing other objects.
Let's take an example: Animations that need to update skeletons and an ECS that knows which animation t... |
For my job, I'm working on a project that involves working with robot sensor data. We've been using protobuf to serialize and transfer data. I'm trying to set up a new protobuf type but this data involves a large array (e.g. a million elements) of doubles.
So I have a protobuf file set up something like this
syntax = "... |
As a learning excercise, I decided to take a hand on Test Driven Development.
Now I decided that there is a test I want to make; check if database connection doesn't leave any unsaved changes.
The two options I can easily see are:
I could put the assertion at end of every test method.
I could add the assertion in clea... |
Let's take an application that provides a REST API. As part of the build process, both unit tests and integration tests are run against it.
At some point we want to spin this application up properly, deploy it, have it speaking to actual third parties systems (e.g. databases) and test it by firing HTTP requests at the ... |
I'm reading about event sourcing and have a question regarding the recreation of an entity state.
For a simple scenario, lets say we have Order events such as OrderCreated / OrderUpdated / OrderDeleted.
Now I understand that if I use event sourcing, than these event will first end up in an event store,let's say a kafka... |
I am learning Domain Driven Design and I cannot understand the difference between Repository and DAO. It seems to me that they are similar. Their roles and functionalities are the same, but why they have different names? I have read many articles and blog posts, but I couldn't find the answer.
Update
The most reference... |
I use Postgres database to store user information. Some of that information is sensitive so it was decided to store that information in Vault. The user table in Postgres has id's generated by a Postgres sequence and also it has unique identifiers for each user which come from an external system. My teammate wants to st... |
This is a question for software engineers who are tasked with managing the development cycle for a Web application using NPM packages for deployment on a customer's Intranet or the Internet.
This is not about what could theoretically be done managing security risks but what you are actually doing when bringing a commer... |
I have a service that performs a series of actions based on user information (name, address, etc), one of the problems is that the User entity comes from a legacy third party API (as a repository) that did not enforce a strong validation on data, so some users may have invalid information, such as blank or incomplete n... |
I am trying to model a case management system in a UML State Machine Diagram. It is an approval style process and the case can enter a withdrawn state at any time if it is no longer required. This means about 10 states can transition into this one which would result in many messy lines that dont add much value.
Does an... |
My team is working with the Scrum framework. We have done a draft product backlog with enough detail for the first sprints.
However the upper management wants a development roadmap. How does this need enters into the way Scrum does things? I am assuming the objectives are developed iteratively and not from the start.
|
I'm new to docker and I'm reading a book which says:
Docker can't safely replaced an unhealthy container. Docker could remove that container and start a new one from the same setup, but maybe your app writes data inside the container, so that would mean downtime and a loss of data. Docker can’t be sure that taking act... |
We have inherited a legacy MS CRM 4.0 application and the business wants it re-written to an as vanilla as possible .NET web application. The business wants to go down this route vs another off-the-shelf CRM solution because their business logic is very bespoke and off-the-shelf solutions offer very little out of the b... |
I am looking for an approach to verify that some information has not been modified after a certain point in time.
Let's assume a data provider records a data set at time X and provides it to a data consumer at time X+10. How could an approach look like in which the data consumer could now verify that the data set has n... |
I have a flutter app which uses firebase/gcp as a backend.
Files can be uploaded and stored on google cloud storage.
In flutter I am using an UploadImage and UploadVideo model to store information like path and url for these files.
Example:
@freezed
class UploadImage with _$UploadImage {
const UploadImage({required S... |
I'm struggling with defining proper endpoints for a RESTful API, given the following requirements:
We have an existing /customers endpoint, which when called with the GET verb, returns a list of customers, which look like so:
{
"id": "some-id",
"name": "John doe",
"email": "john.doe@example.com",
"address": "So... |
Often I want to open a new window from within some view.
I see opening a window as view logic. So I don't want code in my viewmodel that creates/opens/changes windows or anything else that interacts with view-things directly.
When I've got a feature like a button that opens a Window when clicked, I do it as follows.
I ... |
I could use some feedback on designing a solution for handling two OAuth flows in a single request.
I have an API that currently supports OAuth2.0 (for users).
It was requested that we should be able to shut down access to the API for a given client (eg. mobile app) - amongst other things.
The initial suggestion was to... |
Let's say you have a resource KeyValuePair
type KeyValuePair = {
id: string;
key: string;
value: unknown;
}
and we can CRUD this resource via a /keyvaluepairs endpoint.
Now - lets we have some Widget resource
type Widget = {
id: string;
foo: string;
bar: number;
}
Now, for some, let's assu... |
I'm trying to express a particular relationship between two software resources available in an API. The relationship is such that one of the resources is the "main" or "original" one and is required before the system can create the other resource. For example, the invoice object is derived from the customer resource, t... |
In an agile organization, how much (if at all) should developers be concerned about the budget allocated to a project?
My opinion is that they should not be particularly concerned, because:
a developer will cost X for a whole year regardless of the budget
features are chosen and prioritized by the business correctly ... |
I have the following problem:
I would like to test complex business logic for each test case completely separately, i.e. all tests should run in parallel. I don't want the test for customer #43 to depend on customers #1 through #42 passing, or having to comment them out.
I would like to test that I don't accidentally ... |
We run a deployment pipeline where we build a versioned binary, tag the commit it was built from with the same version as the binary, and then can deploy the binary into arbitrary environments (typically qa, then live).
I'd like to keep a record of which commit is currently deployed in an environment as a git tag or br... |
I have to implement 2 use cases, the first one is going to create a Company profile from its document number, so inside the use case, it reaches out to the third party API that contains information about the company (as a repository), gets the company data, saves to the local DB (as another repository implementation) a... |
Nobody wants to review a large PR from one go. The issue is to split a (relatively large) feature into multiple smaller PRs. The rules of the game are
This is a single feature, which cannot be meaningfully split into multiple standalone features
The whole purpose is to make the reviewer's job easier, by making "unit" ... |
I work on WPF applications used in testing hardware. I need to make my code base more testable and re-usable. I believe DI would help, but I'm not quite sure where to start. I've done my best with the following to remove anything too proprietary while still giving a good idea of the current structure. There are models ... |
Additional Context
I make infrastructure for automated device testing. Debugging can be very time consuming because the devices have many states and are constantly being updated with new builds which might break assumptions that we've made.
Background
A TL who doesn't work on the project that I'm working on is reviewin... |
Two scenarios:
Scenario 1 - Redacting information on a resource
Let's say I've got a User resource
id: string;
username: string;
address: string;
For privileged users they may see:
id: "1",
username: "bobby",
address: "123 Foo Lane"
However for less-privledged users, they see:
id: "1",
username: "bobby",
addr... |
In REST APIs a PUT request is meant to be an idempotent action - the result should always be the same, regardless of what the initial state was.
However, often resources will have attributes like 'created_on', 'last_updated', which I assume are applied by the database. (A client shouldn't be able to determine their own... |
I have the following case:
If the user is in the UK, the server needs to validate the bank details as Account number and Sort code number
If the user is in France, the server needs to validate the bank details as IBAN and BIC numbers
So how would you design the API for this?
One idea is to add as part of the payload ... |
I have a React Native app with several thousand users. I want to make small changes to the app, but in a way that will touch a lot of files. I want a specified list of users to see the new changes. At the top-level, I know how I could determine which group the user is in, but can I make my changes without doing an (unr... |
I have project where I use a url in various places. To prevent having to change it in all places, I would like to define it as a constant value in just one place which is referenced everywhere. But I'm not sure what's "the way" to do this.
The value is the base url of where the assets of the site are hosted (it's diffe... |
I'm working for a software company (offering 99% SaaS stuff) that needs to be SOC 2 compliant – in my understanding simply because the company's clients require it. I've recently been told that (among other things) this means that any and all software that anybody (including developers) install on their work machines n... |
We have a design challenge here for a project we are working on and I wonder if folks from the community can provide some guidance:
Our product is built in a microservices structure. So we have different services caring for different aspects of the solution. Each service has its own database. Both databases run on Auro... |
This blog on "Clean Architecture" describes how to build a modular Android application along with using Clean Architecture.
In that example project, the author places the business logic in a separate 'core' module and that module is framework independent. It contains repository classes, use-case classes, and data-sourc... |
I was learning about micro services with spring boot and came across spring cloud config server which is used to exernalise application configuration.The advantage it state is that one can change the configuration without redeploying the application .Is it the only point of externalizing configurations ?
|
I have a Launcher class that manages (check if they're alive and if not respawns them, also starts, etc.) Clusters which are processes launched through the multiprocessing Discord module.
To post relevant code:
class Launcher:
def __init__(self):
self._clusters = []
self._active = False
def _ke... |
Recently, I had to implement a business rule in a certain project. The rule basically consisted of checking a range between 1 and 12, values that would be used later, in some way, with Bootstrap.
First, since it is a numeric data type, I declared it as int. However, as the range wasn't that big, I started to question w... |
I'm having a tough time finding the distinction between the two.
My understanding is that "operating system" refers to a more abstracted job monitor with extended functionality (e.g. task-scheduling, virtual memory allocation, etc).
Is that really the case, or am I missing a more substantial difference?
|
Let me start by saying my knowledge of microservices isn't as strong as it could be. My understanding of DDD is that we'd draw a bounded context over an entity and that would be our service.
How does this work if we're using a strongly typed language save to Postgres but also save the same model to ElasticSearch? Would... |
Consider the function foo provided by package X in Python. I want to test the different functionalities of X.foo, and then use X.foo in my code. To make sure that I am using X.foo as it was tested, I am thinking of encapsulating it inside a function, and then call that function instead. However, I am not sure if this i... |
In concept-based programming (as in C++ concepts), I am wondering if there is a noun to say that:
A type T is an XXXX of a concept C.
in the same way we can say that:
An object x is an instance of a type T.
More generally what is the associated terminology to describe the relationship between a type T and a concept... |
This might be quite trivial for some, but I am studying how to migrate from a monolithic server to a microservice architecture, starting from the Identity and Access Management side.
My current server handles its userbase on its own user table with typical username, email and other metadata on it. I am about to re rele... |
My domain is a pipeline for processing data and sending it off to another place afterwards. It's defined by these rules:
Data is divided into Signals, which have some identifiers (name, category, type) which never change. The data itself for a Signal changes over time.
The pipeline is separated into discrete steps for... |
In Clean architecture
Suppose I have two actions (approve/deny) a request.
Should I create a use case for approve and another for deny?
or both in one use case (RespondToRequestUseCase) and I determine the action type through the request model?
knowing that they are sent to back-end by the same API
the difference bet... |
An external consultant to our team advised us to rewrite our SaaS offering (essentially a CRUD API) in .NET because this is more "scalable" than using Node.js (or Ruby on Rails, Flask, etc.). By that they seem to mean that a backend API written in .NET will handle the growing performance requirements much better than a... |
With the cookie regulations (GDPR) in Europe and Google's phase out of 3rd party cookies, do analysis tools like Mixpanel, Google Analytics, Heap etc. still work properly and continue to provide reliable information?
I understand that Google now uses 1st party cookies, and they can do this as they own browser, search e... |
I'm currently reading "Clean Code" by Robert Martin (which I should have read years ago), and it's given me a bit of a wakeup call, especially regarding keeping methods and classes small, which I do try to follow, but we all know that bad habits can creep in.
It got me wondering about how much of his advice (and other ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.