instruction stringlengths 34 36.1k |
|---|
I'm approaching the TDD methodology for software development, reading guides and writing simple applications, because a client of my company wants a software and asked to develop it using TDD methodology.
So I was wondering, besides "trusting" the documentation and reports we'll create, how can one understand and be ... |
I have the need to distribute a set of long running jobs across a cluster of containers in ECS. These jobs essentially would need to open a socket connection with a remote server and begin streaming data for import into a database.
For each customer, there may be any number of socket connections required to consume dif... |
I am reading Docker deep dive since I am interested in this shiny technology.
I can read:
The VM model then carves low-level hardware resources into VMs. Each
VM is a software construct containing virtual CPU, virtual RAM,
virtual disk etc. As such, every VM needs its own OS to claim,
initialize and manage all o... |
The question is not very expressive, anyway what I was wondering is if, if I follow the red-green-refactor cycle for each method is still TDD or if it has to be done globally.
I mean, let's say I have 5 methods to test, I can follow two roads:
Write tests for all methods, start test routine, add code to methods, add r... |
---- Description
I'd like to optimize read operation in my service. It has basically put and get methods.
On put I accept some numbers in a string format and put them into thread-safe cache with timed expiration policy. On get I have to perform some math.
Put has concurrent nature and get is non-concurrent, each entry ... |
This question is NOT about what's here: https://stackoverflow.com/questions/25960192/mocking-ef-dbcontext-with-moq and/or similar questions. I am well aware of that. Please, read the question before replying. Thanks.
We have a fairly complicated database, which has some, call them, "business objects" (transactional da... |
I have developed a package program 3 tiers architecture. Persistence layer is developed by using Repository Pattern and Entity Framework 6 Code First Approach.
This package program has many features and I define a Super User(Admin), who has all rights, in initial creation script. So, the operation of the company can c... |
I'm trying to formulate some requirements using the ISO/IEC/IEEE 29148 standards. I know that the following is correct according to the standards.
The system [Subject] shall stop [Action] only when the stop-button is pressed [Condition].
I'm trying to do the same but for two conditions, as follows:
The system shall sto... |
How to write unit tests a method with a result that is highly based on another method ?
async function getStatus(
session,
correlationId,
data
) {
const client = new SomeAPIWrapperClient({
correlationId: correlationId,
timeout: 10000
})
const result = await client.createSession(data)
return res... |
I have a static website with lots of similar pages. The site is very simple, basically just some information for me and a few other people. I'd basically like to spend as little time as possible maintaining it.
Certain pieces show up on every page, and change every so often (the header and footer, for example, but othe... |
I have a large number of record types derived from a binary format specification. So far, I've already written a computation expression builder that let’s me read structures from the files easily:
type Data = { Value: … } // Data record
let readData : ReadOnlyMemory<byte> -> Result<Data option, exn> = // This function... |
I'm working on the research to resolve the Requirements conflicts in distributed Scrum where teams are distributed over multiple locations. I'm proposing a model that consists of five steps including identifying redundant requirements, removing them, assigning unique IDs to each requirement, storing requirement informa... |
In object oriented programming, it is commonly said that each class/object/instance should have a well-defined purpose. For example, there may be a Window class in a windowing toolkit, a ChunkLoader class in a Minecraft-like game, or a Matrix<> class (template) in a linear algebra library. In each of these cases, the c... |
As far as I understand, OT works really well with concurrent editing. There is only one remote copy of the document, and all editors update that remote copy simultaneously. There is a concept of lag in editor actions, but the lag is never big enough to significantly change the document.
If we add offline editing capab... |
I have a cluster of micro services with an exposed search API serving a client app. I want to "stream" in real time the aggregated results of a complex search. The search will be kicked of by the client calling the search API which in turn adds a message to a queue. This will be picked up by an orchestrator service whi... |
I want to make a centralized log web API, so it will have a large amount of data per seconds. the logs will comming from others WEB API
I was thinking if i make the REST API, all of the POST made need to return an answer and maybe can overload the server with so much request.
then I think in webSockets, establish a com... |
I'm working on system that analyses non-trivial amounts of data. The analysis is pyramidal, in that various combine to make intermediate values, which in turn combine with each other and more inputs to make higher-order intermediate values, and so on, until the value is produced. As a simple example: inputs A & B combi... |
Why do we need Models when we could:
Only get the data (which is to be displayed)
Populate the ViewModel with this data
Pass this ViewModel into the View
|
I want to design a hash table library that keeps usage statistics and based on how it is used will use different implementations at runtime. For example use a certain implementation for small size hash tables and a different one for large ones (or tweak parameters to maximize cache hits).
For example let's say I have a... |
I am currently learning DDD and having a hard time wrapping my head about how to implements URL friendly ids for a web application.
From my knowledge, in DDD it is common practice to use UUID as identifier for a domain entity that doesn't have any natural unique identifier. Since the domain doesn't have any knowledge a... |
After writing the complete code the compiler compile the whole code at a time , but on the other hand interpreter take single line at a time. Both the compiler and interpreter are mostly called the language translator.
how both are used in one language like in java.
|
I'm working on eventual consistency. In short I have a bunch of promises and I want to make sure they get retried until they succeed. It would make my life a lot easier if I could just persist the JavaScript promises I need to all succeed. That way, if one failed, I could try it again at a later time. However, I'm fair... |
I'm writing some embedded Linux software where we have two microprocessors on the same PCB and they communicate with each other using UDP through a switch that is embedded on the PCB. Each application has a hard coded IP address. I want to use non blocking send and receive and I found some example code here
client
and ... |
Is there a difference between the 2 below methods for choosing a random card from a deck of cards? Is one approach more accepted than the other?
Method 1: Generate a random number from 1-52 for the first card them remove that card from the array and choose a number from 1-51, then 1-50, then 1-49, etc... to get subse... |
I've read and enjoyed the "Clean Architecture" book.
So the first thing I tried to do is to implement my project with it.
Where I work we follow a design method called IDesign in which the architecture is broken into:
"clients" - encapsulate communication with consumers (e.g. UI)
"managers" - manages business flows (d... |
I'm designing a system where pairs of clients need to exchange messages proxied by a backend service. My initial plan was to use websockets and have the clients connect to a single websocket server, but this doesn't scale obviously. One popular design for scaling websocket servers is to use multiple websocket servers, ... |
I'm trying to make a simple network application using boost::asio.
I think that I understood the basic things like io_context, async functions etc, but I really don't know how to deal with buffers.
To be clear - I know how to use boost::buffers, but I don't know how to deal with it in architectural aspect.
Let's con... |
I was wondering what are the pro and cons between having one function with a if statement dictating 2 sections of code or two discreet functions that are called on separately.
In terms of pro and cons I was thinking.
Computational Complexity
Readability
Maintenance
And any other component I did not consider.
Here is... |
I have a case where I have a dictionary object and a value with no key.
The object can have the system values and then a user value. I have to store that value.
I could use a reserved word or I could use null.
userValue = "enabled";
data = {version: 10, date: 10101010};
data.name = "Charleen";
// reserved word
data... |
I am trying to improve an event-driven processing system, which is having a few problems because the events are not guaranteed to arrive in the correct chronological sequence. This is due to batching and caching upstream which is currently out of my control.
The sequence errors are not a complete disaster for my proces... |
I'm doing a conceptual class diagram for an app that lets:
Clinicians view the patient's lab results and their calculated Reynolds Risk Score.
Clinicians make changes to one or more of the patient’s lab results to see how the patient’s current Reynolds Risk Score could be improved.
My question is: Should Reynold's... |
I am trying to confirm best practice around architecture I am working with.
Frontend <-> API gateway <-> Service layer (Rest API) <-> DB
I have an incoming request which is asking for huge data set (>20000 rows) from multiple DB tables clubbed into one single data set. Now there are two school of thoughts and I want to... |
I'm having quite a difficulty with what i think would suit a Patient class and a Record class in UML
Basically the Record class stores the patient's information such as name, vitals, gender, age and etc.
However, when linking these two classes together, I'm very much confused as to which relationship would be suitable... |
I have 3 different libraries that provide depth data as well as gesture information. I need to wrap these libraries into a single simpler to use for user api. The apis I am trying to wrap provide a set of utilities as well as information that are not equal. The core data such as depth images or color images are provide... |
So I have built a domain model and some logic into that. I have created two repositories for two aggregate roots.
My question is how to access to the reference data from these layers?. For example, say we have the following types Elder and Young.
Our application entry points expect Elder or Young as inputs. But, to val... |
My web API talks to an outside service running elsewhere, based on the web API requests (mostly POST). There is a message queue (RabbitMQ) that sits in between them, for request/response from either side.
My web API is called by client applications that does not have a retry mechanism. Once the outside service respond... |
I'm designing an API for our web application, that will be consumed by mobile developers that will create our mobile app.
I chose to document it using Swagger / OpenAPI 3.0.0.
I'm surprised that when I create a new OpenAPI document on Swagger, I get a default version field set to 1.0.0.
The specification also uses 1.0.... |
Not sure how to handle this. Our current app (.Net MVC) is accessed via companyname.appname.com, authentication is handled via forms (cookie) authentication.
Within the app there is a global search box that is quite heavily used, we are looking to split this out into it's own microservice so all calls for search will g... |
The problem is -
We have a series of boxes (A, B, C, D, ...).
Each box contains bricks of different colours. For eg.
Box A - red, blue
Box B - blue, red, green
... and so on...
and there are multiple versions of each of the boxes -
Box A1 - red, blue
Box A2 - green, red, yellow
...
Box B1 - blue, red, green
Box B... |
I am thinking through some techniques where by I have an application with a timeline. The timeline plays in real time and at points on that timeline I would like to trigger some actions. There are no interpolation curves between points. This would be used on iOS though I'm sure other platforms offer similar-ish things,... |
I would like to allow a set of users to be able to submit a form on one page, and then it would cause an event to trigger on another page.
For example:
Submit Page:
Includes the form, the user submits the form
Alerts Page:
Displays information from the form on every instance of the page that is open across the world.
S... |
In my environment, we have multiple systems developed independently by different teams. Those teams frequently recreate the wheel because they're building applications, not building blocks.
As a trivial example, in one system, there may be a customer_no field, which may be an integer, but in a different system, that f... |
We are working on new enterprise project (multiple activities - online ordering, offline ordering, b2b ordering, accounting processing, secure payment processing, analysis and dynamic pricing and so on) without legacy burden and we are considering 2 scenarios.
Single database (with secure vault possibly)
Multiple da... |
I am new to WPF but actually I need to code in it.
I have got a **UserControl(Window)** and there is a DataGrid in it.
DataGrid can be used somewhere else in the future, but not 100% sure.
Me and one of my collegue need to work in the same module, the best would be if my collegue would work in the Window and I would w... |
Given this scenario: "Clinicians can record their own notes for each patient, viewable only by them." I would model it like this:
Clinician ----> Patient
and "Notes" as an association class between clinician and patient. However, does this mean that the "Notes" class is viewable by both clinicians and patients? If so... |
My team has inherited a Web Forms application that was built over the past decade or so into a monolithic code base with massive dependencies. In order to maintain this system we are going to have to spend time to break dependencies and implement proper TDD.
When I look online for guidance it seems that there are two o... |
So I am developing an employee management application on behalf of a company and am concerned about the extent of rights and capabilities that are to be bestowed upon registered administrator accounts.
Here's the question under a philosophical light:
"What is to be done when the one with power is corrupt?"
Here's the ... |
Background
While writing a new component, I m in middle of making a decision of SQL/NOSQL database (Mongo vs Mysql) for my storage layer. As of today, mysql seems to be a perfect fit for my use-case (6-7 domain entities, closely related to each other). Still, I want to keep my integrations with the data layer abstract ... |
I'm doing a Magic Square problem, and I'm using backtracking tecnique for do it.
So, the magic square asks you for an input which is the size of the square,
and you generate this square, and you need to fill the cells with integer numbers, and the sum of the rows and the columns must be exactly this:
That is the magic... |
I recently came by a seemingly trivial architectural problem. I had a simple repository in my code that was called like this (code is in C#):
var user = /* create user somehow */;
_userRepository.Add(user);
/* do some other stuff*/
_userRepository.SaveChanges();
SaveChanges was a simple wrapper that commits changes t... |
I have implemented a graph structure (for graphs having ~30,000 nodes and ~300,000 edges) as follows:
class graph;
class node;
class edge;
class graph
{
public:
graph(){};
vector<node*> nodeS;
vector<edge*> edgeS;
};
class node
{
public:
node(){};
vector<edge*> my_edgeS;
double weight;
};
class edg... |
For clarification, let's review the following example:
Consider that we have the following array of Ints:
let array = [1, 2, 3, 4, 5]
and we've been asked to generate a new array from array corresponding to the following two conditions:
The element in array should be > 3.
The new generated element should be a string ... |
I have an API in which we expect a emailID and a certain deal data.
The case is we want to keep the dealId and contactId(email) to be unique.
Creating a deal requires data insertion in multiple tables.
data is first inserted in tb_contact_email.
Then , it is inserted in tb_deals , tb_contacts and tb_contact_details
... |
We have a high read, low write website which currently has monolithic architecture on back end.
We have recently started breaking it into micro-services.
We have designed some micro-services - Product, Price, Offers, Content(images, videos, etc...).
There is another micro-service - "Recommend". This service runs a logi... |
Above Image shows the system design of my application. Things work fine when there is a single instance of my microservice but now I am planning to scale it and have the following concern about it :
How to handle concurrent update request on the same record initiated by two different instances of a microservice.
I kno... |
Say I have a function:
def foo(x):
if x % 2:
do_something_with(x)
return x
And I want to make the doing of something opt-outable:
def foo(x, maybe_do_something_with_x=True):
if maybe_do_something_with_x:
if x % 2:
do_something_with(x)
return x
That variable name is awful,... |
I work for something like a consulting company. I have a web application that I built for one client. Now around 30 other clients want about the same product. The problem is, I don't know where to put the data. Most of the data is transactional, and all clients can fit into the current schema. The problem is, most of o... |
I am developing a desktop application (C++/Qt), which might be roughly represented as consisting of two parts - data-handling part and the GUI.
I want the data-handling part to be extensible with 3rd-party plugins. After thinking over possible strategies (and googling :) ), I've come to the conclusion that probably th... |
So, first of all hello to everyone, I hope you are having a good day :)
I will give you a little context. I coded a program for my job, in which I save to a database Errors ID and their solutions. It could be one or more solutions.
Right now the database is a text file which contains a dictionary, with keys being the E... |
Today I was surprised to hear that our Scrum Master and Product Owner decided that they wanted us to consider a change to how Sprint Planning was done. The change essentially is that all of the Stories would be broken down into tasks, assigned estimates, but not assigned to a specific resource.
To me, this basically b... |
I am designing a system where a user can input a budget and a query returns to them sets of objects that they can afford from different vendors. The system has 100s of different combination types (i.e [Knife, Spoon, Fork], [Spoon, Glass, Mug]) so that the query is directed (using nosql database).
The query will look a... |
I had been using react-js and really like its concept so I want to know if there is a programming language/framework that sort of works like it. For instance, I want to define:
var A = something
var B = somefun(var A)
They could live in different objects, modules, files, etc. The important part is that I want to link ... |
I am working through a MySQL design issue. I have a server with a database of phone numbers used in nuisance calls, like robocallers. I also have remote clients that are provisioned. I want the remote clients to submit their data to the server.
A client can use mysql_connect to connect to the server's database but it s... |
We're currently designing an web application that will basically expose "messages" to end users, each message consisting of a subject and body, but more important 1 to many files we call "attachments". This could really be from 1 to possibly 10.000 attachments per message, with attachments being mostly "documents": pdf... |
In my office, there are 200 employees who come to the office in their car. But my parking space has slots for parking 160 cars only. Now I want to design and develop an application that issues parking tickets to employees by doing a fair allocation of parking slots.
For solving this problem, I was thinking of designing... |
I need to redesign a 10 year old Product Management Portal and underlying Data-model. There are build of materials as products in the system.
Product managers update pricing frequently for products. The current system uses Textual Boolean expression typed-in a Text-area, using combination of attributes of materials. It... |
I was in a job interview with a vp r&d today.
One of his questions went something like:
"How do you make sure your code works?"
This question struck me as a bit strange, so I explained how I debug (divide and conquer, debugger, prints, unit testing).
He then continued:
"What if the problem only comes once a day?"
I sai... |
I am new to C and wondering how to properly build primitive functions in order to handle errors. Take for example the following function:
bool
testIfEqual(int a, int b) {
return a == b;
}
Wondering if there are certain classes of errors that the compiler wont detect that this function should account for if it were t... |
The problem
A famous quote says: "There are only two hard things in Computer Science: cache invalidation and naming things"
We all know how important ubiquitous language / good names in DDD are.
I often find myself stuck thinking extremely hard about a good name for a new domain term. With experience I acquired instin... |
We currently have four environments in AWS, development, test, beta and production. Previously, we released from develop to beta at the end of each sprint (2 weeks). We would create feature branches off of develop.
We would then deploy to beta and production every month by merging across environments. Such as merging ... |
I'm trying to decide the best course of action based on two design principles that seem to be conflicting with each other: "a function should only do one thing" (SRP) and "don't repeat yourself" (DRY).
I need to perform two actions:
Get document properties (returns json data)
Download document (returns raw file data)
... |
I am working on a Rails + React application and investigating frontend testing. Unlike the backend tests this doesn't seem to be a straightforward process with one obvious path. There are a list of possible ways to go about this and they all seem to test in very different ways.
The methods I have found are:
Importing ... |
According to the answer in this post Should my classes have separate constructors just for unit testing?
ad hoc constructor is not good and should be avoided.
Unfortunately, I have the same problem in my code.
readonly AppletFirmware _appletFirmware;
readonly byte[] _motorControllerFirmware;
rea... |
Since we are just describing the problem domain rather than showing how the actual software will be designed, does that mean that we should not need abstract classes to show inheritance and arrowed lines to symbolise relationships, such as dependencies?
|
I'm having problem deciding which of these 2 structures to use from my DTOs:
Option 1 is:
@Data
class Lines{
private final Line[] lines;
}
@Data
class Line{
private final String[] specifiers;
private final Set<String> container;
}
Which can be used as this:
//Single
Lines lc1 = new Lines(new Line[]{
new Lin... |
I have a predictive model which runs 10,000+ scenarios to predict the outcome. It's a micro-simulator model for an insurance company. The data part is almost static with changes from time-to-time, meaning data is kind of read-only and data update happens outside of this simulator.
Each simulation run accepts several in... |
I am writing a client to talk to a server API in JavaScript. I have an OOP background but am trying to embrace modern EcmaScript.
So I started with this:
customerApi.js:
const baseUrl = "http://myapi";
export const getCustomers = () => { /* get customer code */ }
export const addCustomer = cust => { /* add customer cod... |
I'm generating plaintext emails with heavily personalized content: depending on various factors, sections or sentences need to be inserted, left out or phrased differently and placeholders need to be filled.
Currently I'm using Twig as a template engine, however the templates become very convoluted, because of the many... |
I need to implement the following flow:
Back-end makes HTTP request to Service A, waits for a response from Service A,
then makes HTTP request to Service B, waits for a response,
then makes concurrent HTTP requests to Service C, waits for responses.
if the response from Service A does not contain specific info required... |
I'm currently working on a bigger project which unfortunately has some files where software quality guidelines where not always followed. This includes big files (read 2000-4000 lines) which clearly contain multiple distinct functionalities.
Now I want to refactor these big files into multiple small ones. The issue is,... |
In the comments of a recent answer, I equated a static library with an archive of compiled object files.
The response was that they are not the same, so what is the difference?
To clarify - gcc accepts an archive of object files as a library, as per Ar_(Unix) #Example_usage. How does this differ from other forms of st... |
I've seen some tutorials and examples of implementing a repository pattern, and I don't quite understand something. My impression was that the whole point of a repository pattern was to hide the underlying data storage implementation from the calling code. Am I wrong in this assumption, in which case, what is the poi... |
I am working on a video game in Unity and at some point I'm facing a tough problem to solve:
The game freezes while loading level data.
Let me lay down what's happening in that process that takes a few seconds:
load track mesh data consisting of sections, faces, vertices
load track textures, build an atlas out of the... |
I often see classes of this form:
class Thingy {
public Thingy( /* some arguments here */ ) {
// Initialize some member variables.
// Maybe do some other things that
// are not likely to fail
}
public Execute() {
// Do the important stuff.
// This often involves acti... |
Process VMs (such as the Oracle JVM, CPython, .NET CLR etc.) are usually stack-based or register-based.
Are the "registers" in a register-based VM actually the registers of the underlying physical CPU? Or are they simply allocated memory bytes in RAM? How is this usually implemented?
And what about a stack-based VM: Is... |
At first this question seems elementary -- Is "real" data on a graph (xy coordinates) a model? However here is my logic. We know a model is an abstract representation of the real-world. A graph is a model. A mathematical formula is a model. Most of the time the data output from these graphs, as we synonymously cal... |
I'm making an HTTP API client class.
I want a Perform() method which takes a request object and returns an obejct that is expected from the API.
So a PostRequest object will describe how to get a Post.
Ultimately what I'm trying to do is the following:
Post post = client.Perform<PostRequest>(x => x.Id = 1);
I'm trying... |
How should versions be bumped during development between two major versions?
For example let say I have version 1.5.0 and my target is to release new major version that will be incompatible with major version 1.
As soon as I start developing and making changes, those changes will be backwards incompatible, so by follow... |
In our team we don't have dedicated Scrum Master, so one of the developer is playing the role of SM. I know this is wrong but it can't be changed.
In our system, we assign story points to all the stories at the time of grooming. Production issues don't have story points but we ASSUME it's 3 story point. For us 1 story... |
I'm in the school of thought of 'thin controllers', and love to push logic down into services and the domain models. However, I'm wondering if my controller should be making an HTTP Request to another web service or if the application service should do it. It seems that with my school of thinking then "yes" I should pu... |
I have not found many resources about this: I was wondering if it's possible/a good idea to be able to write asynchronous code in a synchronous way.
For example, here is some JavaScript code which retrieves the number of users stored in a database (an asynchronous operation):
getNbOfUsers(function (nbOfUsers) { console... |
I am manually creating a rather large data model as input to my unit tests. Data model is created using a number of builders. Developers use these builders in order to create the data model as they see fit for a particular unit test.
An example might be in order: when reporting work time, it is possible to report takin... |
I'm creating an application in which people meet certain criteria to receive a payout at certain milestones. In order to earn these milestones, users will record activity in a log, and when they have recorded a certain number of activities, an administrator user is notified to confirm and authorize their payout.
Curre... |
Exactly as the name says, should smart pointers be exposed in a C++ library API?
I've used quite a few C++ libraries and haven't ran into exposed smart pointers yet. Given that it's very common to hear "only use smart pointers", should developers expose smart pointers in their APIs?
|
I know that when the CPU is in user mode, it can't access all memory, it also can't execute some CPU instructions (called "privileged instructions" I believe).
But are these two restrictions the only things that the CPU cannot do when it is in user mode? For example, what about accessing the CPU registers, can the CPU ... |
Scenario
We are building a UI that allows users to query our data in bulk. The return format is CSV and there is a decent amount of processing that needs to happen, so this processing processing is done in parallel and then sets of rows are streamed back to the UI.
Current Implementation
An AJAX POST request is sent to... |
How can i realize password authenticated key retrieval? I found some description of PAKR:
A PAKR (Password-Authenticated Key Retrieval) protocol and its multi-server system allow one party (say, client), who has a memorable password, to retrieve a long-term static key in an exchange of messages with at least one other ... |
consider the following REST resource Account
{
number:"number-000",
name: "name",
customer : {},
type : {},
status : "status",
balance : 0,
rating : 0.0
}
Now say we have the following CRUD operations:
http://bank.com/Accounts/3456 -> HttpGet 3456 account details
http://bank.com/Accounts/3456 ... |
I'm trying to develop a game server in Netty using an event-based approach where incoming events are dispatched to the correct game rooms, but I'm having some trouble with managing my world state. My game is a small action top down fighter with 20 people in a single roon.
[0, 7, 8, 4, 72, 101, 108, 108, 111]
The first... |
Custom code written for the Salesforce platform is incapable of making a PATCH request to an external server (PUT and POST are okay though), and I need to make a PATCH request to an external service (Microsoft Graph).
While authentication can be handled with a POST request directly from SF to MSG, obtaining the access ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.