instruction stringlengths 34 36.1k |
|---|
In http://pages.cs.wisc.edu/~hasti/cs302/examples/UMLdiagram.html it is written that "parameter names are not included in the UML class diagram"
I haven't been able to find any information on this. Most places have the parameter list written like so: functionName(arg1: type, arg2: type, ...)
So, is this information jus... |
tl;dr An audacious claim by a classmate caused me to question the definition of the word "support" (verb) in the context of computer science. Is it analogous to standard definitions where a degree of intent/competence is required? Or is it a sort of technical jargon acting as a binary inclusive/exclusive descriptor of ... |
I am developing an app whose main purpose is to display data in tables, lists and graphs.
As such, sometimes I need to rename or restructure some of the data recieved from the backend into a "shape" that the graph library or component can understand. For example:
//raw data
const data = {
dataType: "Precipitation",
... |
I have a simple class called Link that contains some properties, and use different classes for creating different types of links.
My code looks like this:
class Link {
String reference, label, target, ...
}
interface LinkFactory {
Link createLink(Person person)
}
class EditLinkFactory implements LinkFactory {
Lin... |
I'm currently looking at blue/green deployments and I'm not quite sure if my use case is even applicable.
The following simplified scenario of a user management tool:
I have 3 services - GUI, BL, Persistence. I have blue and green environment setup. Green is currently idle and users access blue. Now I want to deploy to... |
We have to compute a schedule for a set of students and teachers in a school. The program takes a large amount of data. The time it takes to compute a schedule for a given input cannot be determined. It could take 2 seconds or 30 minutes. In some cases it might not be able to compute a schedule because of some conflict... |
I have an application that mostly is composed of forms that create, modify, read, and deletes tables and establish relationships. I use SQLAlchemy. If, for example, I need to create an invoice and associate it to a customer and to an agent, from the salespeople of the company I use the following pattern:
1: Load mappin... |
I'm looking for some guidance. Is it a bad practice to use transformation functions within DTO objects?
I have this example
public partial class AgEmpDto
{
private DateTimeOffset _startDate;
private DateTimeOffset? _endDate;
public DateTimeOffset? LastUpdateDate { get; set; }
public... |
I'm responsible for staging some tests, against some members, namely against the rates that are due for them. After talking about it with my peers, I see the members are a function of three other models:
member lead
discount
rate card
They were about to create separate spreadsheet just for the members, manually doing... |
I am currently facing a few issues when implementing the logic in one of my Aggregates.
Imagine an "Account" aggregate, which has email, password, verified and verificationDate fields (basically credentials and verification status).
When a new Account is created, it has verified = false, and verificationDate = null.
Th... |
I do understand the SOLID Principles and LSP, but I want to be able to meausure how well a class diagram obeys to the LSP. Therefor I have found the "Value of LSP" metric, here is a guide how it should be used:
Metrics of Liskov Substitution Principles (LSP) The main key to this
principle is the management of the in... |
I am here to ask question about:
is it good practice to insert many records using CQRS and MediatR?
how to structure that in terms of names and folders?
A have to insert into database over 500 records and now I am doing it like this:
foreach (var item in list)
{
var command = new CreateItemCommand()
{
... |
I'm working on a .Net eCommerce site that allows users to use vouchers to get free products, discounts etc. The problem I have is that there have been instances of users, who have been issued single use vouchers, using their voucher multiple times across several sessions. They add the voucher to their basket in differe... |
Suppose I have an instance attribute that I don't initialize in __init__, but in normal use it should be initialized before any other methods use the value. I want to structure everything so that it all type-checks, and I'd like your opinion on which of these structures is best. My first pass I would write something li... |
In our development process, we have documents for each task/feature that describe
API changes
API logic
Data flow (if needed)
Database changes
How client should interact with new/modified APIs
Other information to clarify implementation
The target audience of the documents are developers who implement the feature, so... |
I have multiple state machines (7) managed by a "main" function. Because of system constraint this will be run on an old qtweb browser with ES5/IE11-like behaviour. So no promises etc. I'm already using Babel to avoid some issues like let/const not accepted etc. My only "reactive" option at the moment is callbacks.
At ... |
I have been working with many applications and had different approaches to storing application properties (configurations).
The problem is were to store different types of configs.
Configs which require application restart and being changed rarely (some 3rd-party properties, DB or queue credentials)
Configs which can ... |
This is a question about terminology, not about method.
Our application consists of physical simulations. Results have been validated in various ways, but we have no oracle that guarantees correctness. Nonetheless, to improve and extend our software we need tests that ensure that at least we did not break things that w... |
Question as the title says. Of course, I already tried searching online, but did not find a definite answer yet. (The sources I checked imply that the terms are interchangeable, but do not state this explicitly.)
Also, if they are not the same, then what is exactly the difference?
Some thoughts from me:
In theory, we ... |
Black hole problem
I am working on matching and daily syncing of our internal data records to an external database that behaves like a black hole, meaning, we cannot view nor extract any data from it for verification. Another of its properties is that one can only do inserts and deletes, so no direct updates.
How to CR... |
The alloca() function allocates memory in the stack frame of the caller. What did alloca originally stand for? Are there any sources regarding the etymology of the name?
|
The technique involves moving some logic from the caller to the callee. Usually the logic that is moved is a check. Here's an example of the technique applied to code that solves the "Construct BST (Binary Search Tree) from the Preorder Traversal Values" problem leetcode link:
INF = float('inf')
class Solution:
de... |
Having read through various microservices literature, I've seen a common recommendation that a microservice should generally be fairly cohesive, owning its own data repository, and serving as the single interface to its data repository.
But now with AWS Lambdas, I'm seeing more occurrences of multiple Lambdas reading t... |
Below is a little context to the problem I'm trying to solve.
There are two separate microservices with separate frontends , APIs and databases.
Customer Microservice - Manages customers
Orders Microservice - Manages orders
Orders table has a dependency on customers and so in Orders Microservice database customer sc... |
I am new to Domain-Driven Design.
When I was trying to define the bounded contexts of the software, I don't know where to start.
After some searching on the Internet, I am totally confused.
Some articles recommend defining bounded contexts from the Business Capabilities since it follows the Conway's law. Here is one po... |
I am currently working on a side project so I can learn new technologies and understand how the components fit together. For this project, I decided that I wanted to work on Chat Applications in the context of Distributed System and trying to replicate as much as possible to real live systems (i.e. Whatsapp, FB Messeng... |
I'm Trying to learn about State Pattern.
In most of State Pattern examples that I have seen, methods of class change their behavior based on just one field (I mean before applying State Pattern and I'm not talking about the reference field of the state interface type) and also that field has no other use in that class ... |
I want to select between "symbol(s)" and "character(s)" for my variables' names in cases when these terms are synonyms. Please teach me some information which allows to make this choice.
Frequent use cases
MINIMAL_SYMBOLS_COUNT/MINIMAL_CHARACTERS_COUNT
MAXIMAL_SYMBOLS_COUNT/MAXIMAL_CHARACTERS_COUNT
EXACT_SYMBOLS_COUNT... |
Source-:https://cs.ccsu.edu/~stan/classes/CS410/Notes16/11-ReliabilityEngineering.html
This is self monitoring architecture. So here computations carried across 2 channels, if they both provide same result then system is operating correctly else failure has occurred.
Hardware and software in each module is different to... |
I have been working on a lambda that is triggered by a SQS with a batch (let's say of 5) and has automatic retry enabled.
The most common problem with this kind of setup that I have seen is that, if we have 5 events, and event number 1 and 2 are completed successful but event 3 fails then during the retry the 5 events ... |
There is a table named is A with 40+ columns, among which around 10 are columns of hierarchical levels, in a data analysis platform maintenance and development ( legacy ) project. Due to development of a new feature, the hierarchical structure would need ten more extra levels, e.g. level11, level12, ..., project manage... |
What I try to solve:
Given I run a set of microservices, most of which expose a RESTful API and additionally publish or consume events via messaging broker,
and I have decided to go "API first" using OpenAPI and AsyncAPI to specify these APIs,
when I design my the domain models,
then ... should I create separate domai... |
I need to create a very small service which will programmatically make a database insertion once a day. As our stack primarily uses Node.js, we’re going to write a JS script responsible just for making the insertion and then ending execution. We will then cron that script for daily execution. However, the script itself... |
I am currently developing a service and a client and I use HTTP statuses for communicating certain info.
For example, I have a POST /vikings endpoint that starts a long running process to create a viking object and returns a HTTP 201 status and a JSON with the viking id. I also have a GET /vikings/{viking_id} endpoint... |
This would be a broad question - but I'm asking specific to the situation around an app that I've developed.
In short, I've written an app that allows users to persist their photos and videos to the 'cloud'.
In an effort to keep this brief I won't go into too much detail but, essentially, any media captured through the... |
The requirement is to trigger certain tasks (API calls) periodically for each user. But the frequency (time between triggers) is not fixed, the user can change it.
In my existing solution I maintain a table in the DB with userId, freq(seconds), last_run (timestamp)
The service uses a Cron-like library to call a functio... |
I know when building an Angular app (or other frontend framework with auto UI update by change detection), using function in a template is not recommended since it will result in the function being called every time when change detection runs. This means if we want to display a value derived from another value, we have... |
We had a conversation (with coworkers) about why we needed to use Singleton for Controller, Business Services, and Repositories.
The reason for this, they claim, is because singleton ensures that code is thread-safe.
According to what I read in The Gang of Four, we should use Singleton when:
there must be exactly one ... |
In Slack and other apps, a user's email can be tied to multiple workspaces.
What’s the best approach to architecting that? Do you list workspace IDs on the user record, or do you maintain a list of user IDs on the workspace level? How do you handle JWT claims?
|
Implementing the Observer pattern in MVC could mean making Model Observable and View Observers. However, this also means that there will be direct communication between views and models without the involvement of Controller? Does that violate MVC spirit? It seems to.
The second option could be making Controller the obs... |
I'm wondering if the use of third party software and/or network requests is the motivation for integration testing? For the sake of keeping the code examples minimal, I'll define a unit test as something that tests exactly one function, and an integration test as something that tests two or more functions.
I have in mi... |
Recently I learned that sequence diagrams can be used at both requirements specification and design level.
My search so far shows the boxes on top of the sequence diagrams used for design consist of objects, while the boxes used on top of sequence diagrams for requirement specification contain classes, and other concep... |
I am writing tests for an algorithm that is built up of several consecutive stages. Each such stage has its own set of unit tests.
I want to check that the whole algorithm performs as expected, but am not sure how to approach end to end testing correctly.
Say we have stages a, b, c. Lets say for simplicity's sake each ... |
Hypothetical scenario:
Let's say I have a Customer service. It has 1 million customers in its database. I then create a new service that depends on a specific projection of the customer entity.
I want to avoid coupling and synchronous communication, so the new service should get customer updates through asynchronous me... |
I've never implemented an entire specification before and wanted to know what a workflow may look like to do so. I have worked on code that was backed by such a specification, but only in maintenance have I had to refer to the spec, and only very small portions of it.
This would probably be an awful first thing to impl... |
I am reading about the SOLID principles, but it seems like the Liskov-Substitution Principle primarily refers to programs that use inheritance.
From my understanding people are shifting more towards composition over inheritance. If that is the case, does the "L" in SOLID still apply? If so what would be an example of i... |
Sometimes there are elaborate discussions about a subject, and while finally developing the program, you want to refer to a mail ... but then people still continue mailing about the subject, so the mail chain continues.
How do you refer to a particular mail in the comment of the source code?
There are two obvious ways:... |
I'm developing a module, which is very complicated. I'm trying to draw a state machine but I don't know if a state machine can present multiple threading cases.
Basically, the module processes the multi-threading inputs. For example, if input a and input b are coming together, the state would change from stateA to stat... |
I'm looking for a more efficient algorithm for the following problem:
The input of the algorithm is a text file and two non-negative integer numbers - the number of headers and the number of tails.
Execution of the algorithm should provide two output files. Output file 1 should have all the header lines followed by the... |
A colleague of mine recently pushed a change to the development config for our nginx. He changed the port from 8080 to 80. It's a rather lazy fix for a development-only issue. I reviewed the change and challenged it, calling it not idiomatic for development. Now he's pushing me for more reasons why it's not ok. I think... |
Most software creates a directory (usually in ~/Library or ~/Library/Application Support in MacOS) to store user preferences, browser history, etc. Most software attempts to create their data directory immediately upon launch and will either crash or refuse to continue if the directory cannot be created.
For example, i... |
I am working with a large dataset (~5GB) stored in a Google BigQuery database. My goal is to create a web app which works a little bit like an Excel spreadsheet where users start off by seeing the full dataset (or at least they think they do - the first 10,000 rows should suffice). They then would go on to apply a numb... |
I'm looking for a system to be able to configure my C++ project to compile some sections of codes and not others depending on what target hardware I'm compiling for. The area of development is software for computers onboard unmanned vehicles (e.g. drones, small fixed-wings, rovers). So, for example, if I'm building for... |
I'm trying to figure out the best practice for querying databases or other services.
If I can make one large query to a database once and sort the data in the backend should I do that over making many small queries and let (for example) an SQL database to do filtering for me.
Example
Lets say DeviceData carries lots o... |
Currently I have a system where I have installed HAProxy on one machine and my other 3 machines serves the webapps and the fourth machine for the database. Now I need to add another load balancer in my system so that any one of the load balancer could pick the request and process it.
But I don't understand how exactly ... |
I face this problem with software development quite often, but I don't really know the name of this issue. It sounds quite common, though.
Two nodes (a computer and a mobile phone, for example) share a common sqlite database (as a file).
At minute 00:00, both had the same entries and life was perfect.
At minute 01:00,... |
How do you know what to memoize in top-down Dynamic Programming problems?
I understand it is to do with capturing the permutations of state. E.g. in the Fibonacci numbers question, it’s memoizing the Fibonacci sequence fib(8) = 21. I understand that; it’s a pure function and input results to output.
However, with more ... |
I'm trying to understand why it is appropriate to have a method prefaced by __ underscores when no subclasses are present. There are thus technically no naming conflicts that could arise.
I'm specifically referring to the __series_type method in this pvcaptest Github repo.
Other methods in the class in this format __g... |
I am relatively new to C# and OOP concepts in general, but am building a standalone application and have run into a question and want to make sure I'm doing it the "right way".
I have a few different types of windows, each type of which I have implemented as its own class. During run time, all of the currently open win... |
abstract class BaseService {
public void doSomething();
}
class AService extends BaseService {
public void doSomething(){
// Do something...
}
}
class BService extends BaseService {
public void doSomething(){
// Do something...
}
}
class ServiceResolver {
pubic static BaseService resolveService(St... |
I need to access and process different resources from a REST API. For this I've come up with two different approaches:
Approach 1:
Create one class per resource, that handles accessing the data from the API.
public class User {
String name;
public static User getUserFromApi() {
//access API, set Attributes, pa... |
I have a service class that performs some operations.
One of the operations is a piece of code long enough to warrant extracting to a new class and unit test it in isolation:
@Service
public class ItemFinalizer {
private final ItemPublisher itemPublisher;
private final FollowupScanPublisher followupScanPublishe... |
Backstory:
I have subclasses that are supposed to override and define various functions, but not neccessarily all of them. They can't remain purely virtual though for obvious reasons, and so I am going to throw an exception instead.
I just have to name the exception's class, and so it makes sense to use a term that imp... |
I know, this question was asked in a slightly different way. But I didn't find it helpful. Sorry, long text.
I'm new in a company and my work concerns graphics and numerical computation. My supervisor, who trains me and decides about my work being accepted or not, has a very specific understanding of "behaviour" with r... |
I have a Vue/Quasar application that allows the end user to convert an Excel Spreadsheet into an Array and load it into a DataGrid. The Spreadsheet has a list of peoples names, email address, department and other profile data. The Spreadsheet could be 1000 names deep or more. FYI- I'm using AXIOS in the Vue applicat... |
Suppose a customer needs to approach a staff member to register her. To model this, I have drawn the image below. However, I am not sure if what I have drawn, actually means both of them can register customer, not that a customer must first approach the staff. Could you let me know? Thanks
PS. The customer will provide... |
In a use case diagram, use case A "uses" use case B. I need to write the scenario based on steps of use case A. Since A "uses" B, I just wanted to confirm that I need to include the steps of B inside A as well. Depending on what B exactly does, steps of B may be incorporated in steps of A in any order. Am I right?
|
interface Resolver {
boolean canResolve(SomeInput input);
SomeOutput resolve(SomeInput input);
}
public static void main(String[] args) {
List<Resolver> resolvers = ...;
SomeInput someInput = ...;
SomeOutput someOutput = resolvers
.stream()
.filter(res -> res.canResolve(someInput)... |
In a use-case diagram, use cases (bubbles) provide a functionality to an actor. For example, ecommerce site, actor "shopper" could use bubble "browse catalog" or "make payment".
In this case, should a bank in an ecommerce example like above be considered an actor? I think not, since the bubble "make payment" does not p... |
When I code in plain C there is quite a beautiful interaction between headers and c files in terms of documenting the code.
I tend to add the documentation on the cc files (and yes I am aware that most people prefare them in the headers), but by doing this my header is now a birds eye view of the cc file. I can, at a g... |
When we have bug/hotfix for the release candidate, we branch off of the RC branch and merge that fix back into the RC branch. We also merge (git merge, not cherry-pick) that fix into the master branch (red arrow):
Is this any better than simply using trunk-based development? (Better meaning less merge conflicts, less ... |
I'd like to state first that I'm still learning about scrum, so my apologies if my question seemed naïve.
Lets say we have an E-learning portal, and I have the following user story:
"As a University student, I want to see my fee for the semester, so that I know the remaining balance."
I've written the following AC:
Wh... |
How would you go about making sure that "events" sent as messages to any sort of broker (Kafka, RabbitMQ etc) from multiple instances of the same service (load balanced) are actually added to the "queue(s)" in a correct order?
So for instance..
Say we have a created an application/service. The service publish the follo... |
Simple example (PSEUDO CODE):
for (int i = 0; i < 100; i++) {
START TRANSACTION;
SELECT id, name FROM employees WHERE id = i;
IF (someFunction(id)) {
ROLLBACK;
CONTINUE; // GO TO NEXT EXECUTION OF FOR LOOP
}
UPDATE company SET good = good + 1;
COMMIT;
}
Can I use in this... |
Suppose my system has Organizations which contain Departments which contain Work Areas, so it makes sense for me to query something like get /organization/o1/department/d2/workarea/w3/employees to get a list of employees in Work Area W3 that's part of Department D2 that's part of Organization O1.
Let's further suppose ... |
I made a state diagram for the Purchase object (parent) and for the Item object (child), as you can see below. One of my doubts is how to represent the integration between parent/child objects in the state diagram.
The system flow is the following: Purchase object has an ArrayList to keep Item objects. Purchase is crea... |
I've read a few articles which cover the set up for refresh tokens and JWT tokens
Is there a best practice in how/when to get the next JWT token.
In my head, there are a few different approaches. I will ignore authorisation for this post.
Log in and authenticate
On each server request, pull back a new JWT and refresh ... |
I have 2 aggregates: Occupation and WorkActivity.
An Occupation can have multiple WorkActivity. A WorkActivity can also belong to many Occupation.
The aggregate is a basic element of transfer of data storage, according to Martin Fowler.
So the WorkActivity can't be a value object of the Occupation because when updating... |
I'm working in a situation where I have 2 different projects (kind of microservices, but they are still messed up in terms of the tables that each project can access - same domain). But so far, they are accessing (via Azure Functions) what is related to their domains in terms of database perspective (e.g Car domain acc... |
I have seen multiple videos on microservices from guys building netflix/instagram and so on, and many and data consistency between microservices, but one thing that I can't really grasp yet, is as simple as responding back to frontend.
Let's say we have frontend SPA or it could be anything else. The frontend has 2 appr... |
I'm struggling to test functionality in a class where the class has to be in a certain state for the functionality to work, but the class cannot be put directly into a given state by design, to maintain state integrity.
I'm developing the back end of a board game in Kotlin. It includes a Game class that is responsible ... |
Let's say I have a collection of cars, all identified by VIN, such that cars/xyz123 will return the car with that VIN. Furthermore, I can get subsystems (children) by using URIs similar to cars/xyz123/drivetrain and cars/xyz123/chassis.
Given a situation where I have a car without a VIN but with a distinct nickname, wh... |
I am developing a website and I would like to allow users to use XMPP for live chat. I would like users to have the option use an existing XMPP account if they wish and store their XMPP username and password with their other account details.
Obviously, there's a big issue with just storing passwords as plain text. Is t... |
According to the 12-factor-app dev/prod parity principle, the developers' local environments and production should be similar.
For developers working on a system with a complex microservice-based architecture, my understanding is that, this would mean that they need to build and deploy dozens of components to their loc... |
I'm designing a web-app that will use a REST API. What I've never understood is what is REST's equivalent of HTML forms? HTML5 forms have a reasonably rich set of server-provided, declarative controls, constraints and validation.
Is the server supposed to send a MIME type (name) or is there an equivalent of HTML forms ... |
Sometimes in apps I look into the Resources and find files for, for example, a 256x256 version, a 128x128 version, a 64x64 version, AND a 32x32 version, of the same icon. When I see simple geometric icons like circles I already wonder why they do not just use SVG, but on top of that, what is the purpose of storing an o... |
In C#, we have delegates, which are essentially variables (holders) for methods that follow a signature. So, I could write
delegate void MyDelegate(int num);
MyDelegate myMethodHolder;
Now, what's always perplexed me about this is the reason for the first line. The language designers decided upon a syntax li... |
Situation
At the project I'm currently working on we're using Chakra UI to create our UI. But I guess this question applies to whatever (UI) library you're using.
There are certain components that need to be customized and so we're creating our own components where we wrap the chakra ui component. Also, some components... |
I'm the developer and maintainer of a FOSS C++ library, call it libfoo.
There used to be just one variant of it; and I've made several numbered releases. Last year, I've created a second variant of libfoo (call it var2). The thing is, despite the new variant covering all functionality of var1, it uses a different appro... |
Given we have several data transformation applications, which e.g. load an image, do some calculation and save some output. They make use of several internal libraries (internal = developed at our company and not published at pypi).
When running these applications, shall we fix the versions of these internal libraries ... |
In python I often see functions with a lot of arguments. For example:
def translate(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p):
// some code
return(x, y, z)
I like this pattern in some cases. I think it makes a ton of sense in library type situations where the variables are optional keyword arguments (e.g... |
I'm trying to integrate a Camera to a more complex system in C++.
The camera I'm using has a low-level API so I'm thinking about using a more simple interface.
Basically what I'm planning to do is (in C++) :
Camera will most probably run on a specified thread.
Create an abstract Camera class interface with all my nee... |
Consider the following scenario in an object-oriented environment. Sample code is in C++, but it could be any OO language.
A software must control an external device, say a TV. From the start you know the software will need to handle different kind of TVs, so you go for an interface (pure abstract) to define the struct... |
We are discussing the adoption of hexagonal architecture (ports and adapters architecture) in our team.
Sometimes I use the rate of adoption as one rough metric about how beneficial a certain practice is. However, I can't find any hints about how widespread the use of hexagonal architecture is.
Do you have any hints ab... |
I am trying to understand the relationship between actors and their representation in the system. Please see the below figure
In the figure on left, I have an abstract representation of my system. In the figure on left, I have a more detailed representation, such that the class Guest is supposed to represent the actor... |
While testing my iOS application against the latest version, I've discovered a bug. For the purpose of this question, I am omitting the details of the bug.
I was planning to migrate the application to React Native for cross-platform compatibility, even IF this bug didn't exist. Now that I've discovered the bug, however... |
I'm designing a class that takes:
1 - An initial set of items (a simple collection/list)
2 - 1 or more Filter objects, that take the initial set of items and return a new set. Each Filter object may return a different set of items, so the main class performs and intersection of the result of these sets. Some of these F... |
I want to use DynamoDB to save application operation data at the end of a session for auditing purposes without affecting the actual application latency. Because this date is only for auditing so we don't want to impact our prod latencies. I have few questions for implementing this:
Should I decouple the DB write acti... |
A customer of ours has a rather large (500+ LOC) service as central part of the project. Written in C# and consisting of rather clunky large imperative style functions, I was asked to improve the test coverage.
After trying for some time to do so without touching the underlying code, I quickly found, that the result wo... |
Not many architectures have skip instructions today. They are (usually) conditional instructions that skip the following instruction. A few architectures having these:
PIC14, with its btfss and btfsc instructions
Most PDP's from DEC (perhaps most famously the PDP-10)
Data General NOVA
I'm writing a superoptimizer (ju... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.