instruction stringlengths 34 36.1k |
|---|
Is there a designated term for replacing hard constants (literals of any type) peppered throughout code with changeable constructs (can be a variable or #define or any similar mechanism)?
Basically, the overarching effect is integrating data into one place where one change is seen in multiple places.
For example:
int y... |
The question is specific to the API notation shown in the screen under the heading Table Name with the comment Joins Multiple Tables. I am using Spring Boot with JPA (Database: RDBMS)
I have defined API notations for multiple requirements that UI ReactJS based Portal application consumes the APIs. Are these notations f... |
Currently I'm on a project where my objective is to obtain the best code quality.
We have unit, integration & e2e testing. The e2e tests are written by the Business team in cucumber and these tests are the final condition to achieve the end of a user story. Also, all features must have the metrics that we want to chang... |
I am trying to follow Clean Architecture by Uncle Bob. I have 3 layers:
Core (Hosts business logic, and is the central layer)
Application (Host application usecases, and is directly above the core)
Infrastructure
I know the responsibility of the Infrastructure layer is to host any external dependencies that our appli... |
We finished developing our prototype using Node.JS and Express.JS (which works with HTTP1.1) and I am trying to upgrade to HTTP2. However I am having a lot of troubles to do this.
I first discovered that Express.JS does not support HTTP2, and the release of Express.JS 5 which should resolve this issue is postponed ever... |
Background
I'm trying to come up with an approach to building microfrontends.
Here are the facts of my circumstance:
Team 1: Develops the shell web app called "ShellApp" that will embed (host) other microfrontends
Team 2: Develops a microfrontend web app called "ChildApp" that will be embedded onto "ShellApp"
Both tea... |
I'm designing a python api to play a singleplayer card collection game and my prototype includes a state machine which uses pyautogui's locate function to recognize and update current game state through clicking the game directly. I am planning to use statemachine packet from pypi. Ideally this Api would be hooked up t... |
I have an app which uses barcode scanning to gather information about fruit.
A barcode could be bound to either an Apple or a Pear: the app asks a remote API which one is it, and then stores the information locally.
Two possibile solutions i have tried (pseudo-code):
1.
enum FruitType {
APPLE,
PEAR
}
class FruitInfo
{... |
Say I have a system with 5 microservices behind a gateway, and a user signs in through an IDP (OAuth)
A user U passes the access token in a request, and the call first reaches the gateway before it enters the services behind, say A, and then A calls B in order to complete the request.
Now, for inter-service authenticat... |
CLARIFICATION: There's a few articles around this point, I am trying to understand based on my use-case, what would you recommend as the AGGREGATE ROOT
The problem
Given a domain that allows creating new invoices with a constraint that each invoice must be unique (Identified by a code, set by the issuer's system, eg: I... |
Current setup:
We follow the cache-first strategy right now.
Always fetch from the cache first.
If absent in cache, fetch from DB and update the cache.
Cache TTL is 30 min. After this, the cache-key expires.
Problem with current setup:
As soon as we upload new data to DB(>10K records), the cached data is stale for us... |
For instance, if you have a hash table with the array of buckets 26 nodes long, one for each letter of the alphabet. You use that to keep track of names. So when a name "Jed" is added to the J linked list that already has "Jack" and "John", rather than just adding Jed to the end of the linked list, you structure that J... |
I am working on a microservices project involving 4 services - Auth Service, Service-A, Service-B and Service-C.
All the services are implemented using Spring Boot.
The Auth Service is responsible for authenticating logged in user and generating a JWT bearer token.
Each of Service-A/B/C has JWT filters which checks for... |
I'm trying to make better use of OOP, but I don't have good instincts for this yet and I sometimes worry I'm making things more complicated and/or less efficient. I'm wondering what is the best way to handle this situation working with groups of related objects that essentially map to DOM elements...
I've written a cla... |
I have a bookshelf microservice that manages user books' status (pending, read, reading now...). It exposes some REST endpoints to set book status:
PUT /users/{userId}/bookshelf/pending/{bookId}
PUT /users/{userId}/bookshelf/read/{bookId}
PUT /users/{userId}/bookshelf/reading/{bookId}
This microservice stores no data ... |
Our team had a discussion about the use of an API Gateway when our on-premises applications have to do a external HTTP call.
The scenario would be very simple:
On-premises application --> API Gateway --> Destination
We already have an API Gateway instance that handle incoming requests from clients, so the current API G... |
I'm creating an authorisation service, which does signing using a key.
For local development I was randomly generating a key on application start-up.
Now I'm deploying to the cloud (currently going with AWS), I'm refactoring this approach to be more robust / persistent.
The current idea I have is to generate some keys ... |
I want to understand how Dependency Inversion gets rid of switch cases.
Consider a service that needs to communicate with several databases.
class StockUpdater {
private final DataStore datastore;
public StockUpdater(DataStore datastore) {
this.datastore = datastore;
}
public void update(StockItem item, int... |
We are starting a journey in our company to use Kafka as our event backbone for both streaming data and for an event driven architecture. I foresee a pattern where we would want to consume events off Kafka and update a database, and also expose REST APIs to retrieve data from that database.
I had assumed a Kafka consum... |
Currently I have being request do implement an endpoint that would be responsible to update/create/delete sub-items for a single entity. The entities in case are students in a given classroom and the request would send the current status (number of students) in the given class. To summarize we have classroom that has a... |
Suppose I have the following entities:
class Employee
{
public string Id { get; set; }
public ICollection<EmployeeBadge> Badges { get; set; }
}
class Badge
{
public string Id { get; set; }
public Employee Owner { get; set; }
}
The employee and badge may or may not be stored in different ways, which is... |
The client wants to put a CSV file on an FTP server, have it processed then have an error file put back in a different directory.
We are only a small company so we can only afford to support Java as the language.
We also don't have an FTP server so we are considering using Azure blob storage with a blob trigger and Fun... |
Here are a couple of examples in Python:
clearly_even = 2 * get_integer()
print(solve_for_any_integer(clearly_even))
def solve_for_any_integer(x):
while x % 2 == 1:
x = make_even_from_odd(x)
return ... # Solve for even
When it's clear that an even number is passed, I'd make a solve_for_even function and call ... |
I see two possible interpretations of the semantics of request methods defined in the HTTP specification RFC 7231:
The intended effect of a request method is fully defined by the HTTP specification (e.g. for GET, retrieving a representation of the target resource) and any extra effect implemented by the target resourc... |
I'm working on the low-level design of a bike rental service and I was wondering if the solution is good or where it can be improved.
Context & Requirements
I used an exercise I found online which says:
City wants to start a bike rental service based on subscriptions where customers pays an annual fee that will allow t... |
We develop a Single Page Application (SPA) for enterprise clients. When we deploy a new version of our SPA we would like to upgrade a subset of clients whilst leaving the other clients on the more stable previous version. After the new version become stable we then upgrade the rest of clients. The release cycle will al... |
I'm working on a web application using Spring (Java and JPA + Hibernate) and I was wondering if there is a way of locking a MYSQL table and then when another web service (or even another thread from the same application) tries to read or write the locked table it waits for it to be unlocked.
For example, imagine a use ... |
Let's say I have an application where a user can do exercises and track them. I have the User entity:
class User {
private int stamina;
private int experience;
}
And the Exercise entity:
class Exercise {
private Date finishedAt;
}
The user can have many exercises. Once an excercise is done the u... |
As a prerequisite I will say that we are wedded to postgres to provide this solution.
This is a very broad problem, and I think it must be solved many times over, but unfortunately as it's so general I can't find any really interesting solutions online.
We have a task we need to run, say "reindex customers". This needs... |
Having a bit of trouble on deciding the best way to store crypto values which are usually in decimals. Do I go with Double or Float? Or is there an even better type that Swift offers?
My initial gut feeling was Float, due to a constraint that I will have in the application (I won't even be dealing with amounts that are... |
I am working on a very LEGACY MVC App using C# which is built from 2009. They dont have any client side validation at all. In other words, they dont use Validation mechanism provided by MVC framework as the following link
https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-5.0#client-side... |
I started working on a project and I saw some methods with this With prefix and I'm wondering if this refers to a known pattern.
Does anyone know of this naming pattern?
|
For example:
PostCode
PK PostCode
Address
PK HouseNumber
PK PostCode FK
Seems reasonable. But can we carry on indefinitely?
Room
PK HouseNumber FK1
PK PostCode FK1
PK RoomNumber
Door
PK HouseNumber FK2
PK PostCode FK2
PK RoomNumber FK2
PK DoorId
Obviously I'm repeating da... |
I noticed that the default behavior for Visual Studio C++ projects is to organize files using filters instead of folders on disk. Essentially all the source files within the project are stored in the same disk directory, but the filters virtualize the files into a hierarchy.
What value do "filters" offer compared to th... |
I am engaged into a discussion with my peers where there is a disagreement between where ease of service fits into FURPS model.
I feel it should be part of Usability. Though my peers suggest it should be under Supportability
Would appreciate it if someone can clarify the confusion.
|
I understand that using the React Profiler in production should have a small or negligible impact on user experience at least for profiling 20-50 (guess) components on a page.
I would like to know if anyone can share any known data/estimates on the performance impact on the user experience when shipping the production ... |
I have a Dao interface which doesn't have any methods defined.
Then I have multiple classes which implement this interface, like PetDao and HouseDao.
For some of the implementation classes, and some of their methods, I need to do an operation.
Let's say this operation is defined in the Operation class, and the method i... |
In a DDD implementation, I am trying to design my domain model and the way to properly interact with child entities of an Aggregate through the Aggregate root.
Imagine the following two classes in an Aggragate called "Basket".
class Basket
{
string Id;
int TotalPrice;
List<Item> Items;
}
class Item
{
s... |
Coming from the world of C#, where, despite sharing namespaces, it's quite common for every class to have its own file, I find that Rust codebases seem to have a complete different sort of philosophy (and perhaps less organization) in the sense that lots of structs, enums, traits, etc. are combined in the same files, w... |
I'm learning about immutability (specifically in C#) and I can't understand the examples out there stating that making an object immutable brings real benefits (besides a shared object in a multi threaded environment, which the benefits are pretty clear).
The most talked example in my readings is DTOs. It's said that D... |
I am trying to solidify my understanding of the definition of a fully dressed use case.
I was asked a question in an interview which was as follows:
Operations contracts are generally written for:
All fully dressed use cases
All use cases
The most complex operations in fully dressed use cases
The most elementary oper... |
NOTE: I believe I have a bit of an X/Y problem here, so please, bare with me. Also, I have trouble explaining things sometimes, so feel free to ask me to elaborate, and I will improve anything I can about my question to make it clearer.
I have a system in which I have a central service that calls a processor to perfor... |
My solution consists of an API for data access and a web application that calls it.
I have integration tests set up for the API. However, the actual Web application that calls the API is not a part of these tests. Should integration tests cover the calls from the actual client web application?
|
If thrown exceptions in constructors can lead to memory leaks or partially-constructed objects, then why we don't make them atomic? so neither an object nor it's local variables will get created/allocated if an exception was thrown. Is there a reason why constructors are not designed that way?
|
I want to know about best practices for release management of a product-technical team with about 7 cross-functional teams included.
We changed our team structure to something like Spotify Squads Framework with some changes because of our team culture and size. now we have 7 cross-functional teams that have all the nec... |
In many project that grow more complex at a certain moment business rule editors, workflow editors, custom taxonomies and such enter the arena.
In all of these a coupling is made between a complex object e.g. "department" and a business rules e.g. "if department = a or b then allow no access"
In the older times these w... |
Currently, I'm working with a health management application, let's call it application A. It's a partly prebuilt generic application that we are extending on. The main entities are journals, events, and persons(patients/medical staff/external contacts).
The user can use the application through a React app to see medica... |
I have a question regarding validations and exceptions in DDD.
I have a ValueObject say, PasswordText which takes a string argument in it's constructor. Checks if the string matches the password criteria. If criteria, matches then the new object is initialized otherwise it throws an exception (DomainException).
The pro... |
I'm following a course on Udemy and the teacher said that is a best practice return the update object in an add method. This is the example:
public Recipe addIngredient(Ingredient ingredient) {
ingredient.setRecipe(this);
this.ingredients.add(ingredient);
return this;
}
This method is a method of the class... |
Let's start off with the infrastructure architecture that we have, because that's the most important aspect of this conversation.
Clients (browsers) which communicate with the product cluster (over WS). Having a websocket connection here makes a lot of sense, because there's a lot of data being exchanged which both is... |
So we work at a company following the microservices architecture where each microservice is developed by its own scrum team with its own Product Owner.
Every microservice is used by multiple different products and the microservices are considered products on their own.
We are looking at options to arrange the work betw... |
I have a C# class library shared among several applications. The library is divided into a few smaller components which have dependencies shown in the picture below. Each component is placed in its own namespace to enforce the component boundaries:
Core <- Component A <---- Component B <----- Application
^ ... |
I've developed a large application that performs jobs, such that it receives input x and outputs y. For this application, speed is the top priority. The application is capable of running concurrently. I want to modify this application so that it can be used as an REST API, where users sends x and receives y as its resp... |
I'm following the guide in https://reactjs.org/docs/thinking-in-react.html which makes sense for data that I request and update on a filter.
However, I want to have some sort of general synchronization job in the background that polls and updates an SQLite database periodically.
The question I have is if the SQLite dat... |
I'm not sure of the proper nomenclature to describe my question, so let me just jump into an example. Let's say that we're modeling a scenario where:
A Vendor can have multiple Customers
A Vendor can have multiple Employees
An Employee may only do work for one of the Vendor's Customers
An Employee's only relationship ... |
I'm trying to use the hexagonal architecture but I want the flexibility to make CUSTOM queries right to the database (or cache) to populate DTOs right from the left-side without passing through the domain layer. I think this is something related to CQRS, right?
The question is: Is that ok to make the left-side layer kn... |
There must be a good reason for this. Laravel's default pattern makes no use of Service Classes... but the Laravel community's best practices is for business logic to be stored in them.
Laravel's default pattern seems to break SRP, and there's no Artisan command for creating a service class, or even any reference to us... |
I have a UX that is modeling a hierarchy. There is a concept of a section, a sub-section under a section, a panel under a section and a bunch of form-fields under a panel.
The UX exposes an ability to (valid-ly) reorder the hierarchy (move a panel to a different sub-section or a sub-section to a different section, etc.... |
First of all, I hope this question doesn't fall under "Asking For Books Recommendation" Category.
Since TC++PL covers C++11, it is 3 revisions old (C++14, C++17, C++20), the ISO group is working on C++23, and I think a 5th revision won't be published anytime soon. So is it outdated?
|
I'm working on a big C# application that is currently under development so we have some room for structural refactoring.
The application is divided into 10 microservices, which some of them communicate with each other.
That intercommunication is done via 2 different approaches at the moment: A) using Apache Kafka as an... |
So as I was learning, I was told that it's bad to define function within header files, as if it's included in multiple places, it'll produce multiple copies of that function and later causes error in linker. But later I found out that declaring such function with inline seems to prevent such issue, as stated in this SO... |
The project I'm working on has a code dependency on a TeamNames enum. The problem with this is that the project needs to be recompiled and redeployed on any addition/deletion in TeamNames. How can I remove this dependency?
I have come up with 2 possible solutions:
Accepting each and every TeamName as a String field. T... |
The following applies to a platform/company at an early stage in its life, moving quickly and cheaply with a small engineering team.
Imagine a platform with the following components:
Cloud infrastructure (e.g. terraform)
Client-facing app
Internal-facing admin app
Third-party API
Shared relational DB, with frequent sc... |
In Event Driven Design, there is the concept of the Event Processor which is the node within the event chain that applies business logic to/from an event message. Usually a single responsibility.
in Microservice Design, the microservice is the smallest, standalone unit within an architecture that applies business logic... |
classes and method should do one thing like the code below:
class A {
public int a() {
b();
}
private int b() {
c();
}
private int c() {
}
}
The code mentioned below I found it as an interface in Clean Code book written by Robert C. Martin. I found some class like this in the book. In the code b... |
I often run data processing/machine learning/filesystem-scanning scripts that can take well over 24 hours to complete. For processes with arbitrarily low memory requirements, I can run without using Slurm, but for anything that uses a remotely large amount of memory (>= 1 GB), I have to use Slurm. The exact memory thre... |
In the context of a DDD application following CQRS and the event sourcing pattern, I have 2 questions.
At which layer should the direct calls to the Infrastructure layer be made? At the Application layer (ie. direct inside command/query handlers) or at the Domain Model layer (abstracted inside models behavior)?
At whi... |
I have a method called GetValueA() and GetValueB() which return string that in formatted
public string GetValueA(){
string a = service1.GetA();
return Format(a);
}
public string GetValueB(){
string b = service2.GetB();
return Format(b)
}
private Format(string unformatted){
return unfo... |
I am building an app (stack is Python/Django/React and DB is PGSQL) that is supposed to be used internally in companies to track their work, assign people to different tasks, throw some statistic data, generate reports, analysis, etc. Essentially make their life easier by automating stuff that they do by hand. The app ... |
Just a question about general terminology. A subroutine as I understand it is basically a packaged subset of instructions that a routine runs to obtain a specific result that it needs for a larger process.
What if you're studying a routine (or program, procedure, what-have-you) and discover that it's actually part of a... |
This question considers whether SQL DB data should be represented as an enum or by a reference table, when the application code is aware of particular instances of said data.
I'll illustrate with an example concerning user roles, but the question is more general. We could of course imagine other types of data than role... |
I'm on a dev team where the product manager wants to allow internal users to "impersonate end-user and show the site exactly as the user sees it". I argue that this raises security flags and, even if it is allowed, data should be obfuscated and the UI should be read-only. When I call my bank or phone company for tech s... |
I was trying compiler design with flex and bison. This is my first attempt in that sense.
For my compiler, I wanted to build a symbol table which would help in building a proper compile-time type-system. When I sat to implement it, I noticed, it actually requires two symbol tables for a code file. One for compile time,... |
I will be writing a number of Python scripts which will be run in batch daily on a Windows server.
I am trying to develop a template for writing the scripts. My intention is to use a configuration file to hold the settings (for example: the location the log files will be saved in).
Below is the template I have develope... |
Say I have the following data-structure describing a given widget sold by my company, which contains fields of purely atomic information (i.e. data that cannot be otherwise derived from other available fields).
my-widget = { "widget-id": 1, "amount-sold": 100, "profit-per-sale": 0.2 }
Suppose that across my app(s), in... |
I have a simple question, why would I use an array of a single class over a class with multiple property arrays?
Context:
I have a series of calculators that extend off a base calculator. Each calculator is intended to calculate the same things but in different ways. Here is the simplified base class (pay attention to ... |
Context
I'm developing togther with my dev team a mobile app in a client-server architecture, since there will be a webclient too, allowing some users (admins) to perform certain operations from the browser.
The REST Api currently authenticates users by returning access and refresh tokens in form of JWTs. Both local (u... |
Context
I'm attempting to design a modelling framework that is modular and easy to extend and test. (I'm trying to follow open/closed, dependency injection, and composition over inheritence principles).
I have a hierachy of model objects, which contain methods, some common to all and others specific to certain models. ... |
Suppose we maintain a massive electronic library of texts/photos/videos etc., and want to ensure that these files are readable indefinitely long in the future. [Update] one of the major problems with digital libraries is the program rot: due to bugs in content creation and/or content playback software (and due to feat... |
It seems that there are at least two possible definitions of continuous integration:
Frequent merging of a codebase to a common codebase (e.g. daily merge to the main branch of a VCS server).
Frequent building and testing of a codebase (e.g. build and test at each push to a VCS server).
Both 1 and 2 can be automated.... |
I am working on a project and I typically setup precompile git hooks for things like linting and testing. I recently had some consultants we use complain about requiring lint on every commit. Their response is they commit as they go and they want to be able to check in half finished code on a feature branch. My persona... |
As an example, let's say you have the following pseudocode:
if test environment: # meaning you don't have the typical service account prod perms
sudo as service account + do operation
else: # in prod so service account will have perms
do operation
assuming that the operation is permission sensitive, such that you ... |
I'm writing a introductory JavaScript tutorial series, I have a question about terminology.
When explaining the Array.prototype methods, I've given an example of some code like:
const letters = ['a', 'b', 'c'];
letters.forEach((value) => {
console.log("the value is: " + value)
});
I've said what's happening here... |
I'm working with microservices, and I see an issue.
There are two services, that transfer info between each other via jsons. Because of this, we have to store our enums in strings, and serialise-deserialise them while passing. The problem is - both services have to have copies of enums, to be able to translate those st... |
I'm a junior web developer at my first company. We have a business analyst that communicates with the sales team and developers. The business analyst is responsible in creating specifications for the feature request.
My question is, should I just follow the business analyst's perspective of the feature request even tho... |
I'm studying Design Patterns book and I was trying to understand the Composition principle in Lexi's Compositor-Composition as explained in figure 2.5, as well as how to implement it.
Where the expected behavior is showed in figure 2.6:
After some research, I couldn't find anything related to the same use case.
The o... |
I'm trying to make a program that produces pdf files. I've been studying the pdf format specification and specific pdf files whose format I'm trying to mimic. I found the line /FlateDecode in these documents and when I searched about this compression method the google results referenced a built in .Net algorithm, Defla... |
I want to show a number of posts, ordered by their score, limited to some number. The score is the product of the number of likes they have (from another table) and the recipricol of their normalized (0 to 1) age.
I have an SQL query that works fine for my MVP, but it neccesitates a full scan of the posts table.
SELECT... |
I have ASP.NET 5 Web Api and need to do the following task:
Add endpoint, which get cshtml page and return generated html, so it should do the same what is does razor view engine.
What is better way to do this?
I added these views in this web api project and I think I can just make httpget request to view to get html r... |
Imagine we have a Sprint Backlog defined, consisting of business features to code. When a feature is developed and delivered (deployed to a test server), QA can start manual testing (we don't have automated tests for a reason). Testing takes several days (we cannot decrease the time needed).
Is it ok for the developmen... |
I am new to web development. After reading some posts, such as this and this, I am still not sure which parts of my application belong to backend. To make things simple, I will use a mock example. The workflow is as follows:
The user provides my app with an API key for a third-party service capable of translating a fi... |
Take a profile page for a job applicant with a list of names in a form with typical CRUD:
Resume Name:
Altenrate Name 1:
Alternate Name 2:
Alternate Name 3:
Assuming we have some sort of Names table for this one-to-many relationship between an applicant and their names, we want to make sure to preserve the order of t... |
Currently working on designing an application that will take in JSON data from remote client applications. The data these client applications are sending is going to go into a Message Broker, namely RabbitMQ, to be later processed. In the architecture, I cannot really decide if the client application should send dire... |
Currently I am investigating the differences between Microservice Architecture and Service Oriented Architecture. A differentiating point is the Service.
In a MSA it is quite clear. A MSA consists of Microservices. They are doing one thing and doing it right. (vertical splitting in contrast to monolith)
For a SOA it is... |
I am writing a simple specification for a module that is part of a bigger call center application. First I write down business rules, then application logic. I realize that some rules apply only to a specific third party telecommunication service API that we are using, like
There are three invoice templates in the tel... |
I'm trying to understand OAuth and Securing APIs better when using External Identity Providers, and all my research on it doesn't really seem to apply to my issue, so I'm starting to wonder if I'm approaching what I'm doing completely wrong at this point.
I have a SPA that is an item manager for a game, it has a custom... |
I am designing a AWS web service which is going to get 1000 TPS from devices(Android) and it has dependency on multiple downstream services. The usecase is to hit this service periodically from device, get a piece of data and cache it in the device memory. Since device does not require the data immediately, I designed ... |
I am working on research that analyzes dependency injection (DI) in Java projects. The more I read, the more I get confused by DI in relation to other frameworks and even software quality metrics.
I have been recently reading about afferent couplings (Ca), efferent couplings (Ce), and instability (I) with the formula b... |
Given two systems A and B that communicate with a Request-Response protocol (REST services).
Where should the entities representing the request and response bodies reside?
N.B.: The entities above represent the contract of these two classes.
My idea is to have only these classes (entities) in their own Maven project, w... |
In our line of work as software engineers, we can write code that assumes various things outside its scope or architectural boundary, in order to save performance, time, and on defensive coding techniques that in the unlikely event of a meteor falling down - your program to still hold strong.
I'm not sure when working ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.