instruction stringlengths 34 36.1k |
|---|
Here is the situation. System A sends the notification as it completes the work items to System B. System A does not know how many items the project consists of. It's just a pass-through system. System B knows the number of items. Once sys B receives the notification for the last item, it has to wait for the final auth... |
I was reading some C++ object-oriented programming notes that mentioned that we should avoid wrapping functions in classes if it is not required, since wrapping 'things' in classes would reduce efficiency.
Is it true that wrapping functions in classes reduces efficiency? What other 'things' could reduce efficiency when... |
After we have developed new features in a sprint the users must be trained for using these features. How does this happen in Scrum? Which role should give the training and how should it be reflected in the backlog?
Is it a developer (team) task or is it a product owner task or someone else's task?
Is it a story in the... |
I'm looking for design patterns to model (java) objects that are partially stored in a database and partially stored some other external source. In my case the external data is a whole lot of files which are read into memory and parsed into objects at application startup. The database contains the part of the data tha... |
I have some projects that share code.
This is my folder structure:
Workspace
+-- Libs
+-- Project_A
+-- Project_B
+-- Project_C
Project_A, Project_B and Project_C use code from directory Libs. I'm trying to find a way to put them into a repository, here is my options:
Put Workspace into one repository.
Make one repos... |
In the company I work with, we have a 3-layer architecture in our micro-services and the flow is like this:
Repository/DAO (entity) => Service (entity) => Controller (dto)
At the Controller level we map our entities to DTOs,
Now I am working on a search feature, and I need to perform a query with Spring Data JPA / Que... |
Context
I've been searching the internet to see if I could find any other information or posts about what I'm trying to achieve, but I had no luck. I don't know if there's a specific term or whatever for my problem, so I'm going to try my best to explain it below. I'm sorry if it all sounds pretty vague, it probably is... |
I have a simple class which looks like this:
class SpecialList {
private List<Integer> varList;
SpecialList() {
varList = new ArrayList<>();
}
void addVar(int i) {
varList.add(i);
}
boolean isVarListSizeFive() {
if (varList.length() == 5) {
return true;
... |
I would like to get some experienced advice about the handling of helper objects. Consider the following situation where we want to build a connector to a third party system. The connector shall translate business objects/entities of our domain into entities of that system and transfer them via HTTP:
abstract class Bas... |
I have a question regarding software design/architecture.
Are there any best practices or design patterns regarding the usage of classes with the same purpose from different libraries?
Let's imagine this simple project P which uses two libraries A and B. A and B both have a class to deal with 3D-Positions (this questio... |
I have question regarding Linux kernel , as far as I understand, to make Linux compatible with different machines and hardware , different device driver is added to the Linux .
I want to ask how much feasible is to add tons of device driver to Linux kernel , suppose after 30 -40 years the size of Linux kernel will be ... |
I have an SQL database in Azure that is ~4.5 TB / 150 million rows worth of data. Users will need to query this database for large sets of data. Right now, I am having users submit their requests through a web application hosted on an Azure VM.
How can I serve the rows pulled from the Azure SQL database directly to the... |
The environment is like this. An attendant is sitting on a chair operating a computer with a piece of software. She can type some text on this piece of software, so that a panel far away speaks that text.
An attendant that type in her terminal some random text so that a panel can "speaks" that random text. Who is the ... |
I need to create a program with the purpose of cross-referencing personal info from a spreadsheet(s), to check for conflicts of interest between clients of 3 different law firms. All of this client data will originate from 3 different spreadsheets using the same template for naming/columns.
I plan to write this in Pyth... |
I need clarification on something from someone more experienced to see if I am on right course with this.
Following Microsoft's eShopOnContainers microservices approach I got interested in building some small exercise microservices oriented system. But everywhere I look I see same examples using Customers, Products, Or... |
I need to add a priority column to an orders database to sort them, which will vary depending on what has already been done (actions taken). The other catch is: there are two different roles that will have both shared and exclusive actions so the priority changes depending on who is viewing the order list.
Profile 1
Ap... |
I've read various posts that polymorphism should be used instead of isinstance, and I agree that makes sense when the use of isinstance is checking the subtypes of a class to determine what to do. However, is the use of isinstance acceptable when checking the type of an object in order to do something unrelated to the ... |
Our codebase is old and very large. Over the years, many developers have worked on the code and frequently refered to the same concept inconsistently.
For example, we have a "number that uniquely identifies the study" or "Study ID". This is refered to as studyNum, examId, Exam, StudyNo, StudyID, the odd StudyUID or jus... |
From my understanding a facade is a class with the sole purpose of simplifying the use of a specific system/module behavior (its methods). It should not contain any relevant logic of the underlying system, just centralize and simplify its use.
My questions is: how to create a facade (ie. simplify and centralize) of a s... |
I have a small doubt regarding the software versioning, I know that there are many ways to do it, but the most common is with numbers and with a length of 3 to 4 digits, I know what each of the numbers mean in this method, my doubts are two but they go hand in hand (I clarify so that I do not cross out the question of ... |
I am implementing quora like application in which I have Post(question, answers, comments, likes/dislikes) as one microservice and User details as another microservice. I need user details in the post microservice. I need to relate user details with questions, answers, comments and also likes and dislikes? How can I do... |
I have a Java application that needs to generate mathematically-defined 3D shapes for a voxel world (Minecraft specifically, but that's not important to the discussion). These include sphere, ovoid, ellipsoid, cone, capsule, and others, and there are two distinct applications that I have for them. Currently I have a ... |
Suppose I have a program.c that needs element_123 to do some operations, and element_123 can be accessed by including agent.h
/*program.c*/
#include "agent.h"
uint32_t element_123 = 0;
agent_get_element_123(&element_123);
uint32_t data = element_123 + some_data;
/*do operations...*/
element_123 may be implemented b... |
I'm working on a project that has two separate versions of the API, v1, and v2 because they wanted to migrate from Javascript to Typescript. Both versions use the same database.
Recently I'm having some trouble as one part of the migrations are in the v1, and the most recent updates are on version v2. I would like to h... |
I use GitFlow as a workflow for versionning for less than 1 month. I've just finished to develop a feature branch which has been merged to develop/. Now, I'm starting a release branch from develop. The release branch will be tested. If tests show bugs, fix will be implemented in the release branch. At the end of that t... |
I have 1000 lines in a text file. I want to read them into some data structure[DS].
After reading them, I will be randomly picking 50 lines from the DS (using a Random Number Generator). Next time 50 more & 50 more the time after that. Each time I use 50 lines from the DS, I want to delete them from the DS. So after th... |
We know one of the philosophy behind the microservice architecture is availability. So suppose we have a project that has 6 services working together. One of them is an authentication service that responsible for creating users and giving tokens and validating them. So other microservices have to communicate with auth_... |
I am reading the book The Pragmatic Programmer and read about the Tracer Code and Prototyping, but I don't understood when to use Tracer Code instead of Prototyping.
As I understood about Tracer Code, I try to hit the target implementing a code that the customer can test in practice and provide me feedback in real time... |
After working through several tutorials and reading various responses on this site, I believe the Abstract Factory pattern would work well for a current project. I am seeking the opinions of those wiser than I to see if I am understanding the pattern correctly.
For my example I'll use a car as the concrete product. I u... |
I'm learning OOP so I decided to start a new project, a chess tournament manager.
Here you can read about chess tournaments https://en.m.wikipedia.org/wiki/Chess_tournament
Basically the user will be able to add players to the tournament, remove them, register the results of the games, change them, pair new rounds, so ... |
I am curious if the following example of testing a class with protected methods is fine.
For example, say you have the following class Foo that has method a() of return type Bar:
class Foo {
protected Bar a() { ... }
// ... other stuff
}
And the following test class TestFoo (using JUnit):
// Question: is... |
I'm building a pipeline that scrapes data on entities, to keep things generic, let's call them Widgets. Data on Widgets is currently unorganized and spread across various sources, including source code, spreadsheets, and issue/project tracking software like JIRA. The pipeline will run at some cadence and regularly upda... |
I am trying to do a computer program that can distinguish the functional and non-functional requirements written in Arabic languages from the Linguistic structure, so I am I look for the things that distinguish each of them in terms of writing. I wouldn't rely entirely on the structure difference, but it will be suppor... |
Pretty much all documentation on microservices I came across explain just one tiny part of some complex system. I am trying to understand big picture. So my question is: Has anyone expirienced in practice multi level AMQP Event Buses across solution when using microservices? Something like shown in the picture?
Or is ... |
TLDR: project scope has crept beyond my capabilities and I need an early exit strategy (in both parties' best interest)
Early last year I took on a gig to develop a web application for a financial advisor. The client had built a mega Excel spreadsheet over a decade of consulting. The client had a vision to automate as ... |
The problem is the following, suppose we have this functions:
from PIL import Image
from magiclibrary import perform_some_operation, stack_images
def load_image(path: str):
if isfile(path):
img = Image.open(path)
perform_some_operation(img)
return img
else:
throw FileNotFoundEx... |
A few days ago I had a conversation with a Civil Engineer with a background in Pascal and BASIC, and we talked about programming in Python. When I was talking, I used the term "code" to refer to a Python program, and he told me that he didn't know what "code" was, that the correct term was "algorithm", and that "code" ... |
It could sound trivial, maybe it is.
I have a new feature branch (say newfeaturebranch, branched from develop), but during the development a new bug is found and fixed in develop.
The bug is found to affect the development of the new feature. How to deal with this situation?
I assumed it would be bad practice to merge ... |
Some parts in our project's codebase implement the repository pattern in a different way from
what we usually do
Here's the example
public class Repository : IRepository
{
public Repository(AppDbContext dbContext, Mapper mapper)
{
_dbContext = dbContext;
_mapper = mapper;
}
public IQueryable<... |
I have a requirement where I need to add some rate-limiting functionality to an existing web application. The application reads transactions from a queue (TXN queue) and processes them in realtime. Each transaction has a unique id, a group id (a certain number of transactions belong to a particular group id), and the t... |
There are plenty of tutorials on the internet on how to build a server that handles its clients through the creation of separate threads, but there is no tutorials (at least I couldn't find any) on how to build a client that receives data from a separate thread and processes it on the main thread.
I have tried the foll... |
I would like to know how manage a type of pull requests. One of my reviewers ask me for a lot and a lot of changes (3 or 4 days doing changes), all related with possible improvements in the code that I thought it is too much and it ends up in a "perfect" and "smart" code. It is difficult to discuss with a person who tr... |
I'm studying DDD at the same time that I'm reading some Khalil Stemmler posts and I'm a little confused about who should initialize the VO: the entity it is related to or the useCase that uses that entity. A simple example:
Let's assume that we are developing an internal purchase system for a company that has suppliers... |
I found in the catalog of Refactoring by Martin Fowler, with Kent Beck book that they mention Extract Function refactoring.
It is a good practice to wrap your related code into local functions to make easy the readability and maintenance of code?
I always thought that local functions were created to avoid writing mult... |
I am trying to build a static program analyzer for a proprietary progamming language for a school project, and am currently trying to implement the parser from scratch.
I was wondering, what are the pros and cons of
Parsing in 2 passses (tokenization followed by parsing to create an AST) VS
Parsing in 1 pass (tokeniza... |
We have a project that loads metric data from various etls and services into an AWS SQS queue, where that data is processed and inserted into a metrics database, also running on AWS RDS.
When we initially designed the database schema, we chose postgres and enforced things like referential integrity via foreign keys. We... |
I've created two separate binary tree classes, with some shared functions/variables and some that are not shared. So I have tried to abstract away the similarities in a base BinaryTree class.
class BinaryTree{
public:
BinaryTree(std::vector<int> &vec);
BinaryTree *left;
BinaryTree *right;
std::vector<int> dataVector;
... |
We have a few developers who are slower than the typical agile expectation. They get fewer tickets completed in a given sprint. But on the upside, their work is more correct and higher quality.
Is this expected in an agile team, where you always get a few that is slower?
|
I have a role that combines the role of product owner with a role of software architect. I have final say for both product and technical decisions:
The Product owner role is similar as in scrum: I get requirement from my customers; I manage the product backlog, decide the priorities, decide which feature/requirement... |
A very straightforward question.
When I think about many of the member functions I create for my classes, many of them can be made static without affecting any functionality whatsoever.
If I do so; are there any practical benefits [or drawbacks] I can expect in terms of memory or performance?
|
in the code base of my job, we use clean architecture standards. So we have controllers, use cases, etc. To name them, we follow this template: {name}{type}, where type is one of the following values: Adaptor, UseCase, Controller, DataAccess, Presenter, and so on. name is a descriptive name of what that type does. For ... |
This question is a continuation of a question originally posted here.
I'm trying my hand at creating a Snake clone with JavaFX. One of the
requirements for the game is to have a sort of powerup food, which
increases the velocity of the snake.
For my game loop, I'm using a Timeline with a single KeyFrame,
which acts as... |
I have an application made up of multiple processes/workers/services which need to send messages to each other that represent units of "enqueued tasks" to be done. I am trying to find the best pattern to use for the type of communication these workers need to perform.
These are the requirements:
Communication is async... |
I'm trying to understand how do controller and presenters work in clean architecture projects and could use some help. Specifically about generating multiple outputs from the use case.
In the Clean Architecture book there is an image that shows different outputs and a single controller for the same use case: Financial ... |
I am a home, amateur developer for 25 years and I just had a bright idea regarding comments. Like all such novel bright ideas, someone has probably already done it and there is probably a consensus on its brightness.
I wrote a complex (to me at least) line of code and wanted to clearly comment it so that I can still un... |
I've been trying to refactor some existing code which is in essence a giant nested procedural call inside what should otherwise be an object oriented architecture. The entry point to the relevant code is a static function, which iteslf calls other static functions calling other static functions etc. totaling to a few t... |
I have a service which is triggered by messages from three queues (which are populated by different topics), and writes the processed results to another system (say DB service) synchronously. The incoming messages are of type insertion, update and deletion of data for the customers of our system. So ordering of the han... |
I am looking for a way to technically describe the behavior of the internal components of the implemented system. I need to be able to describe all the components and the behavior between them:
Internal component structure
Public interface available for other components
Principles of internal behavior based on busines... |
In a program there is an abstraction from an person to a shape. This abstraction is so that collision detection can be performed. Here is my original class hierarchy:
namespace Graphics
{
class Shape {
public:
virtual ~Shape() = default;
virtual void Draw() = 0;
virtual bool CheckCollision(float sample_x,... |
The scenario is the following:
For a project, such as Spring Security available on github, the following is accomplished:
forked and cloned
git remote add upstream URL-Remote-Repository
git fetch upstream
In master branch git merge upstream/master
It for the first time and all work fine.
A new branch is created to fi... |
Currently I'm working on a project that will interact with a database. Based on my research, I would like to develop a repository class which responsability is to write/extract entities to/from a database, as mentioned in Ivar Jacobson's book "Object-oriented Software Engineering: A Use Case Driven Approach" and furthe... |
I have a Repository service that should be Transient. It is used in many applications.
I have a new application that's a Console App, and current guidance suggests implementing my business logic in Worker Services and adding them to the Generic Host with AddHostedService<MyService>() calls.
One of those Worker Services... |
My current color distance formula is a modified version of Euclidian distance (eDist) because with eDist I was noticing weird issues where blue could be used instead of green in some situations when green would have made more sense. So my formula is:
dR^2 + dG^2 + dB^2 + dHue^1.5
*d means "delta" or "difference"
*dHue ... |
Disclaimer: This is a rather broad topic and there is probably no clear right/wrong. Still I would like to exchange experiences with experts of huge projects to learn and improve work between teams.
Situation
We have three teams
Team A and B are developing rather independently
They both depend on a common library deve... |
Let's say I have a controller called MessageReceiverController which is a controller of an API that other services can call and include messages in the requests.
For each of the messages the controller receives, it will process it and then send it to API_A. If response from API_A is successful, it will send the message... |
Consider you have the following code:
class UserContainer
{
List<User> user;
//some methods to get specific users, for example users, which are higher than 1,70meters
}
The User have a lot of different responsibility and features, so in the example the user is our god-class. There a lot of methods which are us... |
This is more specific to spring boot projects and applications whose main USP is its APIs. Now that we can simply create a JAR file deploy it anywhere, what is the point of WARs? Is there a specific use cases where we require a WAR type file? In a normal maven project, or a normal java project, yes sure. But in Spring ... |
Let's suppose we have a table of products, similar to this one:
ProductId
ProductFriendlyName
ProductPrice
84
Coke can
2
When a specific condition applies (the actual condition isn't really important: it could be "on every thursday", "when it is raining in Paris"), the price can be modified.
ConditionId... |
Based on the string "key", I want to get the latest and previous values assigned without using the Switch case.
I need some mapper method that it get the key value as input and map the values for different Data objects and return a list of latest and previous values without using the switch case.
switch(key) {
... |
So my current app process works like this:
Client communicates with my API to get certain information
My API needs information from a third-party API and uses these to create a response for the client
API sends response back to client
However, in order to access the third-party API I have to provide a basic authentic... |
Correct me if I am wrong, but regarding file I/O and concurrency, I understand that it makes no sense to read 2 files concurrently, since the data bus cannot be used simultaneously. This means that trying to read 2 files concurrently will, at best, have the same performance as sequential reading, and worst on average, ... |
I am tasked with making a program that will roughly have the same steps as a program that a former has written. The program that I'm trying to imitate doesn't seem to be open for extension, otherwise I wouldn't be writing another similar program. Below are the steps in the written program with the corresponding technol... |
The title really says it all, I want to have all the readable memory of another process in a buffer. I understand that I will have to use ReadProcessMemory(), but If I'm correct I can't just use one call to ReadProcessMemory() starting from address 0 for example, because there would be addresses that are non readable i... |
Say I have a have request payload
PUT /user
{
email: "invalid"
...
}
In the backend there is a email regex, which I cannot modify. Currently the behavior is to output:
{
"error": "'email' fails to pass regex '<some_regex_here>'`
}
Should I go with existing behavior or change the output response to
{
"error": ... |
If I have a list of objects that need to have an operation performed on each, is there a best practice in abstracting the loop or not?
Looping over list and call
def func(item):
some_op(item)
some_other_op(item)
for item in items:
func(item)
Call method and loop internally
def func(items):
fo... |
Imagine having the entity Counter and a use case that creates it. Moreover the business logic requires that every time a counter gets created a background task that increases the counter every 1s must be started too, should terms like "scheduling" appear in a use case?
class Counter{constructor(public id: String, publi... |
I'm looking for something that might be described as a "Scaffold design pattern".
I'm in the process of resurrecting an old piece of working but very buggy code that implements a Finite State Automaton in Java - you provide it with a model defined in XML and then you can throw events at it and query the resulting state... |
I know various forms of this question have come up before, but none of them quite seem to answer in a way that I can apply to / understand in relation to what I regularly see others doing. Specifically, when dealing with a Spring / Springboot / Seam project, what benefit is there to having a separate implementation and... |
What best practices do large software companies recommend when introducing a breaking-change to their software development process? Put another way, how do you best communicate these changes to fellow developers?
For example:
compiler bump / switch
library upgrade
dependency introduction
|
We develop web-applications using a javascript frontend framework (ReactJS), to retrieve the data to show, the user's browser calls an authenticated REST API which is our backend (Kotlin+Spring), the backend then connects to the relational database to retrieve the data (see the sequence diagram).
Our customer doesn't ... |
I have a function that was written because several methods used the same sequence of code so an abstraction was useful. The function takes a string representing the path to a registry key and then a list of 3-tuple containing attributes to update the key.
This function is subsequently called updateKeyAttributes:
_ROOT_... |
What is the recommended convention to be followed for identifying different GET endpoints that fetch the same model/entity using different fields/parameters?
For example, there is a Student entity for which I wish to expose different GET endpoints. Suppose the first GET endpoint is a get-by-id endpoint that fetches Stu... |
I have to do a presentation of Convertigo, a LowCode/NoCode platform, for my IT class. I did a lot of research on it.
What do developers think about a platform that permits to everyone to create an app? During my research, the first idea which came to me was "programming will die". But as a developer I don't know what ... |
I am trying to find an optimal way to handle the following scenario:
I have an application where there are a lot of file uploads on a certain endpoint, but the validation is rather strict as per the format and quality of the uploaded files, so a lot of the uploads fail, but for dozens of different validation problems.
... |
I am creating an app with Deno (a personal project), and I manage the "database" with only the Javascript code of the Deno enviroment, modifying JSON files like any other JS object. For me, that's seems much more intuitive than using a database client (like mongoDB), and making the classical queries. I prefer to establ... |
I have an issue that I'm not sure how to handle regarding modeling.
I'm using as my BPMS Flowable
My situation:
I have a flow (picture below) where are 2 user activities.
Each activity manipulates on the database table, which is not a direct Flowable table. We can assume that this is a table in the external system.
No... |
Introduction and Question
I understand what the advantages of dependency injection, e.g. constructor injection or setter injection and that it is one way of doing inversion of control. I also understand that service locators are another way of doing inversion of control - but one that should be avoided. I am following ... |
Is it possible to find the closest point (or k closest points) to any arbitrary point in a set of n points (in dimension N)?
When I write closest point, I mean smallest Euclidean distance. I'm looking for an algorithm for multiple searches, where the preprocessing time for the n points is negligible?
Is it possible to ... |
Encapsulation is the hiding of an implementation in OOP the way I understand it. I searched on Google and I was thinking of trying to write a program to test, but my tests would only happen at run time. Python allows you to hide methods with "__" syntax. Java allows you to hide member variables with the "private" ke... |
How can running multiple instances of my backend improve performance if they are all backed with a single Database (served with the same database instance)
Because I think that most of the latency of the request is caused by the database, shouldn't I focus first on database performance/scalability rather running multip... |
I'm trying to model a simple Graph structure as an UML Class Diagram and Object Diagram. A Graph can have multiple Nodes and knows it's starting Node. Every Node has a predecessor and a successor Node.
This is my Class diagram:
My first question is, do I need to add an edge from the Node class to itself, because a Node... |
I have two Docker containers:
Headless browser grabbing images by running JavaScript
Flask server analysing these images (and sending results to another server)
I'm using a bridge network to communicate, but I'm running into a lot of problems:
Flask is HTTP, headless grabs from an HTTPS website, causing "mixed conte... |
How to design a service layer structure that will be resistant to exceptions. Let's say I have a simple OrderService service, this service performs basic operations - saving an order.
public interface OrderService {
NewOrderResponse placeOrder (NewOrderRequest request);
}
What I need to do while placing a new order... |
Hi I am making a Value Object.
public class Age
{
public Age(int age)
{
Value = age
}
public int Value { get; private set; }
}
I want to check that the value being passed inside the constructor is valid. It seems very reasonable and practical to me that we should p... |
I'm taking Software Engineering class and my professor is absolutely terrible at explaining anything. It's only the 3rd week and me and my group mates are already deeply confused.
We were given a script for the software of a parking lot and were also given a template with a grid. This grid has 3 columns: requirement nu... |
Our team has the problem (and benefit) of having a very stubborn project manager. He insists that all discussion of tickets happen during grooming sessions. He is the one who selects which tickets from the backlog will be groomed based on business needs, developers do not have input on what gets groomed. However, he... |
Consider we have three classes which want to collaborate, then, where is the behaviour?
I guess it can only be in one of the three classes or in a fourth one acting than as a procuedural connector-class, which separates the behaviour from the three classes and to its own class.
But also if we don't have this connector ... |
I read Robert Martin's Clean Code: Function chapter. In this chapter, the best number of arguments of function is single argument. So, it is good to abstract that argument and function should be separated if it have various roles.
In practice, I wrote function that accepts single/plural arguments using Typescript like ... |
To preface, I work at a place that I feel misunderstands and overuses MVC, but I also recognize that maybe it's me who doesn't understand it.
I'm used the model/view exclusively within the context of UI's and storing/transforming/ and representing data intended to be displayed by UIs. In that my experience may be admit... |
I am creating an Android application that sets alarms based on the String date of a list of Objects (PendingIntents, with each taking in an id, that is an integer). In order to cancel the PendingIntent, I must know the PendingIntent's id.
I am having trouble of figuring out a way to generate a unique id reliably with a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.