instruction stringlengths 34 36.1k |
|---|
Some of our customers from time to time report an unexpected behavior in one feature of our software and we suspect that we have a bug.
The feature itself and the kind of bug is not interesting for the purpose of this discussion, but just to fix the idea the broken piece is a command scheduler. From time time to time ... |
During my first attempt of implementing a project with the "Clean Architecture" I try to implementation a job portal where I came across a problem concerning the communication between (hopefully) two loosely coupled modules.
The two modules are:
Identity - responsible for user operations like register
Catalog - respon... |
The data of my application is retrieved from an XML file. XML file is versioned, but there is a new XML version file very often. The structure of each XML file changes with respect to the other versions. Sometimes the changes are minor, sometimes are big.
For example, if version XMLFileV1 contains something like:
<Shap... |
Suppose I have a class Texture that will be passed to a Renderer to be displayed on screen. One possible design is as follows:
class Texture
{
public:
Texture(unsigned w, unsigned h) : w_ {w}, h_ {h}, buf_(w*h) {}
void set_pixel(size_t i, Color c) { ... }
std::vector<Color> image_data() const { ... }
... |
I'm trying to figure out where to put business logic and why and where performance fits in. Im trying to get away from the fat logic-filled repositories that we produce a lot in my company.
So i'm trying to refactor this method DDD style:
var doesCollide = _bookingRepository.HasCollisionWithOtherBookings(bookingEntity... |
I am facing an issue that I don't believe is novel but none the less am having trouble finding a solution that fits well with our system. We have a constant stream of events going into AWS Kinesis. The way Kinesis works (to my understanding) is it reacts and recalculates some query based on new events. Now what I am tr... |
How can I distinguish between server-client and master-worker architectures?
is a pair of client and server a pair of a master and worker?
is a pair of a master and worker a pair of client and server?
must a worker be created by its own master? In comparison, a server is often not created by a client.
must a worker ha... |
What are the OOP best practice guidelines - in general or specific for ABAP - for using attributes to store data versus just passing it along as method parameters.
I'm having a hard time deciding when to do what and am also interested to learn more in terms of correct OO Modeling.
Cheers
|
I just read the book 'clean architecture' by Uncle Bob and really like the approach.
But the big disappointment came when I tried to implement it in C#.
I really hope you can help me with some questions.
What I tried was to implement the following component diagram:
A = Enterprise Business Rules
B = Application Busi... |
I have been tasked writing a "fire-and-forget" push web application, that can push high-volume XML messages (of several types) to multiple client endpoints over the internet (HTTPS). I don't need a response, or even to know if they've received the message or not - I don't want it to fail at my end if the message doesn'... |
I have looked through most of the answers given regarding using in-memory database for unit test, but I could not find one that was clear to me.
I am writing some unit tests to cover some of our codebase. The codebase is written in ASP.NET Core and EF Core. I am using xUnit and Moq.
I have read and understood the conce... |
From Software Architecture and Design Illuminated
In the master-slave architecture, slaves provide replicated
services to the master, and the master selects a particular result among slaves by certain selection strategies. The slaves may
perform t... |
I have one microservice named UserRegistration for user creation, another microservice named Billing where able to show the billing details for users.
After a new user is being created, it will send userId from UserRegistration to Billing through message queue like Apache Kafka or RabbitMq. Since these 2 microservice... |
I am working on an app and creating models now. I think this is a basic 1N normalization question but am not sure. Should I break location/address out as a separate table?
Let's say I have Parents and Children. Sometimes I will have children with no currently identified parents, and found at x location. Sometimes I wil... |
A friend of mine is working in a 200-employee company. The company's business has nothing to do with IT, but they do have an IT department to work, among others, on their website, used by the customers.
The website started with a core idea that programmers have to test the application themselves using automated testing... |
I'm building an API in .net that wil capture webhooks events of a third party service.
Lots of actions on the third party service will trigger the webhooks.
account.deactivated",
"account.deleted",
"company.added",
"company.deleted",
"company.updated",
"contact.added",
"contact.deleted",
... |
In some .NET libraries, there's a pattern of two alternative ways to call a function.
int i = x.GetValue(k); /* Might throw. */
if (x.TryGetValue(k, out int i) { /*...*/ } else { /* ... */ }
I don't like the names of these two functions as the not-Try variant presents itself the "normal" way to call a function. TryX, ... |
I have read about function vs procedure
function and procedure both are subroutines but function returns a value and procedure doesn't.
Can a function returning void be called a procedure?
Give reasons with definitions...
|
I've seen a debate on this. Nested trys in the catch, I can see that being okay. The outer try has already triggered a catch by that time, hence no scope issues. The other way....hides errors (it is a scope issue).
try {
try{
Throws exception;
} catch (exception innerE) {
outerE.printSt... |
My Laravel project starts to grow up and I'm starting to dealing with fat Controllers and Models. Probably I'm for away from the SOLID principles path and my code is not DRY.
I decided to refactor my layers logic to follow more SOLID and try to be more DRY. After some research over the internet I ended up with the foll... |
I am preparing for a discussion with my fellow programmers which will be about their use of the C/C++ #include directive. The codebase which I have to retrofit to Automotive standards is using includes of the form #include <path/out/of/the/blue.h>. To be precise: the projects carry around a large set of include paths f... |
I am in the process of trying to model a transportation module for an ERP type system using C# and EF Core. This service is responsible for managing customer pickups and company-owned truck deliveries. Customer pickups contain a list of orders and trucks contain a list of stops and those stops contain a list of order... |
tldr at the bottom if you don't want to read all this! :)
First of all the db I'm using is MongoDB! So I've been building a fun project and all has been well but I hit a small problem. Effectively, the project could be thought of as a simple button on a website. For each click of the button, the click will be sent to t... |
I've been wondering if this concept has a name and a consolidated theory behind.
If you need to build software, but you don't need it right now,
it's always better to wait because the technology will be better in
the future.
I'm pretty sure it is true:
IT tech is getting better over time: better softwares, bette... |
I'm thinking about this in terms of a No SQL database, more specifically MongoDB. So, I want to build something like Google Analytics where I will be taking in a ton of data and when it occurs so I can show how many times X happened this year/month/week/day/hr/etc. Like Google Analytics, other than the time stamp, the ... |
Suppose I have a table that saves plane ticket purchases. I need to keep track that I don't oversell so when a user purchases a ticket it needs to be stored in that table and other customers need to be aware of this.
Now suppose that this table may be queried and written to too often due to some promotion I'm running. ... |
When microservices need to talk with each other, the common practice will be to have some REST (or gRPC) communication.
I'm wondering what should be a better approach? (let's assume all services are in Java) -
Each service is using a freestyle REST client (e.g. OkHttp)
When service A needs to talk with service X, it... |
When reading the Python docs for writing C extensions, one can find the following text in the part about CPython's garbage collection strategy (emphasis mine):
... The disadvantage [of automatic garbage collection] is that for C, there is no truly portable automatic garbage collector, while reference counting can be i... |
I am not sure if this is the correct place to ask, please direct me to the correct place if this is not it.
Context
I have written a do-all, keep-all, serve-all API (it started small, then grew out of proportions) to function as User Management System for one of our solutions.
This API keeps track of all data, and also... |
Coming from Java, I was surprised to find out that Kotlin doesn't allow assignments as expressions.
Is there a reason for that?
Java (Works)
@Test
public void test_x() {
List<String> elements = null;
for (final String x : (elements = List.<String>of("1", "2"))) {
System.out.println(x... |
First of all a small introduction, im relatively new to Swift and to programming in general, been doing it for the last year and loving every and each new thing of this vast world.
My post is about some technical advices and to know if the decisions that are being made in my company makes any sense.
I will first addres... |
I understand accessors have to do with OOP. For other languages such as C, imagine you have a function that given 2 numbers returns their sum. Should you name it getSum() or sum()?
|
I am trying to revamp my legacy application to make it scalable and performant. Its current architecture is something like this
Consider a short-lived script that gets invocated 500k+ times a day, each invocation is a unique invocation (identified by a Key) and it writes a couple of structured files to its own unique d... |
I am creating a small program to parse the contents of Excel files. There are two types of Excel files, containing the same data, but with different templates.
It is possible to tell them apart with 100% certainty by checking the contents of a specific cell, which I call the fingerprint.
Follows an MVCE:
Creates an A... |
I'm wondering for best practices to upsert a document based on two identifiers.
@Document(collection = "cars")
public class CarEntity {
@Id
private ObjectId id;
private String color;
private String brand;
private Instant repairedAt;
...
}
Each car is identifiable with the combination of col... |
So i got a few xml files that need to be encrypted and it works, no problems here. Now since the latest update of the CodeAnalyzers i got a new warning ( CA5401 ) that tells me, that it is a bad idea to have a "nonstandard initializing vector". A little research showed me, why it is indeed a good idea to have a new IV ... |
My friends and I are trying to figure out which one of our professor's would win in a fist fight. (ie, 2 profs would fight at a time, and the victors of those fights would then fight, etc. until there is only 1 winner). We have not asked, but we suspect they will be unwilling to cooperate with us, so we want to compare... |
In our organisation, we're planning on migrating a Single-Page Application (with a complex back-end) to another Front-end technology (Angular to React). We'd like to procede with an Agile mindset by migrating progressively (page by page) and deploying frequently.
However, we're in a bit of a conundrum as to how to proc... |
Given the following class in a Legacy code base without any UT's.
So any refactoring done should be done on the smallest possible scale, just in order to be able to write UT's.
public class Person
{
private readonly PersonValidator personValidator;
public Person()
{
this.personValidator = new Perso... |
I am building an API Rest with Spring Boot and I would like to clarify a concept about my architecture, to see if the community can help me.
Imagine that in my database I have a table called Person. I am mounting an architecture based on three layer architecture. The general scheme would be as follows:
On the one hand... |
I have around 50 microservices which communicate with each other using Apache MQ implementation.
I want to know if I can avoid big bang approach when I need to upgrade the MQ version.
Current option that I can think of is put a switch in each micro service and then on the D day we switch on the new MQ.
But this is a b... |
I am working currently on a project that requires a series (almost 86) calculations to run based on a user data input. The problem is that each calculation has a series of requirements:
Should be able to hold a version variable to be able to distinguish changes on each calculation algorithm implementation. This way, a... |
I am implementing a system for a customer where they are asking me to use a fixed hash to protect the API as authorization. So this fixed value will be sent in the HEADER of the HTTP call as "Authorization":"[the hash]".
Meanwhile, when I was looking for RFC implementations I got to know that Authorization: <type> <cre... |
I'm a rather experienced software developer. I worked with many teams and projects throughout my career so far. The recent two projects, however, challenged me in an unusual way. Namely: they were disorganized, or rather organized in a way that I perceive as not effective.
Both of the projects are for the banking indus... |
We're using the gitflow branching strategy and it works well. What I can't seem to find though is a recommendation on what point people close their releases.
For example, suppose we got 4 environments:
develop
test
uat
production
We've been working on a selection of features on the develop environment and we are now ... |
So I'm writing a network simulator in C++ as part of a university project. Right now, I have a class structure that looks something like:
//includes type aliases
#include "GlobalTypes.h"
//main body of simulator, contains various static members and methods that define behavior of simulator
class mySimulator : public m... |
Not to sure if this is the right place to ask this.
But I have more of a Theory Related question then Completely Technical
I want to Propose my Issue at hand and then I'm looking for someone to give me a fresh mind on this and an Alternative way id be able to handle this
So I have this Mobile Ecom application everyone'... |
I have an example for a DFD for a patient information system implemented in a certain hospital. The below figure, represents the overview diagram (level 0-diagram, if we consider that the first level is the context diagram then the second level is level 0 diagram and so on):
In this system, patients can search and ma... |
While Players like Rappi/Alibaba / Wechat have gone the super app way, i.e on single app to host many unrelated services, Ecosystems like Google, Amazon etc still have multiple single purpose applications e.g google suite apps like mail, calendar, hangout, meet etc.
What criteria would a product manager look at while d... |
per the title how important is the data in assessing code coverage?
As background, let's say that you're given 20% of the entire dataset to help trace the different pathways each row of data goes through the code. My understanding of this problem is that the limitation of the data can mean that not all possible pathwa... |
Say I have a Person object. I need to ask the user to choose from a list, which laptop they have.
They can also choose the option "My product isn't listed here".
Now the Person object will look like:
{
name: 'John',
laptop: 'Dell'
}
If the user selects "My product isn't listed here", I can store it as:
laptop: 'O... |
I would like to include fastparquet as a dependency in a Python library I am working on but it requires Microsoft Visual C++ to build. The goal here is for the end user to be able to easily install my library via PyPi or with the pip install git+(url) one-liner. I found pip wheels for pre-compiled fastparquet binaries ... |
I am pretty new to programming languages and only have limited knowledge about design patterns, so I hope you can help me with the following problem:
I have an application that operates on a group of different services. One functionality of the application is, to provide an interface to the user to call every method of... |
Due to a lot of columns to chose from, the standard column selector in Devexpress doesn't cut it for me. So I thought of something like a "grouped" column chooser. This should work like a treeview with expandable "main nodes" showing all columns under the main node.
Here is a visual representation of what i mean:
Clic... |
This is not about storing my user's login details in the app, I already use hash and JWT tokens for that. There is a part of our app where we need to store the login details of the user for another website.
e.g they enter their username and password, it gets stored in my system and then my node server wakes up at night... |
I'm using Knex.js with TypeScript for database access.
Table
uid (UUID, auto-generated by Postgres)
name (varchar)
Model
interface User {
uid: string | null;
name: string;
}
Repository
class UserRepository {
public async insert(user: User): Promise<void> {
await knex('... |
I have a solution for Xamamrin.iOS and Xamarin.Android application with structure as below,
Solution Root
Common Project
Xamarin.iOS Project
Xamarin.Android Project
I need to branch both iOS and Android projects, but I am facing a problem, when I branch the Xamarin.iOS project alone for example, I get in my worksp... |
We work in scrum teams with a product owner who is responsible for the backlog and prioritisation of that backlog. Recently the topic of un-ticketed work came up, developers for one of the applications are doing un-ticketed work that they regard as important. Typically this is tech debt but can also be things like migr... |
Background
At work we've been trying to find a new workflow. We currently follow git-flow pretty closely. We don't have release branches; we just merge develop directly into master once we feel like it's well tested enough. When we have a hotfix, we independently merge it into both develop and master.
One of the approa... |
So, I have an application here that posts requests to another service via REST API calls. I have to implement a health check within my application that ensures that the other service is up. I'm a software noob here and my question is this:
When do I ping the other service to check if they're up? During my application s... |
Imagine two classes:
class Person {
MarriedPerson marry(Person other) {...}
}
class MarriedPerson extends Person {
}
The idea is that a Person is automatically "morphed" to type MarriedPerson when the method marry is called on it. For this reason you would need to create an instance of MarriedPerson and transfer ... |
I am building an interpreter in C for a simple programming language.
The interpreter is fitted with a built in garbage collector. The GC simply marks all objects which are linked from some root (the call stack, the evaluation stack, loaded modules, etc.) and collects the rest.
I am now writing an extension DLL for the ... |
CSS is a syntax for specifying the appearance of text and other web content, sizes and lengths are defined in pixels, however pixels have different sizes in different devices, this is the most notable in mobile devices.
If the developer wishes to specify lengths in distance units like centimeters or inches, the CSS spe... |
I'm developing a Spring boot / Batch application.
What I'd like to do is to have a separated module for every job. This is a reasonable decision because different tasks (Spring Batch Job) have different domains.
The first thing I've thought about is to make a maven a module for every job. Then, you only need to add you... |
Context
We are creating a library that makes an API (HTTP) request to a 3rd party.
During testing we have written mock versions of the functions that make external requests so that we can test the other functionality in isolation.
Question
Should we export the mock version of the functions in the library so that the ... |
I'm currently building an education website which contains a lot of content such as questions, videos and notes which all need to be securely locked away and exposed to users with relevant permissions.
Now one thing I'm stuck on is how to implement a way to store all the course data, questions and videos.
I believe I ... |
I just learned about Business Rule Engine concept. I'm a junior software developper therefore I don't know much about it.
But I was wondering if at all it could be possible to inspire myself from this concept and create an engine for input validation. Depending on the type and purpose of an input, the engine would trig... |
I mainly work on custom web applications that have just one production deployment.
While we are moving to continuous delivery, I was wondering if that approach reduces the need to make settings configurable.
For example, I was writing code that sends confirmation e-mails from a web server through Exchange.
Quite some ... |
In a tree structure, is there a standard term (in software engineering industry practice, Computer Science or Mathematics), for the predicate f(x, y) defined in human language as "x is an ancestor of or identical to y"?
Example:
Given the tree:
A
/ \
B E
/ \
C D
Then f(x, C) is satisfied by x in {A, B, C... |
Some node.js libraries (just as an example) can pull in literally hundreds of dependencies. Some of these dependencies are small packages that only have one contributor. Often times the contributor doesn't even have any personal information listed other than their username.
How is it possible to trust that nobody in th... |
I have a question in regards to designing relationships in REST API's. Imagine I have a relationship like in this diagram
Now, should I show the relationship in the team endpoint like this?
/v1/teams/:id
{
id: "66e08a2b-2495-4edc-a528-ef00a3f908f1",
name: "Sales",
description: "Lorem ipsum dolor sit amet,... |
I want to have a Client-Server-Model with Smartphones within a range of 50 meters inside an application. One of the Clients is supposed to be the "Host" and it's only job is to receive data from all Clients and do something with it (not important). Everyone should be able to see all the other Smartphones, that have the... |
Imagine a grid like the one in the image. I have to model an API which identifies a single segment inside a grid (like the one painted in red).
I thought the segment should be represented with something like this:
int rowIndex -> specifies the row in which the segment is placed
int columnIndex -> specifies the column i... |
This question is asked in a general way. In case it is hard to understand, I have added a concrete example below. I am interested in the answer to the general question.
I have a lot of experience writing programs of type X, but now I need to write a program of type Y.
Everybody says programs of type Y are easily done i... |
I've joined a small software development team to work on an existing code base. While I am tasking myself with learning the required programming languages and actually reading the code, I'm wondering if there are things software engineers would recommend I do in order to efficiently get up to speed on working with an u... |
When you have an application that suffers from the unfortunate interaction between TCP delayed ack and Nagle's algorithm, common solution offered is to turn off Nagle's algorithm.
However, in general searching through the net, it looks like Nagle's algorithm is overall better idea (basing it off the algorithms in gener... |
I'm working on a RPG so my character can equip a Weapon, Hat, Boots, Gloves, etc.
So I have an Item class for the different items and the only class who adds new Behaviour is weapon. I'm not sure if is a good idea to extend the class for the different types of items.
I think yes because for example, in the Hat slot you... |
Currently we are looking for a solution to sync databases across multiple locations. We a location hierarchy such as Country -> State -> District -> Center. To increase speed and reliability of the access of data, we thought that we can have partial synchronisation of database as you go up the hierarchy.
e.g.
... |
I'm new in programming I knew some programming languages.
When I search anything about any program it is written in more than one programming language.
How can I do it. And it is important to use multi languages to make a advanced programs?
|
I am still thinking about clean architecture and just ran into a question regarding the higher levels (Views and Presenters)
I am posting Uncle Bobs picture first here that you remember what I am talking about:
Lets say I have a small application where CRUD operations can be performed for customers.
Lets also say ther... |
I have a few microservices that i would like to combine in form of an api. The main purpose of the api is to be used by our (first party) mobile app. A side note, we don't have a mobile app or web app right now and we want the backend completely decoupled from the frontend. But i can see that soon a few third parties m... |
I am implementing a dashboard. I figured I'd make it work like a SPA for cleaner flow and better performance. When you click a sidebar link, the page/section gets loaded with AJAX. You can still browse the URL for each page, loading the whole thing.
I'm unhappy with the architecture I chose, and that's because of my la... |
Here is where I am at right now: I know that relational data, like that found in relational databases like MySQL or Postgres, is relational because there are relations between the tables. That is the reason why RDBMS have rigid schemas. On the other hand, NoSQL databases offer a looser schema but lose those relations. ... |
Working in insurance usually mean you need to deal with a myriad of rules and logic for rating, policy, and claims processing. These are steps in the insurance lifecycle.
Every insurance product (life insurance, travel insurance, etc.) generally follow the same flow above but with a big difference in the logic for each... |
Let's say I'm trying to write a library that abstracts certain actions. In this example I want to turn a light on or off. There could be hundreds of different kinds of lights that are controlled in lots of different ways, so I have an interface like so:
public interface ILight
{
bool TurnOnLight();
bool TurnOff... |
I am working on a project in which I have a tree with 4 layers and the hierarchy is like this.
Customer -> Site -> Location -> Guardroom
In DB each entity has its own table and the child knows its parent's Id.
public class Guardroom{
public int Id {get; set;}
public string Name {get; set;}
public int LocationI... |
In Software engineering , I usually see that the word module when written it usually followed by a bracket (components, packages, classes … etc.) meaning that a module can be a class or a package or a component. I know that a module is a piece of code that do something. I am so confused when to use the word module or c... |
Let's say I have a very large student list want to filter if each of these students is satisfying some specific classroom school and classroom limitations. So, in my data model, I have School and Classroom entities. Limitations (let's call them filters) are like
Age is greater than 9
The grade is equals to 2
Wants to ... |
Is porting code from one programming language to another considered as plagiarism?
|
I have a situation like this: in my online game, players are represented by class Player, which is instantiated and assigned their socket upon their connection to the server.
When simplified, some of my code looks like this:
class Monster
{
Player targetedPlayer;
void FollowPlayer(Player p)
{
targetedPla... |
I have designed a simple objects validation framework in Java in the context of a code refactoring.
The framework has a ValidationRule interface with one method Errors validate(MyObject myObject, Context ctx).
There are a number of classes (Validators) implementing different validation rules, each validation checking ... |
I have a huge DB,and CalculateTasksFromDB() takes a long time (and lots of memory).
Once that method is done,there is a huge list of tasks.
There are worker processes in the system (at any point in time the system might have zero to 100 of those),each needs to get the next tasks it needs to work on.
The tasks different... |
I'm trying to wrap my head around the best possible solution in the following situation:
When updating part of an aggregate, could be any part of the aggregate so either the root or any other entity, how could these changes be persisted back to the db layer.
There have been a lot of solutions on StackExchange advising ... |
I'm building a library application. Let's assume that we have a requirement to let registered people in the library to borrow a book for some default period of time (4 weeks).
I started to model my domain with an AggregateRoot called Loan with code below:
public class Loan : AggregateRoot<long>
{
public static int... |
TLDR with bold
I want to create a library (I think this is the right term) for my own reinforcement learning environments (envs for short). Most of the envs would be based on self-implemented games created either in pure python or in c++ with python bindings. What would be the best way to structure this project in a ma... |
I have a function which takes the incoming request, parses the data and performs an action and posts the results to a webhook. This is running as background as a Celery Task. This function is a common interface for about a dozen Processors, so can be said to follow the Factory Pattern. Here is the psuedo code:
processo... |
I aim to understand pull model MVC. I'm stuck at defining a model for a simple color-guessing game in Java Swing I chose to practice it.
I borrowed the model's initial version from an example which was very simple:
class Model extends Observable {
private static final Random rnd = new Random();
private static ... |
Essentially I've got a bunch of formulas in two giant methods in a class designed to do math transformations and evaluations to multiple inputs. Where the inputs are actually lists of inputs (as there are some sums involved too). Later on I want to optimize this code by utilizing GPU/CPU accelerated matrix multiplicati... |
The base class (in the base lib, not owned by me), has upgraded its code and add a new method to support additional use cases.
This is the existing method signature in the base class:
public void Alert(string someAlertString);
With the new release, the base class is supporting a list of AlertObject (at some point the ... |
I am trying to develop a demo application and confused while designing context.
Let's say we have three entity and their properties
User
Id
Email
Todo
Questions
Answers
Value
User (who answered)
Survey
Questions
Answers
Value
User (who answered)
Now I have 2 ques... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.