instruction
stringlengths
34
36.1k
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 ...
I have been using an external library for a while now. Unfortunately, it stopped receiving updates, and has since been adopted into my codebase. The issue is the library was poorly documented in the first place. It was picked out of necessity and because it was the only option. Now my question is, how should I document...
We have the following system: References that identify a product and have a family which identifies a group in which the reference belongs. Families that are a way to group references, for example, if we sell electronics we could have a family to identify the keyboards, another to identify the screens and so on. Rates ...
Overview Today we have a monolithic service that deals with realtime time data. The monolithic are composed by follow stack: Django + AuroraDB Cluster (Postgres AWS) + Varnish cache and cloudfront at the edge. This service is fed by a third part data provider, which in peak times, provider 5k message/minute, with this,...
I'm aware that there are a few accepted implementations of how signed integers are stored, specifically negative values. There's two's complement, one's complement, and sign/magnitude. For Visual C++, which one is implemented? I am a bit uncertain. I've always thought that it was sign/magnitude implementation. Is this ...
I'm working with a basic REST API, through user interaction on the UI, the JSON object is built up, including Arrays and a POST is sent to an endpoint using this object as the request body. For example: "data": { "id": "424", "types": [ "01", "02" ] } So this data object is part of the body that will be sent ...
In my town, recently a delivery company has been opened (think DoorDash but on a much smaller scale and only doing local deliveries). Now what really confuses me is that they charge pennies for each delivery and they offer a quite smooth delivery tracking feature. Now, I know for a fact that they are using Google’s API...
How often should we do git comit --amend --date=now [target] especially when editing a commit while rebasing or doing a fixup? If the answer is always, is it OK to let existing commits that follow the amended commit keep their author dates which is now earlier than the amended one? Let's presume the commits aren't di...
I'm currently trying to update the linux kernel used in a xilinx SoC, my company has an internal repo/fork of xilinx open source linux with a bunch of kernel drivers for our custom hardware & kernel config stuff. Our current fork is based on xlnx_rebase_v5.4 & we're trying to upgrade to xlnx_rebase_v5.15_LTS. So far, t...
I'm trying to find a way to achieve abstraction with the lowest possible overhead. This is for an embedded system (Cortex-M4), I use the latest gcc compiler arm-none-eabi. Let's say we have a pure abstract classes containing only pure virtual functions. class Animal { virtual void sound() = 0; virtual void eat(...
I am developing a REST API where users can request data from one or more sensors, using the following scheme: GET /sensors - returns a list of available sensors GET /sensors/<sensor_ids>/data - returns data for one or more sensors, specified by sensor_ids But the client also wants users to be able to send a request wi...
So a lot of the time my utils end up with a structure that mirrors the core library. I might end up writing a multiline version of str.center, an itertools-y function that returns the first or last element of an iterator that matches a predicate, a datetime function that returns the end of the current day, maybe a cust...
┌────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ ...
I was asked to refactor some C++ code recently for the purposes of increasing unit testing coverage. The problem was that the code was tightly coupled on one compilation unit, so we had the equivalent of this: beatles.h class beatles { ... } beatles.cpp class john { ... } class paul { ... } class ringo { ... } class g...
I am a noob in design principles and design patterns, this might seem like a very silly question. Some classes in my code have the following structure (image linked): https://ibb.co/nrp1t2g As you can see, I have an interface implemented by 3 classes, and each class overrides the interface method execute(string, long, ...
The CPython implementation seems to have the same modules written both in C (e.g., datetime in .c) and also in .py for the same module (e.g., datetime in .py). My question is which version is used when I use datetime in my .py file when using the CPython interpreter? And why are there two module versions in the first p...
Suppose I have a web application that processes a request as follows. A user fills in a form and submits it. (e.g., to register as a new user for my application) The request is passed to the appropriate view/controller in the backend of my application. (e.g., a request CREATE /user is passed on to a UserController) Th...
I face some situations similar to the following simplified one: @Component class ServiceOne { @Autowired ServiceTwo two; void act() { ... two.a(); ... } } @Component class ServiceTwo { // suppose it has a LOT of methods void a() { ... } void b() { ... } void c() { ....
Goal I'm working on libraries published as nuget packages and I would like the version of those packages to update automatically based on the changes I make. In other words, I would like something that automatically adjusts the major, minor, and patch numbers based on the changes of the API surface of the library. This...
Just for the example: I have a system which needs to fetch social media timeline on a specific time interval based on user preferences. Let's say we have user A, B, C, and so on. Let's say again we have time interval options from every 5 minutes to every 60 minutes, a user can choose the interval as they want. User A ...
In a web app I'm writing, a singed-in user is recognized by their cookie containing a session identifier. That session id has sixty-four bits of entropy, so I believe brute-force attacks are impossible in practice. However, not signing it to prevent tampering still feels less secure than it ought to be. I'd also like t...
Despite checked exceptions being generally bad practice and anti-pattern, I find one feature very useful: having list of checked exceptions part of function signature. Checked exceptions are "business exceptions", something that requires from the source code or user to do something to recover and continue normal functi...
There was this question on my mock and I am just really confused about it. I tried to learn about class diagrams in more detail but there was no information that explained to the detail of the complexity of this class diagram, could someone please explain why the correct options for this question are correct and why th...
What exactly is the purpose of React JS? I've heard a few things, like: It updates the page without refreshing. It is modular and can reduce redundant coding. It is faster than updating the DOM object with JS. The only one I can probably agree with is the last one. I don't understand why React JS is so important for ...
If I have two APIs that I'm considering to be two separate micro-services, each with their own database, how would I handle worker processes for each of these micro-services? For example, if each API would launch a long running task that needs to be handed off to a worker, should these two APIs share the same worker po...
Maybe a repeated question, so you all could link me if you know an older answer. I'm creating a small web application, using MVC, for a volunteer project that I participate. Right now I'm doing a feature that shows volunteers and their respective students. A volunteer could teach many students and a student is mentored...
Suppose I have a program that returns data from an API. If its cache of the data is too old, the program downloads more data from the API, caches it, and outputs the new data. Else, the program outputs the cached data. Should the function that downloads the data be separate from the function that caches the data? Shoul...
I am building a cross-platform application and have planned to use Blazor. I have made similar applications in the past but using ASP.Net Core for the back-end and Angular for the front-end. I always had a strong separation between the front and back-end in those applications, which is always good. The back-end was wri...
I was reading about LSP (Liskov Substitution Principle) in a book called Clean Architecture: A Craftsman's Guide to Software Structure and Design. I have a question regarding how this would be implemented in C++. On page 95, there is a figure explaining LSP using a simple example: My interpretation of the figure in C+...
We have recently started using Agile methodology implemented with Jira. We are struggling to decide how best to arrange Sprints, Epics, Stories, etc when working across different departments. For example, let's say we're going to make 'Feature A'. At a basic level, sufficient for this question, 'Feature A' needs to go ...
I am currently building a web based solution based on an application used in my organization. The application have an integration (SOAP-based API). To keep things simple, I want to build a analytics dashboard based on the data available in the application. My question here is: Do I save the data from the application, w...
I'm writing a Hardware Abstraction Layer (HAL) to abstract a hardware peripheral on an mcu. The driver peripheral looks like this. Driver module. Includes hal.h void drv_init(void); void drv_set(int x); int drv_get(void); void ISR_Handler(void); // impmenets hal_ functions ... Driver modules includes hal.h implements ...
I am trying to implement code for switching states of a couple laboratory devices. My considerations are: how should I link the state objects, state machine object and device manager object to follow SOLID prinziples. Should StateMachineContext know about DeviceManager object? - explanation and code are below. I will ...
Relational database is mostly used for storing editable user data. But how about storing non-editable lists of information? Possible examples are: GUI-related: main menu items, selectbox options, list of links, set of UI colors application logic: list of user types and their privileges, default table view configuratio...
Our product involves many (dozens) front and back-end modules which work in together with each other. We have decided to completely replace one of the largest which means we plan to port it to the new programming language/technologies. Most likely we do an initial direct port, verify the functionality then look at tidy...
We're using some FSM library that allows you to define entry and exit actions. For some reason, somebody needed to do this fsm.Configure(State.A) .Permit(Trigger.A, State.B) .OnEntry(() => { IsAuto = false; fsm.Fire(Trigger.C); }) This mea...
My apologies if some details here are deliberately vague, I don't want to get side-tracked by the specifics of the language, frameworks, third-party API, etc. Some months ago, I developed some code to ease working with a specific third-party API. As the code seemed to be something that I, even if no-one else, would use...
I currently have a generic Azure repository AzureRepository<TEntity> store internally a list of table transaction actions like so. private readonly IList<TableTransactionAction> tableTransactionActions; The generic repository implements CRUD methods like this.. public void Delete(TEntity entity) { tableTransactionA...
For a while now I have been toying with the idea of using source code as a file storage format. My question: How to support format version changes? (loading of older files with structural differences) An example would be a settings file. JSON: { "version": 1, "email": "name@example.com" } Then there is typically...
I am working on a project which will have a recommendation system and I am in the database design phase, I have a good foundation in programming but databases is a new topic for me, I have designed a database but I don't really know if it's good or not. but mainly the database should serve the following: store users ...
Or ways to get better run time than a nested loop? How would you design this? I hope this is the place to ask semi-vague software engineering questions. My simple simulation is like this: There is a population of X number of people. Every day, people go to work, which creates some quantity of something. After work, the...
Pretty simple question, but googling brought me nowhere: What is the purpose of input ports in the hexagonal architecture? We are doing Java and seem to have some misunderstandings regarding the input part of this pattern. We presume: Domain Core / Business Logic: This part of the architecture describes our business a...
I work in a production company where my colleagues calculate costprices based on 3D models and their respective operations. Apart from workactivities where a user has to insert an operation time and setuptime, most operations are calculated automaticly. Currently, this is done in an Excelsheet. I am responsible for imp...