instruction stringlengths 34 36.1k |
|---|
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... |
I'm looking for a way to avoid centralized management of authorization rules. I'd like every microservice to be responsible for the authorization logic of its actions, but I'm having some trouble implementing that.
Let's use an online marketplace application as an example (like eBay). A user in this application can man... |
We want to build a new frontend for our existing app with elements shown or hidden based on a users role.
Are there any common patterns for this? I see two ways of doing this.
The backend sends the user role to the fronted, the frontend knows
about what roles can see what elements.
Or the backend knows about the eleme... |
let's say I would like to create a service like eToro that allows people to trade stocks but with their own brokers.
If I do it just for me, it's pretty straightforward:
create logic that replicates someone's trades (or from my own instructions)
use my API keys to get the best price with my brokers and trade
Now if I... |
I am developing an engineering application (WPF, C#) that consists of a collection of other programs that perform specific engineering tasks. I guess you can think of it like Microsoft Office, however unlike MS Office, the programs within the application all share the same context in that the tasks that they perform al... |
I have the following problem. I have a method which takes two other custom objects to work. This objects are required by the method because they have the information that the method requires to perform its operations. Normally, you could mock the objects and just hardcode the API of this objects.
The problem here is th... |
I'm asking myself above question since I implemented an API that accesses a third-party API and currently write tests to increase my code coverage in the class that communicates with the third-party API. Currently I'm sitting at 76.6%. I covered possible third-party API-responses and JSON parsing errors.
What's left ar... |
We have an embedded device collecting data from various sensors attached to it. The data is then passed to the application. What is the best way to design the data packets? The data needs to be hardware agnostic. There's only one hardware device and one main sensor on that device that is collecting the data of interest... |
I've read Allow users upload CSV files, and embed the data for a simple API , Importing large data sets into a database over the web the closest concept is
Is there a way to efficiently allow a user to upload multiple content at once for e-commerce type sites? and the most thorough
A manual and automated CSV file upl... |
Most of applications, when you sign up, you must agree with some terms and conditions.
Should the information that the user agreed to those terms be saved in the database?
I asking this because I'm thinking, If the user breaks one of those terms, I will need some prove that the user agreed to it? Like have a flag on th... |
I'm currently working on an program that solves a graph optimization problem.
I know the "standard" software-design principles like information hiding, modularization, etc. What I'm struggling with here is that I feel like this use case rules out most of them as not applicable.
For example, I constantly have to use the... |
I'm trying to aggregate logs from multiple embedded devices in centralized place to be able to analyze them.
This is how system looks like:
I have number of embedded devices.
Some deployments are on-site and system might not have access to the internet. So I need to request customer to dump the logs and send them to u... |
For building a simplistic live search system, I trying to decide whether to use Websockets or Ajax. Implementation wise, for every letter the user types (or maybe every 0.5 seconds), a database query will be run against the input/typed text and some comparisons will be made on the query output to return the top 5-10 re... |
I am building an application for employee management. To start discussion, I have 3 roles: admin, manager and employee
admin does everything
manager owns a company and manages its employees.
employees only record their point and nothing more.
My tables are:
users (store authentication and permission information)
com... |
In the C++20 codebase that I work there are a couple of functions which have helper functions defined as lambdas. I can see the idea of locality for these helpers. By having them there in the function, one doesn't have to care about them in other parts of the code.
As the code is proprietary, I cannot show the original... |
I'm creating a mobile app that will have a verification process of the phone number like most of apps do when they use your phone.
I'm also developing the back-end but I don't know exactly what is the safer way to generate a 4-6 digits code and send by SMS to verify that account.
How should I implement the generation o... |
I have a question about gRPC communication.
I know gRPC has 4 models communication: unay, server-streaming, client-streaming and bi-direction. And the terms "client" and "server" very flexible, because it really is peer-to-peer communication.
I wonder "Can gRPC supports client-to-client communcation in case two or many... |
I do have n nodes managed by Kubernetes, all of them running several containers. A container may contain a database alongside with an application. As containers should be stateless, all data within the container's database would be lost (uppon restart or redeployment via Kubernetes). Hence, I thought of a central datab... |
Can I get some thoughts on the entity design?
Let's say I have an entity called Book. Let's say I create a specific instance of that book. It has a title A and an author B. Since there can be multiple books, should the amount be included in the entity OR should I instead create a separate entry for each of the same boo... |
I have created an application in which users and tasks can be entered.
A task should be be assigned to one or more users. If more users can do a task, the task should be assigned in such a way that it can be done by person A OR person B, or that person A AND person B have to do the task together.
In addition, more comp... |
I am interested in implementing the following requirements for my e-signature web application.
A user can create a new signing contract. That contract can include multiple users to sign. The contract creator needs to provide emails of the recipients. Every recipient will have additional data assigned, like signing det... |
I am writing a payment Processor class, then will take different payment objects in input and talks to external services to process payment.My class is designed using polymorphism as follow:
public class PaymentProcessor
{
DebitCardTransactionDetails processPayment(DebitCard);
CreditCardTransactionDetails processPayme... |
Recently In an interview I was asked this question -
Question- If are storing passwords in encrypted format in DB and in future when user login into our website how will we perform authentication?
Me:-we will first first encrypt the password using same hash function then compare it with already stored password.
Interv... |
The divide and conquer strategy for closest point problem sorts the points according to x coordinates so that the median could be found. But what does sorting the strip (strip array contains all the points which are at most d perpendicular distance apart from the median line where d is the minimum distance till now) ac... |
Let's consider such an example:
I'm an author of application like Google Chrome. I would like to my application sends anonymous telemetry logs to my server. How do I prevent somebody to use my server API to pretend he is my application to insert some malicious / spammy logs?
User of that application might be anonymous.... |
I've recently been working on a customerproject that makes extensive use of a signals/slots like mechanism. Their approach is to directly connect signals from a larger framework to private methods of their businessobjects. Now, my role has mostly to do with unittesting, and their approach makes testing fantastically ha... |
I'm kinda new in versioning.
In my scenario, for example, our main project is currently developing in 2.1.0 (develop branch), while the library version remain same as 1.5.0 since nothing change (for both 2.1.0 and 2.0.0 release).
So, few questions
If later on, we introduce some backward compatible fix in the library i... |
I'm reading about software architectures like Hexagonal architecture, Onion architecture etc.
They put a big emphasis on decoupling. The business logic sits at the centre and the UI sits on the outside. The idea is that the UI should not touch the business rules at all. It should be totally dumb and should just relay c... |
Git flow recommends to have separate branches .i.e.
main/master --> production deployable code
Development branch gets created from main/master --> active development branch (integration branch)
feature branch ---> Multiple Feature branch gets created from development branch
My question is basically, why I need to keep... |
I have a disagreement with one of my colleagues on whether or not functions should have inverse functions available.
I would like to know when/if inverse functions should be used.
For example, say we have a function isTrue(boolean condition){return condition == true;} then what I would do is also include a isFalse(bool... |
I'm dealing with a system where:
A number of around 50 microservices are available
Depending on their needs, clients design their deployment choosing which of those microservices they need
Most of them are not usable in isolation, but require others to be available, which is perfectly understandable.
Now the situatio... |
Alright so here's the situation...
All of my coworkers are used to RDP'ing into a Windows server and doing all of their work there. Whether it be coding, SQL work, etc. Multiple developers connecting to the same Windows Server (either 2012 or 2016 currently) and running all the same applications. Their workstations alm... |
I've recently come across CRC cards and sequence diagrams at my university.
Martin fowler has said that sequence diagrams are interchangeable with CRC cards when you're in the design phase of your development.
I had a university project which was rather small where we just went from use case descriptions to sequence di... |
Given a collection of objects and an action id (there is a corresponding "action controller" class, which can be found with the id), what is the best way to organize mass action on the objects?
There are some twists though:
an action is already implemented for a single object,
action may need pre-checks. Those then wa... |
Context
Hi, in my job we are trying to modify an API endpoint (/resources) to make special queries to it. A resource has a location (long/lat) and we want to make queries based on that location. We want to support mainly two different filters:
Filter by lat/long (already done): GET /resources?lat=0&long=0 returns a li... |
I'm doing some work with my team to refactor/rearchitect some parts of our existing codebase which consists of two separate Django apps hosted in one common project repository. We're starting work on a new app and at this point want to break down the project into more useful components.
Currently, our presentation laye... |
I’m trying to think what’s the best approach when I need data present in different services in a microservices-based architecture. In an e-commerce context, when a user creates an order the OrderService needs to confirm if the sent list of products actually exists and infer if the total price is indeed correct (data va... |
We have jobs running on-premises, many of which directly query our (on-prem) database. At the start of these jobs a new record is created in the database, and the record id is returned so that it may be referenced in future queries. We’ve recently started running other jobs in the cloud, but we have yet to run jobs t... |
For the sake of discussion, you can assume I'm using Entity Framework and a mediator pattern implementation in .NET.
I'm going back and forth trying to decide how to structure some of my data access in .NET. This confusion stems from the fact that I'm trying to follow the general advice of keeping my domain models and... |
I'm working on a c++ data analysis project. My workflow goes like this
Analyze the data and build models
Optimize the code for latency, to deploy for production
goto 1
Step 1 has lots of machine learning parameters, using which I test very minor variations of algorithms. In step 2, I clean up the unused parts of the ... |
I am trying to understand how branch prediction works, specifically with regards to correlative branch prediction. I understand that in an (m, n) branch predictor, there are m branch predictors, with each branch predictor being an n-bit predictor. My question is, given a set of 4 3-bit branch predictors, each outputtin... |
I have thousands of .csv files with the same structure and, in most of the cases, some column values are the same ones recurring. Each file represents a report on some structures, with numeric attributes and a date.
I want those to be structured and suitable for cleaning missing values, visualizations, predictions, etc... |
I know an empty method without any good reason is a code smell, but it can be required for constructors.
What would be a good way to write an empty constructor among the following?
class A
{
private int a;
public A(int v)
{
a = v;
}
}
class B : A
{
// 1
public B(int v) : base(v) { }
... |
I have a very simple standalone java application that allows users to tick which messages they want to transfer and then click go, essentially.
We now need to provide different users with a different set of messages on the UI.
e.g:
company 1 can only tick messages A,B,C and the rest aren't visible to them
company 2 can... |
I'm wondering what are the nowadays risks of storing a JWT that does not expire in an HttpOnly, SameSite=Strict, and Secure cookie.
I understand localStorage is vulnerable to XSS, and that normal cookies are vulnerable to CSRF, so that's why it's recommended to use temporary JWTs with refresh tokens.
My idea is that th... |
In a case where having microservices deployed as containers without any orchestration tool, they need to define some HTTP response headers.
A way to achieve it is by having each microservice define their own headers. Another way is by creating an API gateway that attaches them to each microservice response.
For one sid... |
I currently stumbled over the the concept of "ports" in UML component diagrams and I'm not entirely sure how they are supposed to be used. Sometimes, ports seem to be used generally as start of connectors. Sometimes, ports are only used as soon as a connector leaves/enters a bigger component. I've even seen examples wh... |
Say I want to test the behavior of the GUI while I follow a PassiveView approach. I also use the command pattern to handle the actions of the user. So given a PersonView and a PersonService with a savePerson(firstName,lastName) method, my command looks like:
class SavePersonCommand{
public SavePersonCommand(... |
We are using Jira to track all our tickets and confluence for documentation. We intend to document the test cases covered on Confluence.
Here are a couple requirements:
Consider a development ticket done and ready for release only when all of the relevant test cases have been written and approved
It is usually the cas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.