instruction stringlengths 34 36.1k |
|---|
My solution consists of an API for data access and a web application that calls it.
I have integration tests set up for the API. However, the actual Web application that calls the API is not a part of these tests. Should integration tests cover the calls from the actual client web application?
|
If thrown exceptions in constructors can lead to memory leaks or partially-constructed objects, then why we don't make them atomic? so neither an object nor it's local variables will get created/allocated if an exception was thrown. Is there a reason why constructors are not designed that way?
|
I want to know about best practices for release management of a product-technical team with about 7 cross-functional teams included.
We changed our team structure to something like Spotify Squads Framework with some changes because of our team culture and size. now we have 7 cross-functional teams that have all the nec... |
In many project that grow more complex at a certain moment business rule editors, workflow editors, custom taxonomies and such enter the arena.
In all of these a coupling is made between a complex object e.g. "department" and a business rules e.g. "if department = a or b then allow no access"
In the older times these w... |
Currently, I'm working with a health management application, let's call it application A. It's a partly prebuilt generic application that we are extending on. The main entities are journals, events, and persons(patients/medical staff/external contacts).
The user can use the application through a React app to see medica... |
I have a question regarding validations and exceptions in DDD.
I have a ValueObject say, PasswordText which takes a string argument in it's constructor. Checks if the string matches the password criteria. If criteria, matches then the new object is initialized otherwise it throws an exception (DomainException).
The pro... |
I'm following a course on Udemy and the teacher said that is a best practice return the update object in an add method. This is the example:
public Recipe addIngredient(Ingredient ingredient) {
ingredient.setRecipe(this);
this.ingredients.add(ingredient);
return this;
}
This method is a method of the class... |
Let's start off with the infrastructure architecture that we have, because that's the most important aspect of this conversation.
Clients (browsers) which communicate with the product cluster (over WS). Having a websocket connection here makes a lot of sense, because there's a lot of data being exchanged which both is... |
So we work at a company following the microservices architecture where each microservice is developed by its own scrum team with its own Product Owner.
Every microservice is used by multiple different products and the microservices are considered products on their own.
We are looking at options to arrange the work betw... |
I have a C# class library shared among several applications. The library is divided into a few smaller components which have dependencies shown in the picture below. Each component is placed in its own namespace to enforce the component boundaries:
Core <- Component A <---- Component B <----- Application
^ ... |
I've developed a large application that performs jobs, such that it receives input x and outputs y. For this application, speed is the top priority. The application is capable of running concurrently. I want to modify this application so that it can be used as an REST API, where users sends x and receives y as its resp... |
I'm following the guide in https://reactjs.org/docs/thinking-in-react.html which makes sense for data that I request and update on a filter.
However, I want to have some sort of general synchronization job in the background that polls and updates an SQLite database periodically.
The question I have is if the SQLite dat... |
I'm not sure of the proper nomenclature to describe my question, so let me just jump into an example. Let's say that we're modeling a scenario where:
A Vendor can have multiple Customers
A Vendor can have multiple Employees
An Employee may only do work for one of the Vendor's Customers
An Employee's only relationship ... |
I'm trying to use the hexagonal architecture but I want the flexibility to make CUSTOM queries right to the database (or cache) to populate DTOs right from the left-side without passing through the domain layer. I think this is something related to CQRS, right?
The question is: Is that ok to make the left-side layer kn... |
There must be a good reason for this. Laravel's default pattern makes no use of Service Classes... but the Laravel community's best practices is for business logic to be stored in them.
Laravel's default pattern seems to break SRP, and there's no Artisan command for creating a service class, or even any reference to us... |
I have a UX that is modeling a hierarchy. There is a concept of a section, a sub-section under a section, a panel under a section and a bunch of form-fields under a panel.
The UX exposes an ability to (valid-ly) reorder the hierarchy (move a panel to a different sub-section or a sub-section to a different section, etc.... |
First of all, I hope this question doesn't fall under "Asking For Books Recommendation" Category.
Since TC++PL covers C++11, it is 3 revisions old (C++14, C++17, C++20), the ISO group is working on C++23, and I think a 5th revision won't be published anytime soon. So is it outdated?
|
I'm working on a big C# application that is currently under development so we have some room for structural refactoring.
The application is divided into 10 microservices, which some of them communicate with each other.
That intercommunication is done via 2 different approaches at the moment: A) using Apache Kafka as an... |
So as I was learning, I was told that it's bad to define function within header files, as if it's included in multiple places, it'll produce multiple copies of that function and later causes error in linker. But later I found out that declaring such function with inline seems to prevent such issue, as stated in this SO... |
The project I'm working on has a code dependency on a TeamNames enum. The problem with this is that the project needs to be recompiled and redeployed on any addition/deletion in TeamNames. How can I remove this dependency?
I have come up with 2 possible solutions:
Accepting each and every TeamName as a String field. T... |
The following applies to a platform/company at an early stage in its life, moving quickly and cheaply with a small engineering team.
Imagine a platform with the following components:
Cloud infrastructure (e.g. terraform)
Client-facing app
Internal-facing admin app
Third-party API
Shared relational DB, with frequent sc... |
In Event Driven Design, there is the concept of the Event Processor which is the node within the event chain that applies business logic to/from an event message. Usually a single responsibility.
in Microservice Design, the microservice is the smallest, standalone unit within an architecture that applies business logic... |
classes and method should do one thing like the code below:
class A {
public int a() {
b();
}
private int b() {
c();
}
private int c() {
}
}
The code mentioned below I found it as an interface in Clean Code book written by Robert C. Martin. I found some class like this in the book. In the code b... |
I often run data processing/machine learning/filesystem-scanning scripts that can take well over 24 hours to complete. For processes with arbitrarily low memory requirements, I can run without using Slurm, but for anything that uses a remotely large amount of memory (>= 1 GB), I have to use Slurm. The exact memory thre... |
In the context of a DDD application following CQRS and the event sourcing pattern, I have 2 questions.
At which layer should the direct calls to the Infrastructure layer be made? At the Application layer (ie. direct inside command/query handlers) or at the Domain Model layer (abstracted inside models behavior)?
At whi... |
I have a method called GetValueA() and GetValueB() which return string that in formatted
public string GetValueA(){
string a = service1.GetA();
return Format(a);
}
public string GetValueB(){
string b = service2.GetB();
return Format(b)
}
private Format(string unformatted){
return unfo... |
I am building an app (stack is Python/Django/React and DB is PGSQL) that is supposed to be used internally in companies to track their work, assign people to different tasks, throw some statistic data, generate reports, analysis, etc. Essentially make their life easier by automating stuff that they do by hand. The app ... |
Just a question about general terminology. A subroutine as I understand it is basically a packaged subset of instructions that a routine runs to obtain a specific result that it needs for a larger process.
What if you're studying a routine (or program, procedure, what-have-you) and discover that it's actually part of a... |
This question considers whether SQL DB data should be represented as an enum or by a reference table, when the application code is aware of particular instances of said data.
I'll illustrate with an example concerning user roles, but the question is more general. We could of course imagine other types of data than role... |
I'm on a dev team where the product manager wants to allow internal users to "impersonate end-user and show the site exactly as the user sees it". I argue that this raises security flags and, even if it is allowed, data should be obfuscated and the UI should be read-only. When I call my bank or phone company for tech s... |
I was trying compiler design with flex and bison. This is my first attempt in that sense.
For my compiler, I wanted to build a symbol table which would help in building a proper compile-time type-system. When I sat to implement it, I noticed, it actually requires two symbol tables for a code file. One for compile time,... |
I will be writing a number of Python scripts which will be run in batch daily on a Windows server.
I am trying to develop a template for writing the scripts. My intention is to use a configuration file to hold the settings (for example: the location the log files will be saved in).
Below is the template I have develope... |
Say I have the following data-structure describing a given widget sold by my company, which contains fields of purely atomic information (i.e. data that cannot be otherwise derived from other available fields).
my-widget = { "widget-id": 1, "amount-sold": 100, "profit-per-sale": 0.2 }
Suppose that across my app(s), in... |
I have a simple question, why would I use an array of a single class over a class with multiple property arrays?
Context:
I have a series of calculators that extend off a base calculator. Each calculator is intended to calculate the same things but in different ways. Here is the simplified base class (pay attention to ... |
Context
I'm developing togther with my dev team a mobile app in a client-server architecture, since there will be a webclient too, allowing some users (admins) to perform certain operations from the browser.
The REST Api currently authenticates users by returning access and refresh tokens in form of JWTs. Both local (u... |
Context
I'm attempting to design a modelling framework that is modular and easy to extend and test. (I'm trying to follow open/closed, dependency injection, and composition over inheritence principles).
I have a hierachy of model objects, which contain methods, some common to all and others specific to certain models. ... |
Suppose we maintain a massive electronic library of texts/photos/videos etc., and want to ensure that these files are readable indefinitely long in the future. [Update] one of the major problems with digital libraries is the program rot: due to bugs in content creation and/or content playback software (and due to feat... |
It seems that there are at least two possible definitions of continuous integration:
Frequent merging of a codebase to a common codebase (e.g. daily merge to the main branch of a VCS server).
Frequent building and testing of a codebase (e.g. build and test at each push to a VCS server).
Both 1 and 2 can be automated.... |
I am working on a project and I typically setup precompile git hooks for things like linting and testing. I recently had some consultants we use complain about requiring lint on every commit. Their response is they commit as they go and they want to be able to check in half finished code on a feature branch. My persona... |
As an example, let's say you have the following pseudocode:
if test environment: # meaning you don't have the typical service account prod perms
sudo as service account + do operation
else: # in prod so service account will have perms
do operation
assuming that the operation is permission sensitive, such that you ... |
I'm writing a introductory JavaScript tutorial series, I have a question about terminology.
When explaining the Array.prototype methods, I've given an example of some code like:
const letters = ['a', 'b', 'c'];
letters.forEach((value) => {
console.log("the value is: " + value)
});
I've said what's happening here... |
I'm working with microservices, and I see an issue.
There are two services, that transfer info between each other via jsons. Because of this, we have to store our enums in strings, and serialise-deserialise them while passing. The problem is - both services have to have copies of enums, to be able to translate those st... |
I'm a junior web developer at my first company. We have a business analyst that communicates with the sales team and developers. The business analyst is responsible in creating specifications for the feature request.
My question is, should I just follow the business analyst's perspective of the feature request even tho... |
I'm studying Design Patterns book and I was trying to understand the Composition principle in Lexi's Compositor-Composition as explained in figure 2.5, as well as how to implement it.
Where the expected behavior is showed in figure 2.6:
After some research, I couldn't find anything related to the same use case.
The o... |
I'm trying to make a program that produces pdf files. I've been studying the pdf format specification and specific pdf files whose format I'm trying to mimic. I found the line /FlateDecode in these documents and when I searched about this compression method the google results referenced a built in .Net algorithm, Defla... |
I want to show a number of posts, ordered by their score, limited to some number. The score is the product of the number of likes they have (from another table) and the recipricol of their normalized (0 to 1) age.
I have an SQL query that works fine for my MVP, but it neccesitates a full scan of the posts table.
SELECT... |
I have ASP.NET 5 Web Api and need to do the following task:
Add endpoint, which get cshtml page and return generated html, so it should do the same what is does razor view engine.
What is better way to do this?
I added these views in this web api project and I think I can just make httpget request to view to get html r... |
Imagine we have a Sprint Backlog defined, consisting of business features to code. When a feature is developed and delivered (deployed to a test server), QA can start manual testing (we don't have automated tests for a reason). Testing takes several days (we cannot decrease the time needed).
Is it ok for the developmen... |
I am new to web development. After reading some posts, such as this and this, I am still not sure which parts of my application belong to backend. To make things simple, I will use a mock example. The workflow is as follows:
The user provides my app with an API key for a third-party service capable of translating a fi... |
Take a profile page for a job applicant with a list of names in a form with typical CRUD:
Resume Name:
Altenrate Name 1:
Alternate Name 2:
Alternate Name 3:
Assuming we have some sort of Names table for this one-to-many relationship between an applicant and their names, we want to make sure to preserve the order of t... |
Currently working on designing an application that will take in JSON data from remote client applications. The data these client applications are sending is going to go into a Message Broker, namely RabbitMQ, to be later processed. In the architecture, I cannot really decide if the client application should send dire... |
Currently I am investigating the differences between Microservice Architecture and Service Oriented Architecture. A differentiating point is the Service.
In a MSA it is quite clear. A MSA consists of Microservices. They are doing one thing and doing it right. (vertical splitting in contrast to monolith)
For a SOA it is... |
I am writing a simple specification for a module that is part of a bigger call center application. First I write down business rules, then application logic. I realize that some rules apply only to a specific third party telecommunication service API that we are using, like
There are three invoice templates in the tel... |
I'm trying to understand OAuth and Securing APIs better when using External Identity Providers, and all my research on it doesn't really seem to apply to my issue, so I'm starting to wonder if I'm approaching what I'm doing completely wrong at this point.
I have a SPA that is an item manager for a game, it has a custom... |
I am designing a AWS web service which is going to get 1000 TPS from devices(Android) and it has dependency on multiple downstream services. The usecase is to hit this service periodically from device, get a piece of data and cache it in the device memory. Since device does not require the data immediately, I designed ... |
I am working on research that analyzes dependency injection (DI) in Java projects. The more I read, the more I get confused by DI in relation to other frameworks and even software quality metrics.
I have been recently reading about afferent couplings (Ca), efferent couplings (Ce), and instability (I) with the formula b... |
Given two systems A and B that communicate with a Request-Response protocol (REST services).
Where should the entities representing the request and response bodies reside?
N.B.: The entities above represent the contract of these two classes.
My idea is to have only these classes (entities) in their own Maven project, w... |
In our line of work as software engineers, we can write code that assumes various things outside its scope or architectural boundary, in order to save performance, time, and on defensive coding techniques that in the unlikely event of a meteor falling down - your program to still hold strong.
I'm not sure when working ... |
I have a resource called Client and it has the following attributes id, name, redirect URLs(ArrayList).
class Client{
int id;
String name;
List<String> redirectUrls;
}
I have all CRUD http request mappings over resource Client. In the get method I fetch the resource from database and give to client, however m... |
I have a question about the structure of requirements. Ian Sommerville (Software Engineering 10th Edition, 2016) divides requirements into User Requirements, System Requirements, Functional Requirements and Non-Functional Requirements. Can I understand this structure in a way that user and system requirements are one a... |
Please consider a class diagram and a component diagram as shown below. In the class diagram I use association classes to represent the relationship between two classes (BaseLink and ShoulderLink) as well as between a class and an association class (Motor and J1).
In the component diagram, I can represent properties ho... |
I often find it helpful to use KDoc/Javadoc comments inside of a class or function instead of normal comments. IntelliJ colorizes them more obviously by default and, more importantly, allows hyperlinking to definitions. I'm wondering if it is considered bad practice to do so.
For example:
/**
* Standard kdoc comment h... |
I have an API call that returns products to be displayed on a Point-of-Sale system. the current account I have has about 7000 products.
Initially I made the API return all products at once, this works for users that have 1-1000 products and the Point-of-Sale loads relatively quickly. However when users have more than 1... |
I'm looking at creating a class which accepts a string to define a Unix socket address.
Linux supports three types of addresses for Unix sockets:
File based addresses (also called named domain addresses)
Abstract addresses
Unnamed addresses
The first is the conventional method which works on pretty much all Unices.
T... |
On Wikipedia, the article Programming paradigms defines
declarative as a paradigm in which the programmer merely declares properties of the desired result, but not how to compute it;
imperative as a paradigm in which the programmer instructs the machine how to change its state.
Is assignment declarative or imperative... |
Here's a simple example: an API returns a list of possible options with the following structure:
{
"familystatus": [
{
"Id": 1,
"Name": "single"
},
{
"Id": 2,
"Name": "married"
}
],
"gender": [
{
"Id": 1,
"Name": "male"
},
{
"Id": 2,
"Nam... |
I have a hard time understanding how to combine a rule-based decision making approach for an agent in an agent-based model I try to develop.
The interface of the agent is a very simple one.
public interface IAgent
{
public string ID { get; }
public Action Percept(IPercept percept);
}
For the sake of the example... |
I came across quite a subtle bug the other day, where there are two sections of similar code that were supposed to use different variables, but copy-pasting had lead them to use the same variable. I've reduced it to the the example below.
static float module_variable;
float foo() {
float a = calculate_a();
flo... |
there is two interfaces A and B:
public interface A {
}
public interface B extends A{
}
A and B have one subclass each:
public abstract class ABase implements A{
}
public abstract class BBase implements B{
}
and now I want make BBase extends ABase, like this:
public abstract class BBase extends ABase implements B{... |
Say I have a hypothetical factory method whose single responsibility is to create MyObjects. However, MyObject should only ever be constructed with an ordered list. Further, MyObjects without an ordered list should never exist my world.
Is it the responsibility of the factory to make sure the list is ordered before cre... |
I have a function that takes two objects and uses a switch on the enum types of the objects.
The problem I have is this is getting painful to manage as I add more and more primitive types and i need two case statements for each variation.
My switch is setup like this:
switch (obj1.Type, obj2.Type){
case (GeometryTy... |
In my group we are debating whether to version each one of our system components or not.
While I find many talk about "how" to version each component (semver for example) I don't find enough reasoning to do that.
What I can think about is that If a version of some component appears to be faulty, we can always use an ol... |
I'm working on a project which focuses on simple HTTP-related actions (to get my feet wet really). I'm using the net/http package, which I thought was very convenient for almost all requirements except that it seems a http.Server gives instructions to http.Client if and only if the client has established a connection.
... |
I'm reading chapter 20, "Business Rules", of clean architecture book, in this chapter Uncle Bob defines entities as:
An Entity is an object within our computer system that embodies a
small set of critical business rules operating on Critical Business
Data. The Entity object either contains the Critical Business Data o... |
I think the question is pretty straight forward but just to clarify, if the client and server are separate machines and need to be able to communicate with each other, does that mean that certain aspects such as synchronization, ack packets, re transmitting, timeouts, etc need to duplicated between the client and serve... |
Let's say you have to meet some prerequisites before doing something. For that, I think implementing Supplier<Boolean> is a great candidate since it's widely used, and quick to understand. But, my colleague argues that since it's normally used for lambda definition, defining a separate interface is more clear. Should I... |
Software companies like Autodesk, Adobe, etc all offer online licensing schemes with the following features:
(1) to use the software, you must login from your workstation to activate your license
(2) the software may phone home periodically to ensure the validity of your license and also tell the license server that t... |
My Python project performs a complex set of operations, and it's important to make clear which operations it uses and in what order. Therefore, it has a main method that reads like an overview of the project, with the implementation of operations outside the main method.:
class Program:
def main(self): <--- This sh... |
I am currently browsing through Niklas Wirth's compiler construction book. He presents a simple RISC architecture as a target for code generation using the following diagram. The symbols/shapes used are not explained in detail, though. Registers/storage seems to be presented with bold-borders. I wonder what the trapezo... |
Logically, not based on how cost we will spend or how much we will hire programmers to do it.
Can we (Is it possible to) make a compiler for any dynamic/script/interpreter language, like Lua, Python, JavaScript etc, to compile it to native machine code, as like the result that come from C/C++ , without need to modify t... |
This question pertains to properly structuring a class. The object of a class I have is instantiated with multiple parameters. Many of these parameters are then manipulated with each other to derive new values. Currently, I have all of these manipulations as methods in the class.
Is it inappropriate to move these me... |
Positive:
Allow for horizontal scaling of app by replication of instances - without replicating the DB
Drawback:
latency introduced between 2 machines
Is this something necessary for small systems?
|
Do experienced developers and software architects see entire application in terms of design patterns?
In other words experienced developers and software architects able to describe an entire software application in terms of design patterns?
By experienced, I mean developers with 10+ years experience.
Is that something ... |
A contrived example:
I have many Thimbles, identified in real-life by their color, that I lend out to friends. I want to know only the most recent friend that is wearing my Thimble. My friends covet my thimbles, so this information changes frequently.
Options I can think of are:
Keep the lending information in the mai... |
I am getting confused at qualification association. I perform qualification when I need to remove many-to-many relationship or when the PK of a particular table is not able to be uniquely identify a row - in this case I make a composite key by qualifying it.
That said, I do not understand whether after performing a qua... |
I'm an experienced Software Engineer but very weak in concurrency because of no prior experience in that. I've been interviewing with several companies in which I was asked similar kind of questions as given below:
If you are designing a fantasy sports application in which there's a contest which can handle only 100 u... |
For databases like Postgres and ElasticSearch, updates to existing records are relatively quick. I understand that for these databases, when an update on an existing record is written, the physical location for the existing record isn't updated at that moment, but instead the change is written to an append-only file th... |
I want to create a stream class The input stream should read/parse a continuous range from left to right providing convenience methods. The implementation isn't a problem but choosing a consistence API.
A basic example would be:
input_stream is("Hello! 42");
is.peak(); // 'H'
is.read_n(7); // "Hello! "
is.read<int>()... |
I have:
A User entity.
A Poll entity.
Relationship: User creates polls.
Use-case:
When an arbitrarily user is clicked his/her profile is loaded and shown.
The profile includes a list of polls created by the clicked user.
Which of the following api calls is the proper usage of such a use-case?
website.com/api/users/... |
I googled this and found questions like "How to use Protobuf message as java class without a java outer class?" (https://stackoverflow.com/questions/60312156/how-to-use-protobuf-message-as-java-class-without-a-java-outer-class) which talk about how one might tweak their Protobuf Java code generation. For example, that ... |
I have a MySQL database with nodeJS server. I want to implement a notification functionality which is as follows. Once a user registers, I want to (inform) send some particular information to the user that runs in fixed time interval. Something like a task management and tracking.
If user A registers at 10am local time... |
I recently started discovering event sourcing so I am fairly new on the subject.
Imagine having a system (system A) which listens to events of a third party order service (system B). These events can be "OrderCreated", "OrderAmountUpdated", "OrderClosed", etc..
I want system A to build up an order entity based on the e... |
Mostly in all routers and operating systems the Longest Prefix Match algorithm is used for searching the trie of IPv4 addresses.
Packet filters like Iptables don't need some special data structure for finding IPv4 addresses.
I need to implement some data structure, where I could efficiently (log(N)) find IPv4 addresses... |
In the simplified database schema depicted below, I'm considering denormalizing by adding a short-circuit key (EventId, relation shown in red) on Appointment.
One advantage is not needing a join to access appointments data by event (the usual way it will be queried). An additional advantage involves constraints. I'd ... |
I can't seem to find a good enough answer, nor can I reason it out myself. Why deploy to the development environment?
In most examples I've seen, automated unit tests and integration tests run as part of CI when we merge a feature into the develop branch. As far as I'm aware, there is no need to deploy when conducting ... |
In the Book "Implementing Domain-Driven Design" the author suggests to implement a repository method to provide the next application-generated (not database-generated) ID. Like so:
class MyRepo {
public MyId nextId() {
return new MyId(UUID.fromRandom());
}
}
That would lead to code like this:
var id = reposito... |
I've got a state machine implementation in Unity that I'm working on (C#), the plan being that it will be mostly used for AI related things.
I'm not sure how I should deal with various "inputs" / how it should interact with knowledge from the outside environment. Two approaches I've considered and tried so far:
1, I ha... |
What makes programs like st, zathura, sxiv, and feh load instantly and what makes programs like VS Code and Google Chrome load so slowly in low-spec computers?
For example, I have a low-spec laptop running Linux Mint. And when I execute st, it instantly opens an st instance, but when I execute Google Chrome, it takes a... |
I'm reading an introductory article about drivers and came about this quote:
"Once the device sends data back to the driver, the driver may invoke routines in the original calling program. "
I was wondering what this would actually look like(an example).
Eg. If I had a program that had the user type in something, windo... |
Given the abstract syntax tree (AST) of each line of a function's code, I am asked to generate code for that function's corresponding unit tests, similar to what Microsoft's IntelliTest tool does here: https://docs.microsoft.com/en-us/visualstudio/test/generate-unit-tests-for-your-code-with-intellitest?view=vs-2019.
Th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.