instruction
stringlengths
34
36.1k
I have a use case for which a user can perform a multiselection. I am writing the use case description and wonder: Should the selection action be documented as a trigger of the use case, or in the main success scenario? Below are the variants I am considering. I think the last one is probably best, but I'm not sure if ...
It often happens that we have a set of structured data. Let's say our data is about charitable organizations. I could turn it into a list/set of objects/structs: struct Charity { let name: String let yearFounded: Int let volunteerCount: Int } I could also think about it as a table (possibly using the Python P...
I'm working on implementing a language server and corresponding Visual Studio Code extension for a small scripting language. The language server is implemented in Rust, so I can generate binaries that the VS Code extension can execute to support several editor features. I am trying to decide how to handle distributing ...
I'm in a scenario where, when a certain command is applied on an aggregate, I have to change the state of the aggregate itself if ALL related aggregates are in the same state, then notify the world outside here is an example (in pseudocode) finishRace(raceId, carId) cars = repository.findCarsByRaceId(raceId) ...
I want to warn devs in my team to rebuild the docker containers after installing or updating npm packages. This is because whenever we edit packages in the environment the only way we've found to test them is to clean the entire build and rebuild everything to re-install everything the way it would be installed in the ...
I'm modeling a general RPG-game-style quest system where player choices lead to certain effects. The below examples have been simplified for the sake of clarity. This is a web-based context, which I suspect is relevant for the question at hand. In short: How do I inject dependencies into a wide variety of implementatio...
I am building a REST Api from scratch so i am overthinking and revisiting various approaches and best practices. I have a Materials repository that serve all the sub-domains of our logic. Also i have a Sales and Inventory sub domains that both relate to the Materials. I found this question that evolves exactly around w...
Say I wanted to build my own CMS system and store data in MongoDB. I would like to have a Collection called BlogArticle. Each article can have a different structure, but will be put together by the same building blocks. So for example, Blog Article No. 1 might look like this: 1. Title: "2 Great Videos of Cats" 2. Video...
If a function is being used to process incoming results, I believe an SRP violation exists if it contains all the logic: def process_response(response): '''Process the results of the web request''' # logic to parse response # logic to format response # logic to write response This function is doing a lot,...
thinking about the design of an IoT project where the devices don't have a standard application layer but rather a thin custom application layer utilizing TCP sockets. What I mean by this is that the device wakes up every 15 minutes or so opens a socket on the server and sends data in, waits for any incoming data and ...
I'm currently studying dependency injection and I'm having some issues with the so called 'flexibility' advantage of using dependency injection. The flexibility advantage is mentioned in post Criticism and disadvantages of dependency injection, where it is mentioned that dependency injection enables "switching implemen...
I wanted to implement a method insertCard in Python which interacts with only a specific type of object called a Card. The Card should always have a cardId and may have additional payload or fields that the user can specify. In Java, I would do: class Card { int cardId; } class PlayingCard extends Card { int c...
I have a C++ class (Class D) that is a decorator of another class (Class B). Class D inherits from B and also requires an instance of B to construct that it keeps track of. Class D overrides all methods in B and instead calls the same functions on it's own instance of B. My worry is in maintaining this. If someone edit...
So I have a design/architectural question. I want to develop a pattern in a programming language that is able to allow a app command-line shell to send commands to a running application to create objects that a developer maybe working on while the application is running. For example: CLI> createObjCmd someClass arg1 ar...
I'm developing an application that will show some weather information based on the user's location. Since the weather forecast is just a very small feature of the app that complements the main ones, I do not want to spend too much money on the 3rd party weather API which charges per per API call The app will make a req...
I have some code where I believe the SLA (single level of abstraction) principle is broken in a way that the low-level code (if-statements) is outside and the high level code is nested inside the cases. A simplified version of the code is: public void GenerateReport(int effort, bool delayed) { if (effort < 5) {...
I'm the only software engineer for a small company and I want to make my deployment process more robust because I can't work away from my dedicated workstation with my current process. I only make proprietary, internal software for Windows that is used by employees using Visual Studio. My current process is: Code Test...
Consider this simple example: We have the apartments table below: ID Address 0 555 Maple St 1 123 Oak St 2 999 Pine St We also have the tenants table below: ID Name 0 Bob Foo 1 Jane Bar If I want to map tenants to apartments (assuming that one tenant could rent multiple apartments for this...
I've worked on a few codebases without a great automated test suite, where changes that concern the whole platform have to be thoroughly tested by developers and there would be a high risk that a degradation is introduced with each release. How do you prevent this from happening? The less than perfect answers from my e...
Companies spend a lot of money on tooling for on-prem. But then they often want to move to the cloud for its obvious benefits, but feel limited in their ability to do so since they already invested so much in on-prem tooling. Can companies use already-purchased on-prem tooling in the cloud if they want to move to the c...
So I am developing my own DBMS as a resume project, but I am so deep now on this that I am even considering in the future to release it as an open source project and receive feedback from the community. My DBMS has to be customizable, and with that I mean that you can literally write your own code to change features o...
I am looking for advice on database design for a web app I am building. Part of the website needs to display content from a SQL database dynamically depending on the component's context. To be more specific, I need the component to display a subset of columns from the item_info table, depending on the value in another ...
I've been reading quite a lot on the concept of Inversion of Control (IoC) and Dependency Injection (DI), and I've seen that DI often relies on an IoC container, which among other roles has to Register: The container must know which dependency to instantiate when it encounters a particular type. This process is called ...
In our application (ASP.NET core) we have events that require computations and which results need to be persisted in a database (the objects are projects that need recalculations when a property changes, and then the financial results need to stored). These actions need to take place asynchronously in the background. ...
I am currently working solo on a very small simple python microservice. I started building this app, mostly by habit, in a virtual environment. As I started to get closer to the point where deployment considerations needed to be made, I started to realize that all of the dependencies I'd need to include in the containe...
A few hours ago I turned in my entrance exam, and i am very curious about this last problem. Given a cluster of stars each x, y, z range between -1000 to 1000. No four stars are coplanar. Find the minimum volume of a cylinder that covers all stars, the cylinder can be in any direction. At least 1 base of the cylinder ...
Assume a Person has a Phone and a Phone has Contacts. Assume in the real world the Contacts of a Phone are sorted by their first name. When I phone.add(Contact c), the phone sorts its contacts. Then this contact has its first name changed. How can phone know about it and sort its contacts? public class Phone { List...
I am looking for advice on database design for a web app I am building. In the web app (Angular, REST API, Oracle SQL database), I am constructing a web form dynamically. I chose dynamic form construction, because I will need to display many similar, but different forms (around 30), and the questions asked on the form ...
I've been working in a rather large codebase filled to the brim with small classes such as class Person { public string name; public int age; public int height; } As a mainly front-end experience developer I'm finding a hard way to determine the best practice when returning multiple values from methods. Fo...
I am implementing anonymous functions (lambdas) in a scripting language that supports hot reloading. The language currently supports passing user defined functions (pointers) to plugin functions which can store the function pointers to be called later (event handlers). With lambda support I can dynamically create the ...
I've come across some apparently-conflicting patterns of behaviour. I'd like to understand why they each exist. I'll call them "conventions" for the sake of simplicity, though I'm not sure the term is a great fit for all of them. Convention 1: we do not commit generated artefacts (especially binaries) to source contr...
I develop my current project with a very strict approach to TDD and try to make it as close to Kent Beck's TDD By Example book. So right now I've got code coverage of 93%, with 1290 unit test cases, 58 integration tests, and 25 UI tests. However, the tests durations on the CI are too long IMHO: Unit tests: 15 minutes ...
I recently wrote a small PowerShell script to clean a Visual Studio solution. It's used by a small team of 5 persons on a regular basis. I built it in PowershellISE (GUI client) and it works great, but some time later I ran it from Cmd and then after completion I was to my big surprise not in the same directory as prev...
Consider the following GUI screen: When user selects a person from PersonListView, EditPersonView should show person's first name and last name and allow the user edit. So, I end up with the following UML class Diagram where each Java package represents the layer of the class. My question is in SelectedPerson and if ...
I am in the process of carrying out a software architecture for my client, in fact THE HISTORY OF THE REQUIREMENT : MY PARTNER SEND cvs files via MFT to MY CLIENT , many times a day . MY CLIENT has a listener ( cron job in linux and batch ) , when a file is received in a folder , the client consumes it and store it in ...
There's a question that struggles me for a long time already and so far I couldn't find or figure out a good answer. Hopefully, you will help me with that, folks. Before the story, a little background: in test automation, there's one very popular pattern called Page Object Model. Briefly speaking, it's about mapping al...
I've been suggested an authorization flow between three parties that seems not secure to me, and I would like to know if I'm assuming correctly. Let's say Party A has many customers (one of them let's call it Customer X) with data in Party A. Party A is allowing Customer X to get data from their API. In order to do tha...
My company uses Major.Minor.Patch.Build for our version numbers. When a new release is started, the Major.Minor.Patch part is set. Then as work is done, the build number goes up until a build is deemed good enough. When that happens, then that Major.Minor.Patch.Build is released to Testing. If it passes Testing, th...
I'd need some feedback on how to approach the design of a function that highlights parts of a time series chart. The chart shows the response time of an application, in particular the 90th percentile, over time. Each bar on the chart is one minute. I want to see anomalies, determined based on thresholds I define. I exp...
I'm working on a application which uses event-sourcing and CQRS to define it's domain model. Background We have implemented projections to aggregate stream of all domain events into a read models used by the application. But I think our current implementation is quirky and finicky as we tinker with it frequently. So I ...
Our company is an aggregator of multiple payment services fragmented on the web. So instead of businesses integrating multiple services one by one, they will only need to integrate to our API, and we will connect to every one of the products for them. We connect by writing individual scripts for every one of these serv...
To my understanding, C does not have the concept of objects, then how can Python be implemented in C to support something that C can not? How is the concept of "Object" modeled in C? What is internally used? Edit : Reading through the comments, I am interested in this specific implementation of Python which "uses" C to...
I have an existing microservice that talks to a Natural Language Processing (NLP) product and fetches around 50 fields. I need to create domain objects in Java now from these fields. I read about builder pattern and read Effective Java. I understand builder pattern and using fluent approach is a good way to build objec...
If an I/O device is reading the main memory (directly) then is it possible for the CPU to access the cache? I think it's possible for the CPU to access the cache in case of a hit. But in case of a miss there could be two scenarios. Either the CPU pauses the DMA and fetches blocks from the main memory (haven't heard of...
I have an entity that contain the status of data (WaitingForData, ReadyForData, DataUsed). class Batch { int Status { get; } DateTime StartTime { get; } string Code { get; } void SetCode(string code) { Code=code; if (StartTime not null) { Status = ReadyForData; } } void SetDat...
Imagine a "clean architecture" in which you have two use cases. One of them is CreateCustomerHandler, and the other SignUpCustomerByGoogleAuthHandler. So, the SignUpCustomerByGoogleAuthHandler has to reuse the CreateCustomerHandler to eventually create a Customer. Is it legit to inject CreateCustomerHandler to SignUpC...
I'm trying to delineate the responsibilities between client & server. I have the server parse a file, and then send back the uncategorized accounting transactions. The URL looks something like: POST /api/accounts/:account_id/transaction_file // used for the upload GET /api/accounts/:account_id/uncategorized // gets al...
I have a web application that has a lot of multi-action items that are done that require an email notification. Although not the biggest deal, we currently have it set so that it sends an email to the other user when things like a comment or a "status" has changed. Let's say our one user adds a comment and then changes...
I am part of a project/team that is building a new web app in Azure for the first time, having previously built and developed a traditional three tier ASP.NET web app over a number of years. We have an external architect/consultant helping with the transition to Azure, and they are proposing an architecture that is pro...
I'm trying to get a good understanding as to whether there is a best practice or standard regarding keeping values within your code libraries or referencing them from another config file. I don't have a formal background in computer science so apologies if I'm not using appropriate language here. It's probably best f...
I struggle to understand Roy Fielding’s REST alternative to HTTP cookies, § 6.3.4.2 ‘Cookies’ and § 6.5.4.1 ‘Application State in a Network-Based System’ of his doctoral dissertation Architectural Styles and the Design of Network-Based Software Architectures. How do you interpret it? 6.3.4.2 Cookies An example of wher...
I am reading a lot about patterns and code structure and something that bothers me is BeanValidation's way to handle errors. I like Java and think that BeanValidation is easy to use, but it seems to me that using BeanValidation is kind of an anti pattern. In one project I have just the normal BeanValidation which I cat...
We host a dashboard where users can view different reports, each powered by a templated SQL query. The users have an option to "download" those reports as CSV. Currently the above use case is handled in the following steps, User views a report and she clicks on download. The browser makes an API call, and on the serve...
I have a server running on AWS which serves data, that is not changing too often (think about a CMS system) to multiple clients. This service is critical for most of the client apps, thus I want to take some load off of it. I wanted to introduce another service between the clients and the server with a (Redis) cache wi...
We have an existing project that has grown very messy and confusing; our classes are huge and difficult to read. Our boss wants us to break all of our methods out of the classes and into separate files (for maintainability), so that it would be something like this. class Foo { public function bar() { i...
I need to synchronize tables of data between two different systems. This is a multi-master setup; data can get changed in either system. After a synchronization runs I'd like the data in each table to be the same. I'm having a tough time coming up with an algorithm for sending only incremental changes from one system t...
I’m pretty sure I’ve made some wrong assumptions in my questions so bear that in mind. At some point, the methods inside objects that are part of the persistence layer will be called/accessed for say… retrieve some data from the persistence mechanism ( DB, noSQL, txt file, external API etc… ), where this calling is goi...
The motto of the upcoming question is "I don't know what I don't know". I would like to know if there are downsides or security risks with an authentication implementation. Right now, I'm storing a JWT in an HTTP only cookie to send it from the client (React application) to the server (Spring Boot/Kotlin application). ...
First of all, I had task 1 and it was about rest API, requesting calls using httpclient in order to use the functions of an API. We get an input from a user, either "Online" or "Offline". If it is an "Online", we request calls such as generating tokens, and we display the result on GUI using javafx or swing. If the inp...
So, I'm binding an InMemoryCachedCarRepositoryDecorator to an ICarRepository, and obviously I should bind it as a singleton, because otherwise it wouldn't work (as intended). So this got me thinking: Shouldn't the implementation dictate the scope of the binding? (It doesn't seem like major DI frameworks support this, a...
I'm receiving a lot of a data entries from different (IOT) devices. I need to temporarily and persistently store this data until it is polled by the matching clients, after which it will be deleted. The data looks something like the following: id=1 device=1 key1=value1 key2=value2 id=2 device=1 ... id=3 device=2 ... id...
I have two classes for making pyqt5 windows. Inside class one I have a button with a function it is connected to. Class One: from PyQt5 import QtGui, QtWidgets, QtCore from PyQt5.QtWidgets import QApplication, QMainWindow class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__(...
Lets think about the most common Aggregate Root example: Order and OrderItems (or OrderLines). So I want a useCase called UpdateOrderItem. Given a OrderItemID and a complete OrderItemDTO in the request I want to update the OrderItem info. Following the Aggregate root pattern, OrderItems should not be handled alone. So ...
Hello everyone)) I am working on the react application, where mobx is being used for the state management. Some time ago I have added such class: class EventLogStore { private _eventLogRecord: IEventLogRecord[]; get eventLogRecords(): IEventLogRecord { return this._eventLogRecords; } a...
This is regarding designing a search api. We have 3 tier architecture now using Spring MVC. All communications are via REST api. UI <-> Business <-> Data(sql). Now to implement faster search, we are planning to index data from sql. So any write to data-layer, will be indexed in es as well. BL (writes)-> DL(writes)->El...
In a recent 1 on 1 w/ my team’s product owner, we had a disagreement about how much work should be done on a project or feature before presenting it to the team. The PO is used to creating specs up front as the starting point and presenting that to the team. Furthermore, he feels as though external (at least in our org...
I made WPF application for a client-side and hosting database in a server side , I know there is something called REST API to transfer data between a client and server I don't know this method and also i don't have a time to learn it because the project should finish less than one month, I am thinking to make client a...
Well I am newly graduated and placed in a small scale project based company. When I joined , the boss (project head) gave me project code for understanding what work I will be doing hence forth. I got stunned by looking at the code because it's hefty more than 10 thousands lines divided in between multiple functions ...
We have ServiceA with these endpoints defined: /devices: get: queryParameters: make: type: string repeat: false required: false model: type: string repeat: false required: false responses: 200: body: schema: Devices ...
I am developing a new desktop application from scratch using C#, before opening the visual studio and start typing in the keyboard I want to prepare a solid design for my software. The main challenge for me is how to handle errors and exceptions. I know that .Net Framework provide a good error handling but in addition ...
Let's say I have objects that have relationship references. These relationships could be parent-child, siblings, actor-reactor, publisher-subscriber, etc. but I don't want to restrict the relationships to any particular type of relationship. I want to allow the user of the framework to provide any number of relationshi...
I'm facing the following issue: I have a very simple aggregate root Product, and a product contains Image entities. Right now in code this relationship is expressed as a Many to One relationship like this: class Product: Image[] images; Now it happens that I need to make that relationship a Many to Many relationsh...
When is it more appropriate to use asynchronous calls from the view to get data vs prepopulating it server-side when creating the instance of the viewmodel? For instance, if my view has some dropdown menus that need to be loaded with values for the user. When might it be better to add List to the viewmodel vs making a...
Is there a feasible way of testing SQL queries that contain things like CURRENT_DATE and NOW() in a unit test? For example: public function deletePastEntries(): bool { $sql = "DELETE FROM queue WHERE period_end < NOW();"; return $this->db->query($sql)->execute(); } And in my unit test: class QueueTest extends ...
I'm creating an application which's architecture is based on Uncle Bob's Clean Architecture concepts and DDD. Note that it is BASED on DDD, so I gave myself the freedom to differ from strict DDD. To create this application, I am using C# with .Net Standard 2.0 One of the principles of DDD relates to Value Objects. The ...
With OOP what is the recommended way to pass an instance of a class which is restricted - such as read-only properties or less methods available. Below is a Vector2, which contains multiple methods for manipulating it's properties such as the setters or the add function. class Vector2 { private _x: number = 0; priv...
I am taking a software engineering course and got an understanding of basic concepts used in designing solutions for businesses. We come up with requirements, do use cases and user scenarios and it all makes sense in the business context. However, I am more interested in video game design and I am wondering what sort o...
Let's say we have a registration system that finalises the creation of an account by SMSing the user their new account details. This system could be used by people all around the world, so let's say we're using an online API that can send SMSs internationally regardless of the recipient's carrier. Because we want to ma...
I have a system that interacts with a REST API as the data source. This system is based on DDD and all of my current models are CRUD models. There is one model that the REST API is only able to query as a full aggregate, but only able to write as entities within that aggregate. The reasoning behind this API design is t...
I am working on a USB stack in C. This stack will be open source and used in various different projects. Various configuration options are available, which enable or disable large chunks of code and constant data structures. As this is an embedded project it is important to minimize the footprint of the stack, and one ...
I would like to use DRY beans on my client-server application (DRY: Dont Repeat Yourself). It is not a problem to me if it is highly coupled: I know that my DTO will have the same form as the database beans (Entity class in JPA). The DTO have the advantage to loose coupling between application, but if they are copied ...
Background I designed a social-media application (such as Facebook) where there is this strong concept of audience-based content system. For example, let's say this user A can create posts (public, private or groups only), based on that configuration, the post will only be available to that audience. Solution What I di...
I'm managing a team in .net. They are writing unit tests, use them locally on a regular basis, and love it. However, they keep pushing to have the unit tests kept as a separate project and only want to run them on a communal build server once a week or so. In contrast, our JS teams are running tests on the build server...
Imagine that you are developing a front end client that will consume an API. You're working on the login page and want to display errors to users below each field, in this case you want password related errors below the password field. You submit your login information to the endpoint, the password is incorrect, and th...
I found some java source code under MIT license on Github, but it is not included in any maven repository. I asked in issue to publish it somewhere, but nobody answered and looks like this repo is not supported actively (contrubutors may not answer for few months). Can I publish this project to maven repo by myself wit...
In my team, the Business Analysis is also a scrum team member. He will prepare all user stories to the Product backlog, but his tasks also should be managed with timeline/estimation. Should we put those preparation tasks into the Sprint backlog together with development stories, or should we have a different way of tr...
I would like to sort a list of people into buckets, as duplicates, by an email comparison, but I can't seem to find an efficient way. Specifications A person has 5 email fields, so in order to know if one person is a duplicate of the latter, I must compare each of his emails to each of of the latter's. A might be dupl...
Is a microservices architecture a good approach for developing a survey application with the following features: survey creation online or offline data collecting Reporting
I've been reading a few go blogs and and more recently I stubbled upon Peter Bourgon's talk titled "Ways to do things". He shows a few examples of the actor pattern for concurrency in GO. Here is a handler example using such pattern: func (a *API) handleNext(w http.ResponseWriter, r *http.Request) { var ( n...
I am trying to build a derivation tree for the program x = 42 using the specification for ECMAScript 2017. I see that there there is an AssignmentExpression which has the production rule: LeftHandExpression = AssignmentExpression however, I don't see any rule that allows an AssignmentExpression to be a literal. Maybe I...
I am currently creating Excel import modules for some complex data. I didn't plan it well and I have met code reuse issues. I have made first modules and I realized that next modules will need some methods from these I have already made. My first option was to solve it by simple inheritance hierarchy. Unfortunately I c...
I am planning to improve my knowledge of Clojure and algorithms at the same time by implementing some known data structures in Clojure (e.g. linked lists, skip lists, bloom filter, etc.). However, I learned recently that this might not be a good idea. [... T]he fact that getting an optimized solution is so difficult ...
I've recently been reading Clean Code and there was a really nice example in java of when it is beneficial to break down a complex if statement condition in to a function rather than use a comment. // Check to see if the employee is eligible for full benefits if ((employee.flags && HOURLY_FLAG) && (employee.age > 65)) ...
How can I handle change requests to already finished user-stories? Let's say there is a user story which describes how the user wants to list entities. The story describes further: which information of the entities should be shown (as columns). under which conditions entities should be highlighted (background color) ...
I've lately been very interested in reactive microservice design with streaming and event-driven architectures. When one writes (i.e., manages) services, this paradigm works extremely well by simply responding to published events on topics. However, we don't always control the implementation of all the services with wh...
First, I'm still learning to do things in the best possible practices. I would like to know what would be a best practice when dealing with database queries. I've seen codes that query inside the loop to check whether that data exists or not. So let's say I have a set of codes shown below. // assume that institutions a...
I'm working on the data model of a service describing houses and flats. This involves storing quantitative physical properties of certain features of the premises, for example: Speed of the Internet connection in Mbps Length of a swimming pool in meters Noise level of kitchen appliances in dB The quantities will alwa...
I'm creating an application that is composed using different modules (core, course, grades, news). I'm using clean architecture for the different modules but I'm stuck trying to pass data from one module to another module. The idea is plug into one application (app1) several modules or use them in another application...
I'm using Playframework with Java and I'm attempting to choose between a few choices for creating valid User objects (which will then be persisted into the database in my business layer). Play uses Forms as a way to help with validation. So, inside my User class... public User { @FooConstraint private String f...
I'm trying to understand how a 2d or 3d map would be saved, and I'm trying to figure out quad trees. So like is each node represented by characters in a file and inside of that is the next one? What exactly would the file look like, if its just a bunch of characters? Does the order of in which they are in the file sig...