instruction stringlengths 34 36.1k |
|---|
I'm working on an application that will run on multiple systems and may use different modules to communicate with external systems, but on each system, only one module will be used at a time. As it should be possible to change the used module on a specific system, the same application with all modules should be deploye... |
Background
My task is to create new system (X) for realtime work tracking for internal use. You should think it like an app that you have opened on a separate monitor/ on phone all day and you are logging your work progress there. In fact, there is already a system (Y) that solves this and internally its working well, ... |
Got a desktop application that interacts with some stateful third party web APIs. Its an interactive application, at some stages it has to halt execution and prompt for user input based on responses from said APIs etc..
Application core structure is as follows:
Third Party API Service Class, my abstraction for handlin... |
I'm setting up the SVN repository for my hobby game project.
I have the main version of the game and a beta version. The game is already online with a few players.
The beta version is isolated from the main game and is used to test new features and changes which might break the main game.
For the beta version I would l... |
I watched a video series from Uncle Bob on Clean Code. He makes a few points on architecture which I both agree with but I believe could have clarification.
From Uncle Bob:
The Interactor is connected using Boundaries
Architecture should be fluid
Trust your team
My Understanding:
Use protocols (depending on language... |
Not entirely sure if this is the most appropriate community for this but...
I'm looking for solutions to calculate positions for menu options when the amount of options vary and when each options might vary in size (due to text wrapping).
Our current code runs a for loop with two variables, one for the total number of ... |
we've a python function that can be achieved in 2 ways
1st method
def complexity_1(x, y):
if 2 == x and 3 == y:
a=3
b=4
c = a + b
elif 2 == x and not 3 == y:
a = 3
b = 5
c = a + b
else:
c=5
return c
2nd method
def complexity_2(x, y):
if 2 == x... |
I am studying the programming language Kotlin, and I just came across the idea of a Data Class. I have a background in Java programming where classes can have fields and methods. I have heard programmers calling a class that contains only fields and no methods, as a Value Class. Also, I am familiar with the idea of... |
Suppose I have some code as such:
function1() {
function2()
}
function2() {
function3()
}
function3() {
function4()
}
function4() {
...
}
Do I have to write integration tests for function1(), function2() and function3()? Or do I only write integration tests for function1(), and unit tests for the other... |
Our team have been debating approaches to integrating external or third party systems when using DDD. The literature is extensive, but sometimes contradictory. Just like a UL helps us better understand and communicate about the domain, we wanted to do a better job of defining the different approaches, and when we might... |
I’m building a microservice which depends on a set of downstream services to collect the data necessary to operate. It is a data delivery system, I’m not source of truth for any data, my system rather aggregates data and serves it.
The downstream services are sending their data through kafka streams. Nevertheless some ... |
I’m struggling with how I should build out my entities, services, and DAOs in an MVC web application when it comes to returning a list (array) of data. On one hand, returning an array of entity objects keeps the code lean and easy to maintain, however, there's a performance hit for building and returning complex entit... |
I am developing a simple text-based game. In this game, the user is able to collect items and store them in an inventory.
My question is: how should I organize the internal structure of my game so that I can load these items in an efficient way?
I need to be able to create fresh instances of an item whenever the user a... |
Is there a statically typed programming language that implements Polymorphism without using a superclass or an interface (if such implementation is even possible)?
|
Not almost, but all modern CPUs have multiple cores, yet multithreading isn't really that common. Why to have these cores then? To execute several sequential programs at the same time? Well, when calculations are complex (rendering, compiling), the program is definitely made to use advantage of multiple cores. But for ... |
Into:
There are mutliple ways to test code: unit tests /e2e / manual testing /..
I'm developing a project that it's implementation details changes very quickly (and sometimes the core functions as well).
Some of our microservers talk to each other directly while some others communicate using events like kafka.
Problem:... |
I have this basic design with a circular dependency. Is there any solution for this? The problem is that a Machine cannot be created if a Model for that Team has been submitted.
|
Lets say i have a zoo class, with a bunch of collections. The collections are giraffes, elephants, tigers etc. All animal types derive from the same interface or base class, lets call it IAnimal.
So in my code i'm running in the same problem in 2 places. I end up in a method, that gets an IAnimal that its supposed to d... |
My Software contains a lib package, a cli package and an arbitrary number of plugin packages.
The plugin packages do the algorithmic work.
The lib package basically just executes the plugins and passes the result of each plugin to the next plugin and exposes the libs functionality to the cli package. The cli package re... |
I have two classes which contains almost same method. How can I refactor this with inheriting one class by other class.
class A{
public void run(){
// task 1
// task 2
// task 3
}
}
class B{
public void run(){
// task 1 <- same as in class A
// task 2 <- same as in class A
// tas... |
I'm considering creating a new tool, but I wanted to find out if something like it already exists.
tl;dr: Looking to make or employ a service which scans a SCM repository with the explicit goal of early warning when ongoing work might lead to "Conflict hell".
The Pain:
Working with many collaborators on a monorepo, con... |
When reading through internet, I've seen people are really into testing the front end applications. Some of them also say that they will never hire someone on front end who doesn't have testing experience.
I understand that testing is necessary when dealing with huge amount of computation, logic and intertwined modules... |
I'm searching an existing hash function or trying to make a hash function that has a lot of collisions.
Regularly a hash is used for it's ability to create unique hashes for hash tables or security purposes, but I desire the opposite.
I desire a hash function that has allot of collisions.
Preferably a simplistic hash f... |
I am writing a class -- let's call it MessageSender -- that needs to perform operations over the network. It basically does these things:
Take some configuration
establish a connection
send stuff
If we ignore the cleanup of any resources, this would look like this:
var sender = new MessageSender("127.0.0.1");
sender.... |
I used to work for a software development company, and there they had following way of solving bugs and the according testing:
The bug ticket is analysed by the developer.
The developer solves the bug.
The developer describes the testing procedure.
QA (Quality Assurance) automates the testing procedure and adds it in ... |
As in the topic. If yes - why, if no - why? I never seen it recommended in any android/web development tutorials to use vector graphics instead of your usual PNGs and JPGs and I find it odd.
I checked just now and eBay UK (as an example of a very popular and professionally made website) doesn't accept SVG images as ite... |
Is there a general term for the software paradigm/principle where there is a clear separation between Data, State and Logic (Data - 'information' only, immutable with value semantics, State - 'storage' of Data only with clearly defined access/mutation mechanisms, Logic - pure stateless functionality that can mutate the... |
I'm having a problem choosing the right approach to sharing some user related data throughout my microservices-based application.
Imagine the following scenario:
Users microservice handles creation of users, but also management of the hierarchy of those users. It has the information regarding which users have Manager r... |
I am an amateur developper and I deploy my (home oriented) code to containers. This is usually Python and JavaScript.
JavaScript, when saving dependencies for a further npm install, will pin the libraries to exact specific versions. It is also possible (and recommended) to do that in Python via requirements.txt.
This a... |
I am currently facing a dilemma in the design of a message oriented distributed system following an Event Carried State Transfer pattern. This is essentially a "near real time ETL" used to populate "caches" on autonomous subscriber systems. In other words, the following principles apply:
Systems are partitioned by bus... |
I'm currently developing a personal project using Django REST + React and as it grows more complex, I want to add unit testing to ensure that changes don't affect previous functionality. However, I'm not sure exactly what to test for. Should I simply test the responses from the API endpoints, should I try random input ... |
When developing a new section of code functionality with modules I'm not familiar, I'll often create a set of unit tests that are for "tinkering" and interactively analyzing the results in the debugger.
These tests are not good "unit tests" because they often will not be reproducible without some setup from another hum... |
I have two sites, one is a subdomain of the other. They both do different things entirely with one unifying goal.
My intent is to have the main site do a majority of the heavy lifting, and the subdomain site to authenticate a very specific function. The issue I run into is with users on the main site being able to acce... |
I've been using a "pattern" to configure C++ class instances via lambdas for a while now and I am looking for:
an original source & name (I think I read this somewhere, but can't find any online resource unfortunately)
pitfalls when using the pattern and whether there are means of solving them (I hope this question is... |
For teaching purposes, I am trying to create a "something useful" example of Flyweight pattern using PHP.
My idea was load some "intrinsic" data from a csv (link) to a pool and allow the user to create "cars" (extrinsic) sharing, if possible, the same flyweight data (car model)
To optimize the memory, I thought that a ... |
I am currently reviewing a PR where we want to enable a feature based on some suscription date of a user such as:
let featureEnabled = false
if (user.createdAt > MONETIZATION_DATE) {
featureEnabled = true
}
You get the idea. When reviewing changes like this, I usually suggest to make it not dependent on a date but o... |
We have a classic wpf line of business software at work. Put in a lot of data, save it, calculate some things, put out some useful data etc.
Visually we have a dockable pane setup, like visual studio or any modern software.
So of the top of my head, to create a new pane where you have simple data entry for a couple of ... |
I have not worked with EF for a while.
As an exercise, I am writing a core web api that allows keeping track of a user medias.
A media can be a postcard, a photo album, a recording, a book...
I would like to know what is the way to go/best practice in writing the Add (createMedia) method:
[HttpPost]
public async Task<A... |
If an Agile team has members, such as developers, from different geographical regions, how can the daily scrum meeting happen? Obviously, they have to work in different time zones.
Do you think the daily scrum meeting can be replaced by sending status emails at the end of day? Is that even called Agile or we are invent... |
Given a scenario where you have consecutive setters or a series of events where an object is modified, can it be more performant to instead write code in a way where a new state is returned rather than a field within an object modified due to how a compiler will interpret the code?
e.g
obj0 = new_object()
obj1 = modify... |
I am writing a simple custom (special purpose) container and would like to allow for iteration over each element, however, avoid using iterators due to the problem of iterator invalidation.
Instead of providing a pair of iterators (via begin() and end()) I was thinking to provide a for_each method that iterates over th... |
I am not sure why an interface in Java is called an "interface", but I think it can be one of the following two reasons (or both):
Reason one:
This tutorial says the following:
Methods form the object's interface with the outside world
Based on the above quote, I think that the reason why the interface in Java is cal... |
For an application that I currently plan to scale up, there's a bunch of JSON dicts and directories making up the "database". The reason I didn't use SQL initially, is simply because I've never learned the language, and right now I'm forcing myself to.
The application has a constantly updated data structure (I'd not re... |
Sometimes I get to review a bunch of files that have been moved and modified. In GitHub I cannot find a way to see what has been modified. Everything looks like a new file. It makes review harder because I am probably reviewing something that has already been reviewed.
What is a proper way to handle such changes on req... |
I am working on an anonymous survey module in ERP-system and I am thinking if there is a common approach to implement such systems to make them "truly" (I do understand that there still will be an attack to collate results with users with some degree of certainty) anonymous while preventing users from voting multiple t... |
The current system I am working on uses google tests for unit tests and pytest for system tests.
Are google tests appropriate only for unit tests? Or can you write system tests with it?
(or are pytest for system tests?)
|
I have an abstract class called ProjectItem and I have 2 specific classes. One of them is called Task and the other is called Deliverable.
I have to put all the ProjectItems inside a list, which I did, and I also need to put all the ProjectItems that are Deliverable inside another list.
My approach is to, so to say, de... |
The current structure of my app is as follows:
One activity and multiple fragments (about 25 fragments)
One huge monolithic repository
One huge monolithic viewmodel
Databinding is being used but with one huge monolithic handler class
Navigation Component with one nav graph for the entire application
I've been learnin... |
I saw this pattern in multiple projects I wrote: I create an SQL model for a certain type of entities and at some point, we realize that there's a need to store multiples types of the same entities. Usually I introduce a "status" column to the table, because the type is mutually exclusive. For example, person can be "d... |
I've made a simple Tic-Tac-Toe game in Common Lisp using the Ltk library.
One of the things I wanted to do was to support CPU vs CPU, human vs human, human vs CPU, and CPU vs human. Also, possibly multiple types of CPU algorithms. The ideal way to do this (for me at least) is to have a scheduler that gives control to P... |
I've a list of items in my ElasticSearch.
User enters a query and I fetch the results from elastic search. Now, I've a requirement where I don't want to show the user the items which he has already visited. The items which user has already visited is stored in mongodb.
id, user_id, item_id
I choose this MongoDB schema ... |
I'm working as an intern at a fund. I spent the last month building a website for internal use, and now I think it's a good time to set up a backup scheme for the MySQL database at its backend. Funny enough, my mentor is reluctant to get me another server because we are not allowed to use external IaaS like AWS and Dig... |
I have a RestAPI with two endpoints:
/items - list of items
/items/2 - selected by id, an item details
returned json for list of items is
{ "id": "1", "name": "Max" }
returned json for item details
{ "id": "1", "name": "Max", "age": 30 }
What are pro & cons (from client perspective) for mapping the data to:
two differ... |
User Pain is an established concept to prioritize bugs in a consistent way that is stable over time by calculating a single score based on a small number of criteria.
https://lostgarden.home.blog/2008/05/20/improving-bug-triage-with-user-pain/
https://blogs.unity3d.com/2016/08/17/a-look-inside-tracking-bugs-by-user-pa... |
Premise:
Language/Framework: C# / .NET + Core
I provide a desktop, multi-platform client-server API for HW control related purposes. The "Server" is communicating with multiple HW components. The "Client" is used to develop desktop applications that can communicate with the HW, using the "Server" as a proxy and for syn... |
I am basically plagiarizing When NOT to use virtual destructors?. The excellent answers remind us that C++ is pay only for what you use.
However, the Standard is a couple of thousand pages long. The d-tor of a class containg at least one virtual method is implicitly virtual. wouldn't have loaded it too much.
Why do we ... |
Clean Architecture defines level as a distance from inputs and outputs. So Entities or business-objects are the highest level.
What is a practical reason to make lower level dependent on higher level?
To me it looks like the frequency of change must determine the direction of a dependency. And it is not guaranteed that... |
I've got a web application with an architecture somewhat like a front-controller MVC design. I get HTTP requests, route them, run them through a filter layer, dispatch them to my domain classes which then when necessary access an intelligent data service through data layer classes. The domain classes then return a st... |
Let's say, for example, that I have a function makeFoo that makes another function foo:
function makeFoo(string) {
return () => string
}
const foo = makeFoo('bar');
I know that makeFoo is a higher-order function because it returns a function, but is makeFoo the best name? Would something like createFoo or fooFact... |
In Hackers and Painters, Paul Graham talks about how he "sketches" as he programs:
For example, I was taught in college that one ought to figure out a program completely on paper before even going near a computer. I found that I did not program this way. I found that I liked to program sitting in front of a computer, ... |
I would like to understand why sofware developers tends to use a meta licence manager than a software dedicated licence.
Is it a question of security or for "customer experience"?
Thx for help
|
I am maintaining a system where a list of string ids are stored against a container (using the term here as a generic entity) object. The database used is MySQL and the table structure looks like this.
|---------------------|------------------|
| CONTAINER_NAME | ID |
|---------------------|---------... |
So the architecture I am currently working with, we have an api-gateway that gets all the requests and publishes them to our Eventsystem/ or directly to our essential services(auth, etc). Now we want to add a Socketbased Microservice that consumes some of our topics and processes them for client consumption.
But the qu... |
I doubted to post this question to the general StackOverflow, but it is suggested to not post opinion-based questions and this might be one. And ofcourse, this is the software engineering department. Microsoft Docs only describes the how, not the why.
When should one use a:
property with a { get .... ; } and a backing... |
i have a graph and transactions which change the relationship between the graph nodes and i need to keep tracking of this changes over time. Kinde of queries i need to execute:
I want to see the graph version before the transaction X
I want to see the latest version of the graph.
-The graph nodes have name and id
-... |
I want to make a httpClient wrapper that is able to use a predefined set of authentification methods: basic, digest, token (oauth), ntlm just to name a few that I will have to implement.
My approach to this was inspired by the Apache implementation of Authentication Schemes in java, which is creating an Auth class, and... |
I'm looking to make a clean modular architecture. I hear all around how bad are circular dependencies, and I'm convinced that the less two modules are coupled, the most reusable the code will be.
But I want to handle edge cases where moduleA depends on moduleB and vice-versa.
Generally speaking, an architecture like th... |
I'm making my own client-side router which dynamically requests html pages from Firebase hosting, and the website uses Cloud Firestore with secure rules. Is there any XSS HTML event js injection danger like so:
<button onClick = "alert('Some harmful stuff is happening')">Click me!</button>
If I implement a client-side ... |
I'm building a microservices architecture that requires microservices to communicate with each other. Searching Google has led me to believe that gRPC is the preferred method for achieving this. However, all the tutorials seem to hard-code RPC server addresses, which seems antithetical to the microservices architecture... |
We have structured our application with typical layers. UI, Database access, services, Helpers etc.
However, at the very top we have a project called "Interfaces" which contains the interface for pretty much every relevant class in the project. This leads to everything being available in every project.
Simplified it lo... |
For example, in Vietnamese, there are Unicode characters like "â", "ê", "ô", "ư", v.v. To type them from keyboard, I need to type aa, ee, oo, w, then a program will convert them to correct characters. What is the name of that kind of program?
My purpose is to study how vulnerable that kind of software is.
|
Consider the product class:
class Car {
private String color;
private String model_num;
//getters and setters for the above fields
}
Consider builder class 1:
class CarBuilder1 {
private Car car;
//setters for color, model_num
//build() method returning car obj
}
Now, consider builder class 2:
class... |
I have learned file memory management and some very simple CPU assembly for manual memory manipulation. Still, I feel like there is a gap in my knowledge when it comes to modern, complex computers, OSs, and compilers. What I am wondering is what goes into the decision process to allocate a set amount of memory for diff... |
I am developing a microservice architecture where the API publishes a message through RabbitMQ. One or more consumers will read the message, preform its functions then if successful acknowledge the message. These functions can take many seconds and is not preformed by the API Gateway and is instead "ran in the backgrou... |
Goal: write code to express SQL queries in C# that get converted to SQL at the data layer level and will be compatible with any common data layer / ORM such as Dapper or Entity Framework (EF).
Edit:
And, ability to dynamically build queries at runtime
Justification: decouple the querying aspect of the data infrastructu... |
I've been wondering about what is a perfect use case for CQRS where the benefits overcome the complexity and the cost with come with the package. So for me to better understand it, I want to share with you a theoretical use case and we can see together whether it's a good CQRS fit or not, and if not what alternatives w... |
What's the point of ever using const?
It is more restrictive than static readonly:
across assemblies, changes to a constin a dependency won't be reflected in its consumers
you can only use const for certain primitive types
with both these restrictions in mind, perhaps among others I am not aware of, why ever use con... |
I have server A that received millions of requests per day and for every request it notifies server B about it.
sometimes server B is down (maintenance, bugs etc..) so requests from server A got lost.
(both servers are written in nodejs)
I thought to add a queue (Kafka/RabbitMQ) in server A so every time a request fail... |
When working with some complex algorithms, I would like to have a way to keep track of some information for easy debugging. I just need to see sometimes how things are going, and have some easy way to extract data so I don't have to spend time through a debugger trying to get the same data.
So far, I've been printing s... |
If we look at the typical software architecture guide, it will have the domain layer, application services, and UI, where domain layer contains the business logic.
This is a nice clean separation until we run into a case where putting "business" logic on the client-side makes a lot of practical sense.
For example, let'... |
I am developing a website that is supposed to be in at least two languages. I am a skilled developer, but I never had to deal with internationalization.
The owner of the site will create a new article in a language (say English) and link it to a category. Then, a translator will translate that article into another lang... |
I'm currently developing a server where I find myself asking whether something such as:
logger.info("Starting <action_1>.")
action_1()
logger.info("Ending <action_1>.")
logger.info("Starting <action_2>.")
action_2()
logger.info("Ending <action_2>.
vs.
logger.info("Starting <action_1>.")
action_1()
logger.info("Start... |
I am designing architecture for service like pastebin.com. I plan to store user data on S3 storage and metadata with my own server. So whenever a user requests for some paste creation there are two steps to this:
Store content in S3
Store metadata with local metadata db.
I am thinking what would happen if step 1 succ... |
I always had problems in grasping the full benefits/motif behind using the Factory design pattern (for this post, I will stick to Factory Method pattern, specifically). True, there are (really) lots of posts over the internet on the topic. But I always had a hard time summarizing the pattern to the problem it comes to ... |
Some design thoughts on an application that is mostly event driven using kubernetes and docker.
The application is a web based application, a single page one. It shows updates from the back-end such as showing current stock of an item in the inventory. It is pretty real-time, in the sense if an item was sold, it stock ... |
Consider a desktop application that interacts with a web API, for which it needs a key. How should API keys be handled? Configuration files come to mind, however it doesn't seem that simple when terms of use of APIs are factored in.
Specifically, the following two examples of APIs:
ISBN Database
https://isbndb.com/isb... |
When a deployment diagram shows an artifact deployed on a node (with either the deploy dependency arrow or one of the alternative way to draw the relationship).
Does it mean that the artifact exists on the node (such as in the file system of a computer)?
Or, does it mean that the node is executing the artifact (such a... |
I want to make diagrams that explain how Inheritance and Polymorphism work conceptually.
Assume that we have a Cat class that inherits from the Animal class. The way that I can think of a Cat object is that it is an object that contains a copy of the members of the Cat class and also it have an Animal object inside of ... |
I had go through Jason Taylor's link. He mentioned that
The Domain layer contains enterprise logic and types and the Application layer contains business logic and types. The difference is that enterprise logic could be shared across many systems, whereas the business logic will typically only be used within this syste... |
I've often found myself with the need to develop tools that process large files over a network and perform an operation to every element in that file. An element may be an individual line or an object that is parsed out based on its structure (XML, JSON, binary format). A key feature of these tools is what I often call... |
I'm trying to learn how to implement a DAO design pattern (for a game, but this does not really matter). In my program, I have a database layer which has user objects. Then in the code, I have a DAO class DAO_USER which reads and writes to the database.
Once it reads from the database, it creates class instances of the... |
I don't understand why we hash data like passwords. I know it's harder to steal hashed data rather than just plain text, and it takes longer, but once one of those public hashing methods gets cracked, lots of that data's gonna be stolen. And by the time there's another method, you're gonna have (possibly) things like a... |
Currently we need manage lots of development tools' configuration, like ESLint and Jest. One way is to store their configuration in package.json. Another way is store this configuration in their special config file, like jest.config.js.
Which way do you prefer? How you do these in your project? I think the separate way... |
Background
I'm working through creating a structure for Items in a new ERP (Cloudsuite Industrial) that I'm implementing. For Items (which can be finished goods/products or raw materials), we currently have a three level hierarchical system of organization. I'm trying to determine the best/standard practice for mapping... |
I already know of various software design patterns, and I am familiar with MVC.
However, now that I am learning about other patterns (repository, client-server, pipe, and layered), I got a bit confused about the implementation of these patterns.
Can there be a combination of patterns in a single software system? If so,... |
I'm looking for feedback for a design pattern that aims to remove all side-effects from business logic. I'm using PHP but the pattern can be applied to any OOP language. The point is to enforce pure business logic from the framework, by not injecting any dependencies that have side-effects, e.g. database connections, c... |
In Jeffrey Palermo's article about Onion Architecture, he claims the following:
The first layer around the Domain Model is typically where we would find interfaces that provide object saving and retrieving behavior, called repository interfaces. The object saving behavior is not in the application core, however, becau... |
I am reading the architecture guide from the .net core project. They state:
The integration events can be defined at the application level of each microservice, so they are decoupled from other microservices, in a way comparable to how ViewModels are defined in the server and client. What is not recommended is sharing... |
C++ only supports single dynamic dispatch methods. Indeed, the following program:
#include <iostream>
struct Shape {
virtual void overlap(Shape* y) { std::cout << "Shape, Shape\n"; }
};
struct Circle: Shape {
void overlap(Shape* y) { std::cout << "Circle, Shape\n"; }
void overlap(Circle* y) { std::cout << "Circ... |
I've built a Python script that consists of about 20 functions that extract data from MySQL via .sql files (I'm currently trying to learn SQLAlchemy ORM), do something to it and then put it back in MySQL. The process involves changing the same data multiple times so future steps rely on previous steps.
I've built a uni... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.