instruction stringlengths 34 36.1k |
|---|
I recently finished an interview with a company as a web developer. I'm the first and only developer that is about to be hired in this company.
They have a web application that was created by a software company, and they have received the source code of the app.
Years went by, and now they want to refactor their web ap... |
I'm very new in DDD and I was following one of the videos of GohperCon to structure of my Golang App using DDD with Hexagonal Architecture. At the lowest (deepest) layer is the storage that can be Memory, JSON, SQL ...
I'm planning to use MySQL and I structured my storage directory as follow:
app
|
+- storage
|
+... |
According to Why define a Java object using interface (e.g. Map) rather than implementation (HashMap), I should declare the most abstract type as possible. However, in some cases I remember, especially for UI related codes, I can't declare the most abstract type because those UI object usually require to run some child... |
If I give a real example, I want to create a desktop software that includes:
electron js app that communicates with react js using IPC channels.
I need to communicate with software that only has a Python module. so I created a TCP server/client communication for this purpose.
I have a printer with C++ SDK. so I also c... |
I am working on a tool that scrubs Do-Not-Call (DNC) phone records from a skip-traced CSV file.
I have this PhoneModel for child phone entries for each row. It consist of the following fields:
isDNC
score (How accurate is the phone number for that record)
phoneType (Landline, Mobile, ...)
phoneNumber
date (last update... |
I'm reviewing some lecture slides and had a question on the following slide :
Assumptions (8 clocks to transfer data) Up to 3 outstanding load requests.
The slide is illustrating that the number of useful math instructions that can run is limited primarily by the memory bus bandwidth. Of course the "8 clocks to tra... |
I could not find anything regarding this question except some lecture notes about game design and a book which describes something similar but not quite the same.
General Description
The approach is as follows.
There are two kinds of state in an application: Core State and Derived State. The Core State is any state tha... |
When writing code on a desktop pc as well as on a laptop or other computer, is there a general recommended strategy for being able to keep the same environments set up on both machines?
I use Git heavily for keeping the code sync'd, VsCode has settings sync, Pip and NPM etc for packages, but there are other aspects of ... |
Suppose I need to find the last selected index of options according to last selected contents, eg: options : A,B,C,D,E ,last selected option: C, so the last selected index is 2.
There is a special case : If last selected option does not exist in current options (including case that no options), last selected index is 0... |
As an embedded firmware developer, I often write classes to represent/act as drivers for hardware on a microcontroller. These driver classes will usually contain pointers to hardware registers and other state variables.
Often, these drivers inherit from some generic interface. For example, assume I have the following... |
This question is inspired by comments on this recent question. In that question I asked about a version tagging workflow. A few commenters suggested it was a little strange that I'm tagging and releasing every new feature that is merged into main. It sounds like it is more typically to collect up a few new features and... |
Summary
I saw a solution to a problem described as having O(c) Time complexity where c is the number of unique items in n.
I don't understand why we can say the complexity is O(c) despite looping through all items.
Example
func foo(items: [Int]) {
var uniqueItems: Set<Int> = // ...
for i in items {
if ... |
I've been reading this Wikipedia article Composition over inheritance. It gives a code example of inheritance first, and then a code example of composition. In case of inheritance there are data that are present in form of the model field. When any of the methods draw, collide or update need to do their function, they ... |
According to When is a number a magic number?, I know magic number should not exists, so I know the following code about creating a Label from some UI framework and set the color RGB needs to be improved:
Magic number version:
Label* label=Label::create("someText");
label->setRGBColor(32,128,192);
to refactor it, eve... |
I'm working on an embedded C++ project that involves logging certain types of statistical data (like successful accesses, failed attempts, and other events) to the flash memory (just incrementing these values). Due to the nature of the system, power can be lost at any moment, making it important that all data is writte... |
At my org we extensively use @Value.Immutable annotation to generate Immutable classes (usually with builders) for our internal data transfer objects (DTOs). In our codebase I've seen both interfaces and abstract classes being used for such DTO definitions.
For example for a DeviceData DTO we could have an interface as... |
Consider a processing system which ingests objects from an external source and performs extensive processing. One example could be objects detected by a computer vision system which are then fed into a security alert system that looks for particular movement behaviors, and abnormal positioning.
The external object prov... |
I have three seperate fields and all three are unrelated to each other but part of the same collection (Tables for SQL folks).
Now, what I'm getting stuck at is, should I allow end-users to make one big PUT request to update the data in those fields or should I have the end-user send multiple PUT request.
One thing to ... |
Many times while writing MVVM apps in C# I've come across this sort of problem where I need to expose the model in a view model so that I can get it in another view model and do something with it.
Currently I have a model with a mutable list of nested models. The models are just data + serialization logic.
public inter... |
Powerful reflection capabilities make implementing nice architectural design patterns such as MVC and Dependency Injection very simple in languages like Java and Kotlin. In particular, reflective tags and annotations make it possible for a DI framework to "feel out" the layout of the program, "catch" controllers and vi... |
I'm working on a system and we need to do some refactoring on the upload service, that handles all files and images uploads to the system. Nothing fancy, but I it got me thinking about the folder structure we are using, and how others do, if there is any benefits doing one way or another.
For example, the folder struct... |
I was just reading a StackOverflow question here, about extracting the version number from a node package.json file. And the simple
'read in the json and access the property in your build tool'
got huge number of
'no no no you risk exposing all your dependency versions to the client'
-type responses.
But I'm a bit ... |
I have an android app in which I am trying to follow the MVVM arcitecture.
I have a Room database, abstracted by a Repository class that has methods like getAllData() which I use in my *ViewModel classes.
Now I want to quiery the data in the database, namely getAllData(), then filter, group and transform the data in di... |
Given a graph layout like the following image, where the layers/rows (y coordinate) and ordering of nodes within each layer have already been computed, what algorithm can I use to make it look "nicer"?
Just to clarify, all I am wanting to change is the X coordinate of each node. The y coordinate (the layer) should rem... |
I want to make my own pooling library.
By design, I want each poolable class to have a reference of the pool it came from, so ideally whenever the user wants to make a class poolable they'd have to inherit from some Poolable base class.
But that seems to immediately have major drawbacks in OOP design. If the user wants... |
How can I do conditional mapping in Domain Driven Design?
Let's say my application is structured like this:
- Core
- Domain
- Application
- Presentation
- DTOs
- API
I have an aggregate root called Post which also has a list subscribers to that post.
Here's the deal: Only the moderators are allowed to retrieve... |
I’m looking for some advice on best practices for Visual Studio workflows.
I maintain several C# libraries which I use in various projects I develop. I also make them available publicly, as packages on NuGet and as source code on GitHub.
Because I am often tinkering and tweaking my common libraries as I use them, I typ... |
In relation to another question I had, I have been researching Simulated Annealing.
The general example used with this algorithm is the traveling salesman example. I have been testing the code described here : https://jamesmccaffrey.wordpress.com/2021/12/01/the-traveling-salesman-problem-using-simulated-annealing-in-cs... |
My first introduction to object-oriented UML statecharts was the book "Practical Statecharts in C/C++" by Miro Samek. He proposes a framework in which the state machine is a single class and each state is a method within the class. Once you have developed a state machine, it is easy to inherit/extend its behavior sim... |
Can NIC handle(send/receive) multiple packets at once?
For example, 2 asynchronous tasks request 2 different things from a database. Are those 2 requests sent simultaneously by NIC? Also, are the responses interpreted simultaneously by NIC?
|
I am looking to enhance my skills in back-end technologies and would need your help in setting up a scalable microservices architecture.
Here's my project.
I have N sensors that send me data (Pressure, temperature, pollution, etc.) every second.
I would like to create a web interface that displays the latest known valu... |
I'm trying to solve the following problems here:
In the X world, companies have a hierarchical structure to form a large binary tree network (can be assumed to be a perfect binary tree). Thus every company has two sub companies as their children with the root as company X. The total number of companies in the structur... |
I built an app in the way that one context is closed in one package. However, as code grows there are more situations in which the code is duplicated. As I understand the package should contain everything that is needed for the given feature within its context. On the other hand, the dependencies between packages make ... |
In the Scrum framework, the Product Owner is the person responsible for preparing the backlog, refining it, and prioritizing it. He/she is expected to be a domain expert and somebody with enough technical knowledge to make meaningful decisions on what to prioritize first (with the involvement of the dev team, of course... |
Main execution thread creates asynchronous job (started and executed by different process) that works on same data that the main thread. For example we create some database entries, that we want to process asynchronously later, but choose not to do it in main thread. This creates a situation when main execution thread ... |
I have Projects table. Projects can have costs, so I have a Costs table. A cost can be because of a product or beacuse of a service. So I have 4 main tables:
Projects (IDProject, Description...)
Costs(IDCost, price, quantity, IDProject...)
Products (IDProduct, IDProvider, Reference, Description...)
Services (IDService... |
I have a rich client with quite complex domain logic and I want to keep the domain and presentation layer separated. How would you advice to intergrate the domain logic with the UI in this case.
I implemented in the domain objects and services in following fashion
public class ProductOrder
{
public double SomePara... |
A bit of architecture here, I want to determine if there is any concern(s) about it.
The interesting part, in diagram below, is the communication between the Local Service and the browser that a user is running. The browser makes requests to the remote service API, but would also do requests to a Local Service (using ... |
So I am designing some microservices that communicate via messaging and event queues.
However, if I update a message class, for example remove a field, this will break several participating microservices and require a redeployment. I can see microservices can be deployed independently, but not if there is a central cha... |
I'm writing a compiler in Rust. I've reached the point where I have an AST and am ready to do symbol resolution, type-checking, etc. But, I'm unsure of how to represent an AST as containing "unresolved" symbols and "resolved" symbols.
Background
To achieve separation of concerns, I'm first passing over the AST to resol... |
I am an inexperienced developer fresh out of college. I was handed a Windows Forms Application to work on.
The application previously relied on system time. They wanted me to make it so that we could adjust the time within the application. No problem at all for me, I just added in some number selectors for up to +/- 23... |
Question
I'm working on a C#/.NET Core project, and I'm looking for guidance on organizing interfaces, especially when it comes to using NSubstitute, Moq or other libraries for mocking, because there I need an interface. I've explored different approaches and would like to gather insights from the community.
Inside De... |
I am developing a web application using Java servlets, and I would like to know what the software development community thinks of the following programming practices:
Use static member variables for the names of input parameters.
I created a separate class that contains static member variables to store the names of in... |
I recently had a project that I took me 4 months to do , I hit some very significant bugs that where impossible to track down. I said this code is absolute garbage and started from scratch, drank a monster and got cracking, people tried to distract me but I persisted. I sent the code to QA and I personally tested all t... |
I am building 2 REST microservices: ParentService and ChildService. I need to build endpoint to fetch all Child resources related to specific Parent, so I have these URI's as options:
GET /parent/{parent_id}/child
GET /child/parent/{parent_id}
POST /child Body: {parentId: 123}
But neither seems to be proper solution... |
EDIT: more direct situation
I need to design a program that will create particular objects and run computationally intensive procedures using its fields in order to update other fields. When a procedure completes, other procedures can now be launched using the new fields.
These objects are saved to disk and used in lat... |
I'm working on building a library in Java which could provide the ability to record runtime data.
For instance consider the below code:
public interface ItemElement {
public int accept(ShoppingVisitor visitor);
}
public class Book implements ItemElement {
private int price;
private String title;
... |
We want to install Kafka Kraft cluster on 35 machines ( machines are DELL physical machines - type R760 And OS is Linux RHEL 8.6 version )
Since we are dealing with Kafka production cluster , we want to understand what is the best Practice and the right approach to install the machines and configuration
The question ab... |
Could someone explain to me if the relation in this class diagram is a "dependency" or "association" relationship and why?
I cannot edit the picture. The terms translate into English as follows: Pessoa = Person; Agencia = Office; Conta = Account
|
I recently worked on a project where the team were writing lots of unit tests for hardcoded values, for example, unit tests that test the value of a string constant. The justification being that they protect against accidental change.
It feels like overkill to me, we had hundreds of tests and they never once caught an ... |
Please help me understand why, in this diagram, "Validate User" is considered a use case.
My understanding is that to qualify as one, a use case must:
Be initiated by an actor;
Represent the actor's goal;
Deliver discernible value to the actor.
The use cases "Withdraw Cash", "Transfer Funds", and "Deposit Funds" all ... |
Trying to understand and compare synchronization primitives, like std::future/std::promise, std::barrier and std::conditional_variable - developing an intuition for which one to use when exactly.
I have this scenario where there are two threads synchronized via a flag. Basically, A expects B to signal upon setting a fl... |
Quoting this article - The Other key differences: gRPC vs. REST section (client server coupling):
Client-server coupling
REST is loosely coupled, which means the client and the server do not
need to know anything about the other's implementation. This loose
coupling makes the API easier to evolve over time. This is be... |
I've come across a scenario where data in one table is related to another table but referential integrity doesn't seem to apply as I would usually expect. This is because table x uses data from another table y but y can change independently from x. This only happens in some scenarios related to the state of x.
Consider... |
I am learning programming on my own following standard programming language textbooks. I come from a math background. I learned C on my own, but never really got to the more advanced portions.
I tried taking a coding course in college for CS wannabe majors who have no coding experiences. They keep talking about the ... |
For updates on a dashboard, I need to decide to make an extra api end point which creates a message in SignalR or let some kind of message broker (filewatcher1) do that. What would be good architecture?
Context
I've created an api which reads and updates data of an ERP. The ERP has its own client (UI) where users can u... |
I've developing a .NET Core library meant to simplify the configuration of the authentication within our SSO system. It will expose two methods to be called in the Program.cs (or Startup.cs) of ASP.NET Core web apps:
public static AuthenticationBuilder AddFederatedAuthentication (this IServiceCollection services)
publ... |
In a Java Spring API, I'm implementing GeoJson Conversion Service to convert different types to geojson, I have GeoJsonConversionService interface, and one implementation is FileGeoJsonConversionServiceImpl class
First question:
should the service name indicates the "action" or the "actor", which means should it named ... |
We are working on a ubiquitous language; however, there are different terms used for marketing purpose and one used for product team and engineering team. The marketing team's term is more for PR purposes. Wondering in this case, is it OK that we have one terms that is specifically for marketing team and one for produc... |
We have a large code base with lots of workflow data (camunda) that does this:
Create a reporting event in the codebase
Give it a code + payload
Put the item on a message queue
Consume queue elsewhere using lambdas
Write data to the warehouse
Whenever the workflow changes, new reporting events are written.
Start/End ... |
My team and I are beginning to mock our API responses in our iOS app so we don't have to worry about our backend being up when testing.
I have conditional compilation directives based on the SWIFT_ACTIVE_COMPILATION_CONDITIONS flag, specifically DEBUG MOCK_SYSTEM. This flag controls whether my code uses mock data or se... |
Does it make sense to organize screen resolutions?
I write a lot of selenium tests, often which I need to choose a resolution for the browser. I ended up creating a dictionary with some of the more common resolutions I need to test, but I've never been happy with it.
DIMENSIONS = {
# 4:3
"1024": (1... |
I have a situation involving a parent component, children, and async fetch operations, and I am wondering how to best structure it.
The current code structure I have is as follows:
I have a parent component with a textbox. When the user types in the box, it triggers our debounced API call.
useEffect(() => {
debounced... |
Suppose I have the following client code:
using System;
namespace InterfaceCompositionUml
{
internal class Program
{
static void Main(string[] args)
{
MyInterfaceImpl x = new MyInterfaceImpl();
MyClass y = new MyClass();
x.MyProperty = y;
Console.WriteLine(... |
I have a question about encapsulation and I read these two topic (this & this) but I got more confused.
I've been reading Head First Object-Oriented Analysis and Design book and I'm trying to learn oop.
in one of the pages of this book, I've read these lines:
The idea behind encapsulation is to protect informationin o... |
New to a software engeneer job and I am kinda blocked on the way to go with my new project
To explain this in a scheme.
I have a source of data in a custom app that is for most part of the time the result of a stored procedure.
Here is a path (Fictional used as an example) of the path that the data had to do before go... |
What is a good way to indicate in programming that the sequence of digits you see is not a value you can do math on?
I use a lot of numbers which aren't "numbers". From account-numbers to patient-id numbers country codes to the codes for human sexes.
What I want to prevent is that others put those "numbers" into an int... |
In an app I'm working in there's a service class(among others) which is used just to call methods on other classes. Recently I've had to work in that area and add another method that does what all the other methods do, call other methods from other classes. Arguably, this whole class shouldn't exist, but that's another... |
Let's say my domain has a User Entity that has a many to many relationship with itself representing "Friends"
public class User
{
public int Id;
public IEnumerable<User>? Friends;
}
In my application layer, I have a service that makes 2 User friend together and the only requirement is that they are not already... |
TL;DR: Should the domain layer span the entire breadth of the app such that everything can be simulated, from point A to point Z, or may the application layer be used as the orchestrator and serve as the glue between modular pieces of domain logic?
I read the first 100 or so pages of Eric Evans' book, where he describ... |
My organisation is adapting a new SDLC process, and a part of this is to force engineers to map acceptance criteria (AC) to unit tests written for each user story in the pull request (PR).
To satisfy the enforcers of this SDLC process, our team wants engineers to manually create a table in PR description to map accepta... |
In my organization, we often have meetings to discuss potential points of system failure, prior to implementing much / any of the actual code. This helps us to identify points of architecture, and define test cases. We incorrectly call this "GameDay."
I see project management has the term "premortem" which identifies... |
During development of libraries (mainly for use in internal projects) I have come across the "problem" of how to design them in a generic way. I am going to demonstrate with an example library that I have implemented and use in code.
But first, here is a summary of the ways I know to "distribute" a library in C++:
St... |
In a C# ASP.Net Core Web Application I have a Domain Model CentralDesignObject made up of many component objects & properties, producing a significant amount of derived/calculated values.
This CentralDesignObject includes a reference to a DesignType object. This DesignType determines various fundamental characteristics... |
I read an article about that using an interface for an entity is an anti-pattern for these reasons:
Your interface signature is identical to your class.
There’s only one implementation of your interface.
Your entity has no behavior to abstract, yet you’ve created an abstraction anyway.
But if I have multiple entity i... |
I'm trying to implement LOGO with a physical turtle. I got all the basics done, but I got completely sunk when implementing the "Window" mode.
Original LOGO had 3 modes: "Border" - the turtle bumps into border of the screen and stops there, "Wrap" - the screen is a torus, turtle rides out the left side of the screen, r... |
I am trying to improve the architecture for my React app project that has grown in size lately.
I'm looking at Hexagonal architecture and Clean architecture, and I couldn't really see the difference between them.
In Hexagonal, there are main elements like "entities -> port -> adapter".
In clean architecture, there are... |
This is the node for a tree
class Node {
public:
string name;
map<string, string> attribute;
Node* parent;
set<Node*, customComparison> children;
};
Where customComparison in the line set<Node*, customComparison> children is a custom < operator I'm trying to define for Node* objects for use in the set data... |
Say we have a function of the form
def func(num: int) -> int:
num = num + 1
num = 2 * num
num = num**3
return num
and let us act like each line is a long computation so that we want to break down func into several functions. For example,
def _func_a(num: int) -> int:
return num + 1
def _func_b(num... |
Coming from a math background, counterexamples are equally, if not more, helpful to me for understanding concepts than examples. I've seen many, many examples of when and how to use the SOLID principles, but I am wondering if there are some good examples of when enforcing these design principles is a bad idea.
More con... |
I have an object with fields like ID, CODE, NAME, etc., and it has its own database table with each field. And I am working on implementing the REST API for this object. I want to expose all these fields but also the additional field TYPE, whose value depends on the CODE field. If CODE is in a valid list, it will have ... |
For the following component, how would I extract the unit logic to allow for composition? In my actual app I am trying to reduce the amount of logic encoded in the component and I have decided that the unit logic (prepend or append, the symbol, how to format the value) does not make sense to be embedded in the main com... |
How can I make DRY (lacks repetitive patterns) code that also avoids inefficiencies from using intermediate values in a calculation that might not need to be used?
Here is an example:
In this code, I am using an octree to store a region of 32x32x32 voxels, and I need a function to get and set any given one of the voxel... |
In my experience, it is customary to place local variable declarations at the beginning of their scope. Several questions in this forum ask whether this needs to be so, and their answers tend to agree on that variables should be declared nearest to their use. This answer suggests a goal of scope minimization, but does ... |
I have this survey software that I'm writing and I'm wondering what would be the best design for my requirement.
I'm going to simplify it as best as I can.
I have these entities:
class Survey {
public Guid Id { get; set;}
public string Name {get;set;}
public ICollection<SurveyQuestion> SurveyQuestions { get... |
I am new to DDD and I am having trouble structuring an object. I have a cart, where I can add products to it. Each product has some properties like image, title, price, etc. Whenever a product is added to the cart, the database stores this relation in a separate table, called cart_products. This new table allows me to... |
I am a frontend developer (currently working with Vue and TS), and I have been searching for better organization of the frontend code and recently I got to know DDD a bit. I know DDD is mostly used for backend, but since it has some very nice ideias to it, I decided to give it a try and implement a little bit of fronte... |
Semantically, C++ std::optional, Rust Option<T>, and other optional/nullable types represent a value that can be present or absent: you have to handle both cases, or you can opt-in to crash.
Is there utility in a type that represents a value that doesn't exist yet, but needs to later on in execution? Or does such a th... |
I am quite new to design software and especially graphs. So I am working on a full-stack app with a back-end built on FastAPI (python) et front-end on React.
I need to create 4 graphs on a single page on my React app. Each graph is a time-series graph (simple) but with 3 millions data points (every 3 seconds since a co... |
Introduction
Hi everyone,
in my company we are using microservice approach and of course are trying to do it as correct as possible. There is a new requirement coming up where I have laid out a proposal for an architectural design. I have received feedback to change the implementation, however this would require direct... |
I have a streaming application (written over spark/storm/whatever does not matter). Kafka is used as a source of stream events. Now there are some events that take significantly larger resource (time, cpu etc) compared to other events.
There are application specific nuances in how these larger messages are dealt with i... |
I have started a flutter app and want to apply clean architecture to it. The first use case i have is the following:
A user provides file(s)via "open file" dialogue. The provided files should be analyzed in first step. After this, a summary with different statistics should be displayed. For example how many files were... |
I'm writing an internet service in Rust that works more or less like an HTTP-server, just without the HTTP part, and strictly over UDP. I also have a requirement to build it like an old-school game of the 90s, because it supposedly produces code that is simpler to compose, maintain and debug than any other way. So I ne... |
I am making a web application for parameterized procedural world generation. Given the computational resources involved, this application involves a server backend for generating the world with an API connecting the server and client. This API is written in Python.
To expand the creative possibilities, I would like all... |
I have an application service that retrieves Order data. The service is consumed in UI, where it can be edited by users.
Additionally, the users wants to see related data such as ordered products' descriptions.
Is it UI's responsibility to load the additional data or should I modify the application service to include a... |
I'm currently in the process of integrating Clean Architecture into my Spring Boot project and I'm seeking advice on the ideal project structure and the types of classes and projects that should be incorporated.
Specifically, I'm looking for insights into how to layout the project and the essential classes and projects... |
I've created a small prototype browser plugin and am now thinking about making it accessible to the public. This brings up an important question about gatekeeping API access and the right way to deploy a potentially expensive service.
The plugin uses Firebase for user authentication and a database. It also needs access... |
I am trying to apply DDD to a Vue project (so it's DDD on the frontend) and I have a doubt as to where store a props type. A Vue component can have props, which is basically named data passed to the component. Most of my components that work as a page are stored inside the application folder, because they manage all th... |
I'm fairly new at system architecting and I'm looking for some advice. My company is revamping its order management system. Currently is a monolith system that scales very poorly and is difficult for various teams to work on at the same time. I am reworking this to be a microservice architecture. My initial team will b... |
My team has a mixture of specialties, there's some overlap however. When some commits are done from person A (who is expert in some domain) and person B (who is not expert in that domain) I wonder if it is appropriate to ask in depth questions about the code or is not a good practice or to what extent we should allow t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.