instruction stringlengths 34 36.1k |
|---|
I am trying to understand the floating point system. Can the floating-point system represent all the real numbers within the range of (10^38) accurately? If so, then how is it possible? Because technically, we still have only 32 bit memory available (for single precision) and we can at most represent upto just 2^32 in ... |
Probably a trivial question but I just don't know how that piece of software would be called correctly:
I have a closed system (A) and an application on another system and location (B). The Application on System B needs information&data via TCP/IP from the closed system (A). Unfortunately system A doesn't provide an op... |
There are multiple microservices which are responsible for storing data dependent from user, e.g. user preferences on some products, user orders, etc. There is a scenario when user is deleted from user management service's database and the requirement is to also clear that user's data in other services' databases. Usin... |
I am implementing a REST API and need to validate the JSON API inputs for the CREATE and UPDATE endpoints.
The goal is to send a 400 error prior to doing any processing if the inputs are not valid.
In the past, like most people I have been using some sort of schema validation tool such as Marshmallow/Cerberus/Schema/Vo... |
Scenario
Let's say there is a Shop entity in my app. And two types of users: a Customer and an Admin. When a customer buys anything at a shop, that customer's visit is registered in the system (there's a visit counter per customer-shop).
So let's assume a shop is modeled the following way:
class Shop {
id: number;
... |
1
We are trying to redesign a database that currently holds thousands of parameters for different datatypes and currently has a flat data structure.
We generate XML files from the database, which our software application uses to load and display the required data. As the complexity of the data used by the application i... |
I'm new to DDD.
From my current understanding and from the examples I've seen in books or articles, DDD addresses the design of a software system to solve a complete domain problem.
So it figures out the domain models, use ubiquitous languages for communication between domain experts and software developers, find out... |
I have a situation where clients are posting query requests to an endpoint (a c# controller method), and the controller takes the data they post and figures out what query they want, then calls a stored procedure to retrieve the data, then sends the results back to them.
The problem is that these queries come in pretty... |
Consider the following example in a CRUD application. A user can select their favourite food from a dropdown list ("Burgers", "Pies", "Chips"). This is an optional field i.e. not mandatory. Thus a user can leave it unselected, or also update their data to unselect any choice.
Since the field is optional there are a num... |
I work for a company with 580+ cloud APIs (with every API implementing different functionality, but with a lot of overlap) and even more micro services. There have been many attempts integrate all those APIs into one API and data model with minimal duplication.
Before throwing technology at the problem, I am trying to ... |
Consider class below:
class FillTestBySerialHandler
{
/**
*
* @var FillTestBySerialRepository
*/
private $fillTestBySerialRepository;
function __construct(FillTestBySerialRepository $fillTestBySerialRepository)
{
$this->fillTestBySerialRepository = $fillTestBySerialRepository;
... |
It makes sense to give the server applications as much responsibility as possible as to avoid having to rewrite logic across different types of clients.
In my case I am developing a data structure that represents human relations (mother, father, sister, brother, etc.) the purpose is to query the data structure and get ... |
A PHP based webshop running on a shared hosting stores libsodium encrypted personal data in it's MySQL database. To let users have access to their own data, a design very similar to the one discussed in this topic is implemented: a key is derived from the user's password (PWKEY), which is used to decrypt the user's pri... |
Question 1
All participants in a sequence diagram must match a class in class diagram?
Question 2
All class that represents some object that is created by the system needs a class that creates it?
Example
I'm modelling a system (exercises) for automatic ticketing for bus transport that have these "requisites":
(regist... |
My problem is to classify input time series signal (128 points, equidistant in time, range 0.0..1.0) in limited amount (say 16) different classes. We have hand-classified 20000 samples and we are using 2000 as training set and other 18000 to evaluate our classification algorithm (test set).
In my analysis I found that ... |
With the factory pattern we abstract the creation of objects. But what if we need a specific configuration of an object that depends on the calling context?
Example:
So I have a Builder pattern for creating some types of objects that share the same interface
E.g.
private EmployeeBuilder createEmployee(EmployeeDataS... |
I'm trying to teach myself how to calculate BigO notation for an arbitrary function. I found this function in a textbook. The book asserts that the function is O(n2). It gives an explanation as to why this is, but I'm struggling to follow. I wonder if someone might be able to show me the math behind why this is so. Fun... |
Question
When an alt frame is used in a sequence diagram, and one of the two possibility end the sequence, how is "legal" to continue?
example
I need to represent a sequence in wich there are user and atm
the user insert card
the atm verify card
if card is valid, then it confirm card to user and the sequence continue
... |
I am looking for advice for doing "emergency documentation" for a large and complex software module in the technical/embedded domain, that I worked on for several years.
I am going to leave the company within weeks, due to some developments which don't leave me another choice. The domain is more quality-conscious than ... |
I have an array of objects and I'm trying to see, through each request, whether or not a new member appeared in my collection.
The way I currently do it is, I require each member of the collection to implement an IdentifiableInterface that must return a string with an unique handle for each object, as such:
interface I... |
I'm trying out unit testing to see if it works for me, but im having trouble with these little functions.
public void OpenNewMenuItem(MenuItemID ID, ITab DataContext = null){
var menuItem = FindMenuItem(ID);
menuItem.userControl = menuItem.initUC();
if (DataContext != null)
menuItem.userControl.Dat... |
I am creating a DSL for a scraping library I am writing. I would like advice on how to design a DSL, and if the designs I have below are good ones. Apologies if this is an open-ended question, but it appears that this stack is a good place to get advice, so here I am.
The npm package in question is called scrape-pages.... |
DDD concepts: Domain, Aggregate, Entity, Value object, Bounded context
Should every aggregate be a single microservice and have a single DB
( since every microservice should have a single specific DB)?
Entities = tables at the microservice DB?
What are Value objects in terms of microservices architecture? (I know what... |
I have these tables: contacts, tags, contact_tags.
(contact_tags has columns contact_id and tag_id.)
Administrators can manually create new tags via an internal website.
Administrators can also associate a tag to a contact (i.e. create a new contact_tag).
Non-admin visitor behaviors can also cause the creation of a con... |
In Out of Order execution , what happens if there is a younger store that executes before an older load. Wont the load get the wrong data provided the younger store writes to the same address?
I understand the memory disambiguation problem i.e when younger load depends on older store which is the flip side to my quest... |
What I mean by semi dynamic data are data that are expected to be changed only with product versions.
Now imagine this scenario, In version 1 of the product, I have item status : SUCCESS , FAIL
In version 2 I added two new status : DELAYED, PARTIALLY_FULFILLED
In version 3 I added one more status : DELETED and removed ... |
Will the following design prove hard to scale in the long run:
class A {
private static volatile boolean someFlag;
public void setSomeFlag(boolean newFlag) {
someFlag = newFlag;
}
public boolean getSomeFlag() {
return someFlag;
}
}
I want to do this in a project because, in my cas... |
One question im struggling with is how to make linear, cross-service operations/transactions in a distributed system.
For example, I have two services: Orders and Payments. How would the Orders service call Payments, while not allowing intra-service coupling?
As I understand the Orders service would emit an event like ... |
For multi-tenant systems, Vaughn Vernon suggests the tenant id should be on the domain entities. This doesn't seem right to me. The tenant id has no business meaning (with the exception of an aggregate in the context of identity/access control). To me, it seem like the tenant id is an application or infrastructure leve... |
Until recently I used to think that it was preferred to reference objects by pointers or references than to keep objects in some sort of a central, authoritative array or dictionary and only keep indices or keys of members of such an array.
However, recently I started reading something opposite. I started reading that ... |
Scenario
Let's say that there is an entity in my domain called Shop. As a shop owner (user), I am able to create rewards that customer users will be able to exchange.
It also could be possible to have some kind of reward creation policy (eg. a maximum number of rewards that as store owner I can create: if that value is... |
So my question is if my thread A has acquired access to a synchronized method S1() can it acquire access to another synchronized method S2() or a normal method.
|
Say I have a three PRs going into the next release. Each PR is a bug fix and all have been approved for the next release. If the current version is 2.3.1, should the next version be 2.3.2 (count all three bugs as one patch increment) or 2.3.4 (one increment for each bug).
I have read the semver spec, but could find no... |
I have a class that contains insurance benefits. There are many values, such as coverage level percentages, maximums, deductibles, etc. Most of the time, I only need a handful of display friendly properties, which are aggregates of all of the other properties. Other times, I need the values to perform more in-depth cal... |
I build multi-document software, each document has its own history list, and every action performed on the document appears in the document's history.
So far everything is fine, the question begins because there are settings that need to be changed globally, such as to create a global 'style' that can be used in some d... |
During the design of a small app I ended up with two possible design alternatives that both would work but, somehow, I feel one could be better than the other in terms of following OOP Principles, avoiding code smells, etc.
The scenario here would be having an object embedded in a parent class, for example:
class Balan... |
Every example of the visitor pattern that I see uses abstract classes. One of the major drawbacks of the visitor pattern is the fact that each visitor must implement a .visit method for every acceptor it wants to visit. Another drawback is now every acceptor must implement .accept But why not use interfaces? Does this ... |
I'm using DDD and a CQRS/Event Sourcing architecture so my domain logic is separated in a microservice (e.g: command service) and the read side is in another microservice (e.g: query service).
We often struggle with domain experts when defining requirements. Unfortunately the Product Owner is too aware of the technical... |
I have a problem figuring out the relations between some of my database tables.
The scenario for this buisiness case is a b2b buissnes.
I have 3 tables:
users
companies
distributors.
A Company has multiple users (1 to many)
A Company has mutltiple distributors (Many to Many)
A Distributor has multiple companies (M... |
Background:
I'm asking this question as a UI test engineer.
We have a small software team using TFVC on a TFS repository.
We use the mantis bug tracking system to follow up on issues.
Here's the situation:
While manually testing a program, I found a bug and reported it to the devs.
A few days later, a dev has let me kn... |
question
Can an actor "talk" directly with an object of the system in a sequence?
example
For an homework I need to model a "tracking service" for some shipping company.
The functional requisites for the system are:
Allow user to receive information about shipping of specific product starting from a shipping code( if ... |
I have an unpleasant discussion with a colleague who said using session in Java Web Application to validate authenticated users with cookies from Web browser after users logged in is problematic (unsecured mostly and he claimed no one has used this way anymore since 2013).
His idea is to store user's credentials in the... |
I'm new to microservices, and from my understanding, DDD says for microservices to be built around business domains. This means good microservices would be like AppointmentScheduler and SendNotification in the context of a meeting booking system.
In this example, both of these microservices will require access to user ... |
I was wondering - too many microservices usually cause testing and devops overheads + it makes the system more complex.
My service is something that handles a large load (from a data stream). It needs some database data from time to time.
There will be also a seperated process that needs to keep feeding the database wi... |
I'm working on building a multi tenant application which relies on redis as a cache. I'm currently researching a feasible way to achieve multi tenancy with redis. I see that redis enterprise offers multi tenant support, however I'm looking to take advantage of AWS ElasticCache which doesn't offer redis enterprise versi... |
For a ASP.NET Core application, I'm using a library which performs calculations using objects that have a similar interface but their constructors use different inputs. The inputs are market prices and volatilities.
public class Base
{
public virtual double Method1();
public virtual double Method2();
}
public... |
I'm writing a wrapper for XML elements that allows a developer to easily parse attributes from the XML. The wrapper has no state other than the object being wrapped.
I am considering the following implementation (simplified for this example) which includes an overload for the == operator.
class XmlWrapper
{
protect... |
I've seen this approach several times, both in async and multithreaded code. A counter is used to track asynchronous behavior or thread behavior - whenever a new action is started, the counter is incremented. When it's finished, the counter is decremented.
While this is happening, another process is only able to proc... |
I'm practicing problems and found this weird one. I can't figure out the best way to solve it.
You are given a 2D matrix size n*n with only 1's and 0's, you have to find the longest sequence of 1's either column-wise or row-wise.
I'm pretty stuck on this problem. I was trying to use a divide and conquer technique to sp... |
Let's assume we have a required attribute foo for an API call. This can have valid values of 1 and 2 which denote some valid option in the system.
Since this field accepts an integer, if we provide other integers like 3, 4, 5 we get a 406 code with a message like foo cannot be XXXX in response header.
Now, XXXX is ano... |
We’re working on a new service – this service will potentially be called directly from applications on user devices. These applications will be developed and supported by multiple development teams from all over the organisation, all depending on the data we provide.
We’re keen to identify which applications are sendin... |
Are there any best practices around how specific to make events that are generated administratively, say to clean up after one-off operational issues?
For example: Say you have a credit card processing application. Payments are authorized (which deducts from the available balance) then posted (which deducts from the cu... |
I am having a debate with someone at work, think I know the answer, but I would like to hear what other people think. If anything, this will confirm that I am right, or show me a better way to approach what I am working on.
In this situation, I am acting in the role of Scrum Master as the business analyst on the projec... |
I am trying to create an example project Web API to see how "clean" I can remake the Delphi(Pascal) API we are developing on my job.
I have created a solution which as of now contains 3 different projects.
WebApi (the main interface to the application logic)
ObjectLibrary (Models)
DataAccess (Repository style data acc... |
I'm looking for a solution for this, buffering messages in an array and send them after web-socket reconnect. I can check the socket client and push messages to an array when connection is lost and send them after reconnect, But how i can find which message was sent to show a check icon on client side? A solution seems... |
I am building my own analytics platform, which I want to work like this...
A JS script in each of my webpages collects data about users' clicking behaviours and sends that data to a PHP (or other convenient language) script on my server. This server-side script receives the data from the first AJAX request and stores... |
In the exercice i´m developing bellow, i´m applying the chain of responsibility pattern. The pattern works correctly but i don´t think it's the best approach. I think the rule design pattern should be a better fit but there´s no much good examples about it using python.
My questions for you are:
Do you think this cou... |
My project is moving from TFS version controlling to GitLab. This is how we used to go about TFS:
Each production release will be a version branch. For example, 2.0 for release 1, 2.1 for next and 2.2 for next (Sub branching to 2.2.x was also there to track). If at any point I wanted to check exactly what code was depl... |
When we are working on a big project of C or CPP, we are getting some warning. Therefore, we try to remove that warning because when we see compiler warnings that they make us feel dirty. When we search about specific warning, We get some solution to disable specific warnings.
So, I have a question, Is it really good i... |
With the below pseudo code? Am I breaking any SOLID principles?
interface i_pet
string get_name()
string get_species()
color get_fur_color()
end interface
interface i_cat implements i_pet
end interface
interface i_fish implements i_pet
bool get_is_fresh_water()
end interface
class cat implements i_cat
str... |
From my experience, sql code changes almost always tend to be NOT incremental: someone creates a new stored procedure, or modifies an entire embedded sql query for optimization purposes, or creates a brand new table. When I receive one of these code review requests, I could not find any way except understanding the ent... |
I am trying to split down user stories for a brand new system. This system will record weight readings from a balance connected to a serial port.
Due to regulatory data integrity requirements - the data must be attributed to the user who produced it. The business cannot possibly use the software without meeting this re... |
By "more object-oriented", I mean, it appears to me testing frameworks like TestNG and JUnit could encourage testers to write implementations of Test and TestSuite interfaces. The current approach using @Testannotations often leads to huge classes with lots of methods and lots of boilerplate code.
A more "OO" way cou... |
I am working on a Symfony 4 rest API application which will be use by multiple client(about 20 different clients). Each client has his specific needs so I have to fork the web application for each client in order to implement the specific needs. For example, the PriceController which manage the pricing policy will have... |
Sometimes it is a good idea to have a guard block:
https://softwareengineering.stackexchange.com/a/157413
https://en.wikipedia.org/wiki/Guard_(computer_science)
Guard block guards against special cases.
GetFiletype(Ext)
{
; Guard block
If (!Ext || Ext != "txt" && Ext != "md")
Return "Not supported fil... |
In our history, when we did a new release (deployment) any user who was "logged in" was logged out and that was obviously not ideal. Then I switched platform from a custom stack to a cloud provider and a "managed" platform which seems to have solved the problem. AFAIK a user can stay logged in during a deployment and t... |
I develop in an environment where we tend to do a lot of A/B testing. I am curious to learn from others on how A/B testing code is managed in your code base?
Do you mix your A/B testing code with your control code (existing functionality). If you do so, how do you ensure the code base from becoming unmaintainable?
Is t... |
We have a system where multiple consumers get messages out of a queue (currently implemented with a database). The messages have an order field. All messages of one particular order should be processed synchronous. Meaning that 2 messages of the same order should never be processed at the same time by different consume... |
In postgresql I have a table with a list of cities. One row for city. Around 15000 rows. A column is CITY_NAME, now I have to add an english translation of the city name. The problem is that only 10 cities out of 15000 have an english translation.
I was thinking about two solutions:
Add a new column CITY_NAME_ENG with... |
I am doing the Ransom Note algorithm in Hackerrank. The thing is I am not using maps and all the tests pass except for three which execution time takes a lot more. (Kotlin language)
I have two approaches:
1 - Recursively
fun checkMagazine(magazine: Array<String>, note: Array<String>): Unit {
controlWords(magazine,... |
I'm preparing a session on our product's HLD (High-Level Design) for newbies.
It's a microservices-based system that includes several self-managed open-source projects & other managed services (e.g. Kafka, Redis, etc.)
I want to address those services in my presentation in a unified manner - services that are not inter... |
Recently, I've been building a search page where the user can input their search criteria and the server side will use a scoring and sorting algorithm to return the 'best' results first. The current flow is like so:
User inputs their search criteria.
Server-side code (PHP) builds a query to fetch all the results that ... |
I have been developing a library with the help of another library.
So what I have set up here is two classes sub-classing the library's classes for additional functionality. The problem comes in when I want to be able to use the classes interchangeably in another class.
So I want to be able to pass these graphics into... |
Its easy to steal internal hdd, which do not generate sound signals to aware the owner while removing and allows Thief to copy the data.
Is there any way by which these thieves acts can be traced.
|
I have the following pair of functions used for searching upwards for a configuration file:
(defn has-config? [path]
contains? (set (.list path)) "my-config")
(defn find-config-path [path]
(cond
(has-config? path) path
(= "/" path) (throw (Exception. "File not found"))
:else (recur(.getParentFile path)... |
Background
I am starting a new project, and I want custom IOT sensors for an app I am writing. I want to keep everything as simplistic as possible so the IOT devices wont be running any major software or anything, I want them to be as simple as send and receive curl statements(I know they will have to have something bu... |
I have a general organization problem with my code. I'm modeling DNA, and I've created a Nucleobase struct to store the "letter" of the DNA. For ease of use, I would prefer the following functionality for fluent creation of objects, equality checking, and testing purposes:
Nucleobase newInstance = Nucleobase.A;
and
i... |
Suppose I have a Player that wants to build a Tower in the Board of a tabletop game.
My first approach to this would have been something like:
function onConfirm() {
player.consumeResources();
board.addTower();
}
Meaning this event knows the interfaces of player and board so it has some level of coupling.
If the o... |
So I have been working on my mobile app for a while and it is live and in production.
Because we released the app prematurely and are continuously improving current features and making them more thorough it means at every version there's a high change that database schemas will change.
The problem that I have is:
ho... |
We have a system that allows our clients to coordinate people (shoppers) so that they can delivery groceries within 45 minutes from the order creation.
Each client has a set of stores where the orders are processed by the shoppers
and each shopper has an schedule that specifies in which store and at what times he/she w... |
As part of a game engine I am writing in cython, one of the challenges I am facing is creating a consistent interface for error handling that works at the C and python levels of my code. I am interested in maintaining two interfaces to the engine; one that operates at the C-level on structs with no involvement of the p... |
I guess the argument for pre-commit hooks that lint and run unit tests would be that every single commit is clean.
The argument against them is that they take a lot of time to run, which can add up if you commit often.
The same would go for pre-push hooks except they presumably occur less often. Also, if you have con... |
I have a web app - it's more complicated than a todo list but for simplicity sake let us assume it is a todo list. The user has the choice to sign up and create an account thus allowing them to store all their todos to a database. The user also has the option to test out the app as a guest. If they are acting as a gue... |
Are stored procedures considered bad practice in a microservice architecture?
Here are my thoughts:
most books on microservices recommend one database per microservice.
Stored procedures typically work on a monolithic database.
again most microservice architecture books state that they should be autonomous and loosely... |
Let's say I have an which is loosely can be represented as:
public class AnObject{
public AnObject(String name, String value, UUID id) {
this.name = Objects.requireNonNull(name);
this.value = value;
this.id = id;
}
final String name;
String value;... |
A real (but simplified) example from the program that I'm currently working on.
We have an abstract Request class and two classes that extend it: FooRequest and BarRequest. They both have dao's used to get instances of the two requests from the databases: FooRequestDao and BarRequestDao. All across the code base curren... |
Just wanted to know if cyclic dependency is something that one should avoid in microservice design.
For example, let's say we have a simple web store that sells fruit.
It could have:
Account Service - where all information about accounts is stored
Order Service - where all the information about orders is stored
Fruit ... |
My understanding is that the dependency inversion principle does not apply to entities, because entities basically are your application - it generally doesn't make sense to swap out a different implementation of, for example, Student.
However, one of my coworkers brought up a point. We work for an umbrella company that... |
I'm a backend developer working on a webpage, building the CSS part. I like to write as less code as possible and reuse them throughout the site, a lot of pages.
I want to be able to reuse some CSS code. For example, if i have this code:
.box1{
background: blue;
height: 200px;
align-items: center;
}
and i ... |
I am writing a semi-complex piece of scientific software. We offer our end users many configuration options for each job and allow users to specify configurations only partially, with reasonable/safe defaults inferred for the other values.
Sometimes the inferred defaults combine pathologically with the specified option... |
Scenario
I have a Customer and a CustomerSettings object. When I create a customer I also need to create their CustomerSettings object. These settings can dictate the customer experience immediately following Customer creation. After the CustomerSettings have been created there appears to be no reason for synchronizati... |
Essentially, I have a web application and a console application. The web application allows users to configure what will be processed, which is just a big information processor. From the web UI, a user creates a configuration that is added to a queue of configurations for processing.
When the user saves a configuration... |
Recently I have been refactoring state shape in a fairly large redux application, and I have found that one of the obstacles to doing to is that the tests for my reducers clearly have a lot of "knowledge" about the "shape" of the state tree.
There are lots of tests that look like this:
const nextState = reduce(startSta... |
I am porting an event-driven architecture to a container environment (Docker) and I wonder how to take advantage of replication while using pub-sub: if I just increment replicas I end up with many process doing the same elaboration and I don't think is a good way to go. I thought to replace pub-sub with producer-consum... |
We have a solution called 'MySolution'. We have another solution which tests this solution called 'MyTests' which tests 'MySolution'.
When in debug mode, 'MyTests' reference 'Mysolution' with a path to local DLLs.
When in release mode, 'MyTests' reference 'Mysolution' via NuGet.
Only when feature branches of 'MySolutio... |
I'm trying to practise following SOLID principles.
I'm a bit puzzled about following example (which is a remodel/artificial example based on actual code, which i cannot post here):
public class Driver{
ICar car;
public Driver(ICar car){
this.car = car;
}
public void Drive(){
car.Drive(t... |
Say you have a ecommerce app, and have an API call to create an order.
OrderService.create(...);
Order creation is a complicated process, many things will happen as a result of this call:
shopping cart items will be used to create an order and order details
email sent to customer
inventory levels adjusted
billing and ... |
In Onion Architecture, we have repository layer which conducts Crud Operations (simple insert, delete, update). (Applying Entity Framework with database)
Onion Architecture
Additionally , we have Service Layer which conducts complex business logic.
Questions
(1) Should DBContext leak into Service layer? What if we want... |
I am currently working on a project where I need to implement a cache with limited size.
The most common eviction policy seems to be Least recently used (LRU), that simply discards the least recently used items first.
However, my cache will manage elements that have different size. Therefore, in some cases, the algorit... |
I have a question regarding kanban board and handling defects that are found in testing. The case is this:
User story moves through "Development'' and goes to "Testing'' column on board. Defect is found in the period of testing. Where should that US be held now?
a) In the same column and flagged but with new status -... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.