instruction stringlengths 34 36.1k |
|---|
There are many CQRS frameworks and event store libraries.
All of them use GUID as aggregate root's ID.
Those event store only let me query only by GUID.
I realise that there are many times in last project(DDD+CRUD) I need to query aggregate root using others fields rather than GUID.
Sometime use couple fields.
How to s... |
I just hired a junior programmer and he will be 2nd real programmer next to me.
Our software is structured in git with the gitflow workflow. I normally develop and push straight on the development branch.
When a commit is pushed it is directly picked up by TeamCity and Octopus and deployed on the test server under the ... |
Lets say i am following Repository pattern in my application and i have
class UserEntity {
private $model;
public function __construct() {
$this->model = new UserModel();
}
}
Lets say this is my gateway class all the things happen with database stuff is handled by this class for user table
clas... |
I have a list (23 items) of choices and I've transformed it into a dictionary in order to have a value for each choice.
I need to select 3 random choices from that dictionary each time I run the test and their value sum has to be 23.
Until now I did this:
list = ['somthing', 'something else'......'something else else']... |
Who should handle sending emails in microservice architecture if as a email sending using APIs like Sendgrid, Mandrill and etc?
each microservice should send on their own, because it is just HTTP API (some of cons: each microservice should know email of each user in system, pros: easy to implement)
another microservic... |
I've seen this word thrown around a lot so I looked it up.
I've read through countless explanations but I'm still not sure what exactly DevOps is.
From what I gathered, somehow the use of automation (e.g. automated tests) is involved or somehow required and it's somehow related to the software development lifecycle and... |
I have a use case where I need to process a request as follows
Authenticate the Request
Authorize the Request
Validate the message (Reads the database for the existing record and validates it)
Perform some asynchronous operations
Update the records in the database and notify the customer
The problem is I need to r... |
When developing an application which presents the user with many similar forms for data entry, a common approach is to build a framework for defining the form structure in a standardised configuration file (or database tables). What are the actual advantages of this approach over writing the forms by hand directly in t... |
Javascript community generally follows camel case naming convention, whereas while writing REST api URLs follow snake case naming conventions.
What would be the better naming convention for the payloads which will be sent in HTTP requests/responses?
If the answer is snake_case then will it be better to convert each a... |
Lets say I have a function that gets a list of what files to send that are later send over a socket to some other pc. Now usually I keep track of what files have been sent and don't send these files again. For easier coding and debugging I have this:
if debug:
files_to_send = os.listdir()
files_to_send.remove(fil... |
I have been working on a multi-layer, sale management application developed with WPF and partly refactored with EF6 (long story). The application has some very complex tasks which require multiple calls to the database with obvious performance issues. Say, to issue a customer order the application run a task that requi... |
I work in a traditional software development environment. A team of developers work on a product in 2-4 week Sprints and then hand the results over to an operations team to be deployed and managed. Our operations team runs our PreProd and Prod environments under an ITIL framework.
We’ve been trying to include operation... |
I am doing data migration from DB1 to DB2.
First step in that is extracting data from base tables (6 tables with one big master table which has one million records and other 5 being detail tables) in DB1.
This first step of extraction is done and data is uploaded in DB2. Now it will take one month for all business vali... |
If a shop is small, where does self-organizing come into play. If there is only one DB Admin, one DevOps Unix Admin etc...where the manager already decided what resources are required by the company.
I see the IT manager or director already deciding what is required for particular projects in an organization, putting ... |
In our application we have a user who can be assigned multiple territories.
What is the best way to expose the REST API?
Should it be as :
[POST] www.xyz.com/Territory/User
OR
[POST] www.xyz.com/User/Territory
BODY :
{
"UserId" : 6,
"TerritoryId" : [1,2,5]
}
I am designing this application using .net WEB API 2, s... |
What's a good term for an R value of length 1?
In R, the simplest kind of value is an "atomic" vector with a primitive type like double, but it can have any length, so the term "atomic" is not what I want.
Here's an example: I often want to document my non-vectorized functions to indicate that, for a given argument, we... |
I'm writing a REST api backend in NODE js, which is based on MVC approach. My api routes directly hit the controllers, which in turn import models which are a wrapper around the methods from a library (DB ORM) called sequelize.
What will be the better approach for writing the unit tests for the controllers,
To includ... |
In an OpenGL application that I am writing, I want to have a simple shader class to wrap the OpenGL shader handle. Ultimately, I want this shader class to behave very similarly to a shared_ptr in c++ (that is, keep a reference count and free the resource when no references are left). While it is relatively trivial to i... |
Note: I've seen several other questions about repository organization, but I haven't found any with this dependency issue
Current Structure
At the moment, we have several distributions (which must remain as independent repositories - these are more or less client-specific and can't be shared), which all have a library ... |
Some what of a followup to this question.
Suppose I have a Player class with a dictionary call attributes that holds the Health and Mana of the player. In this example, I'll use Python, but my question is language independent as you'll see when you keep reading.
In the Player constructor, is it okay to add elements to... |
People say that everything in The prototypal inheritance is public But we can achieve privacy using closures in the constructor right?
function Cons(id){
this.name='Hermit';
this.check=function(){
console.log(id);
}
}
So why in every single book i come through they say prototypal inheritance is global and has no priva... |
I'm developing code which will be responsible for creating new users and modifying existing ones via an API in a user management system.
I have the authentication class developed, which handles authenticating the API user via username/password, and returns a cookie which gets stored as a property in the authentication ... |
I'm reading about microservices, and one point I come across repeatedly, is, in order to achieve full indepencency, it's a bad idea to share libraries among microservices. Examples are here and here.
But how do open source libraries fit into this image? Can I use Apache Commons or Guava? If I'm using Apache Commons Lan... |
I work in a small team making software, we run pretty close to scrum, tickets and sprints, and use git. I however work in a different timezone, so communication can be a bit disjointed, though otherwise very good.
Recently I have been working on some tickets that rely on a feature that has not passed PR. This can lead... |
I'm proposing changes to a very poorly architected software project that suffers from a multitude of problems. At a high level the project utilizes Angular on the front-end and consumes various REST APIs; which is all great (I don't see the need to change our technology or tools). The problem is that the code base is d... |
Based on this Q: https://stackoverflow.com/questions/50968762/callback-not-being-called I understand (and its obvious in retrospect) what I'm doing wrong. However given the scenario as unit testing the following:
Method 1(dependency1, dependency2)
How can I test that dependency2 is called based on a condition of depen... |
In my current project, I find my self making factories, but for two very distinct reasons:
Reason #1: To assist my IoC container if a particular class needs an parameter that is only known when the class is created. This might also include reading data from a config. This kind of factory contains no business logic, onl... |
It is probably related to "Who should read Exception.Message if at all" and similar questions asked on this site, but I don't see how it is possible to always generate a custom message while avoiding exception messages.
Also in .NET all exception messages are localized by default. Does it make sense or is it just a b... |
I am dealing with a drawing app that allow the user to draw a set of Components (which are like the graph vertices) and they can be wired (like the graph edges) on each other to simulate how their connection propagate and affect each component based on their input, like a function on each node that takes all inputs, ap... |
Currently, I'm designing the intended operation of a (RESTful) API which a team of developers will eventually build. I'm not concerned with implementation details, as long as inputs are correctly mapped to outputs (and data in the database won't be messed up :-)). To me it's not important whether it's built in an OOP o... |
Until now for each of our applications we store application configuration in the same repository as the code that uses the configuration. We have environment specific yml files (dev, test, .., prod) that contain plain text as well as encrypted configuration values. Those get deployed for example as "Application Setting... |
This presentation describes several algorithms for solving a CSP for scheduling.
Say I have a few processes with some constraints:
a before c
c before b
b after d
c 50% more important than e
give d at least 20% of the total running time
f before and after d
g after f only if b is still running
run h if there is at leas... |
Due to many vulnerabilities disclosures, we had to upgrade our core framework, on which large parts of our system depend. (In our case, it was Spring framework version from 4.3.16., but that is just an example, probably less important.)
We fixed some of the backward compatibility issues in the new version.
(Like : new... |
I am currently writing a Discord bot and have reached the point of needing a refactor. With this being my first stab at JavaScript/NodeJS and making a bot in general, there are a lot of mistakes I made along the way that now need correcting. With this in mind, I have been trying to figure out all of the things that I s... |
I am currently refactoring a WPF application that is built on the principles of the Repository Pattern. It uses Entity Framework as its ORM, and is Database First. Each of those entities is wrapped by Repository, the interfaces of which are then used in Unit Of Work. Those units of work are then used by ViewModels.
How... |
Why would we use the userinfo endpoint in OpenID Connect to get information about the user when we can simply include that information in the access token?
The UserInfo Endpoint is an OAuth 2.0 Protected Resource that returns Claims about the authenticated End-User. To obtain the requested Claims about the End-User, ... |
I want to express a use case diagram involving two stakeholders, where one stakeholder's use case is co-depending on an artifact, that is produced by the other stakeholder's use case.
In the following (minimal simplified) example I try to express this using the associations for dependency, which also are used in use ca... |
I have an API I have designed which can return data in 2 different units. To explain this I am tending to use the example of a measurement, in particular temperature. However my use case is slightly more complex, representing a tree of values with percentage values on each level, whether showing this in relation to the... |
I am interested to see how a for loop / while loop would be implemented as an automaton. I am having difficulty imagining how that would work. Say the while-loop did this:
var i = 0
while (i < 10) i = i + 1
Not sure what happens if that were implemented as an automaton (what the states and transitions would be, and wh... |
For instance:
python3 -m
What is the technical term for the "-m" ?
And, where can I find a list of these "modifiers" that correspond to a command? Then, how would I find out what each of these "-modifiers" do?
|
I have an activity with two fragments attached, Fragment/View A controlled by Presenter A and Fragment/View B controlled by Presenter B. View A is on the top half of the screen and does not change through the life of the activity. View B takes the lower half of the screen and is swapped out when navigating to another f... |
Most Java EE guidelines suggest that we should define Abstract EJB services (APIs) and then define concrete implementations in order to conform with OO design principles.
But at the injection point, either the EJB is Local or Remote, we are forced to provide the concrete implementation class.
Eg:
@EJB(jndi="java:global... |
Wondering if there is anything closely resembling data-binding but for boolean values / triggers. It seems like it could be related to Binary Decision Diagrams (BDDs), but they are precomputed rather than dynamic I think.
Say you have 100 or 1000 boolean variables all inter-related in a graph. And one of them changes. ... |
I'm working with JavaScript and PHP right now. My JavaScript uses camelCase while my PHP uses under_score for variable/object/array naming.
I often have JavaScript send data to PHP. In fact it's specially made to send to PHP.
So, my question is, should I write the data being sent to PHP by JavaScript in camelCase or un... |
In a Software Engineering class, we had an assignment to read Parnas' seminal paper on modularization [0]. In this paper, two approaches of dividing a software into modules are discussed:
Traditional Approach: A flow chart is drawn to work out the single processing steps and the program's high-level flow. Then every p... |
I need to architect a system for my company. My question is specific to logging. Part of the requirement is to log 2 kinds of data.
A1. User events (Ex: UserA clicked on Button1, performed Action#21. Error occurred while performing Action#34, Successfully completed Action#51).
A2. Complete API traffic(request and respo... |
I am considering CQRS for building a realtime game server (not gameplay but the economy).
For some reasons. Scaling, Event logging, Model changing.
However in realtime game when player upgrade, for example character. I mocked the client without need any server feedback.
But if he close the game immediately after upgrad... |
For example, when an issue tracker offers the functionality to users to keep a prioritized backlog of tasks and used a relational database for persisting this information, what are effective ways to encode this information?
Of course one could introduce an integral field priority (possibly unique) and sort entries acco... |
I have an object that describes a two-dimensional Graph:
class Graph {
var points; // Array of points
}
Now I need to find some complex patterns in this graph, like (but more complex):
Find two consecutive points with the biggest differences.
Calculate for each point the average of the X previous points.
I'm wond... |
I've read that nesting Promise continuations is bad practice. For example, here.
GetCustomer().then(customer => {
ProcessCustomer(customer).then(processingResult =>
{
console.log(customer);
console.log(processingResult);
});
});
As the 2nd function call relies on the output of the first, un... |
Based on the demo or license version of my application, I am supposed to either save the data to a file (xml) at a specific location or a relational database. What should be my approach for this case in respect to class design? I assume using strategy pattern will be suitable in this case.
|
We currently have a big Django web application: all data is centrally managed by the webapp, via models backed by Postgres.
We want to offer access to the data in a more decentralized way, and the solution that we are aiming for is to provide small uServies dealing with the different application domains. That is, from ... |
I am building a web application that makes use of multiple API's (Google Maps, Weather APIs, and more). I am using Python + Flask on the backend, and Javascript (probably with React, I have not decided yet) on Front end.
The application will take the results of these various API query's and then give the user a simple,... |
So compile-time annotation processing is as old as the annotations themselves in Java. Yet most of the useful libraries were developed with the runtime approach in mind – at least at first.
Now, however, I notice a recent rise in interest in the compile-time approach. Where until now we only had runtime annotation libr... |
Should information about the permissions and roles of the client be included in JWT?
Having such information in JWT token will be very helpful as everytime a valid token comes, it would be easier to extract the information about the permission about the user and there will be no need to call the database for the same.... |
I am pretty sure that in one month, I can create a website semi to professional with really good design, functionality and security. I have made quite a few researches and I have found websites where I can advertise my own website and sell it.
However, I still have some hesitation:
What risk do I take selling a website... |
Is there a cleaner/ better readable way to maintain and iterate many-many mapping rather than multiple if conditions ? (One way would be to store the mapping of ReportType -> DataSet Req. in the database)
For e.g if there's an application which depending upon 'reports selected', generates reports using data from requir... |
While creating/assigning the JWTs to users, should we also store them in our databases?
The negatives/cons of storing tokens in database would be, that all the data in the payload of the JWT token is already stored in the database, hence storing the token will storing the redundant data, also the verification of JWTs h... |
The question is in the title. My guess is that the answer is "No", but I would appreciate confirmation.
This page mentions as a downside of the Lesser GPL that using it permits use of the library in proprietary programs, but doesn't seem to touch the subject of use by a Lesser GPL library.
|
The Wikipedia article on the subject of inner classes enumerates a number of programming languages that support nested class definitions. Historically speaking, which programming language first added nested classes to its feature set?
|
Would it make sense for me to use a builder pattern to return data from an API? Currently I'm just creating the array structure and returning it. In more detail, I have 3 exit places for my class that should be accounted for (one of them being empty results).
Basically it is just a multidimensional array in PHP like be... |
I'm making an online game and it has a server handling smaller game server. We call it "MasterServer". This MasterServer listens to commands from both TCP and HTTP and answers to them using its own services. The thing is, the number of services is growing and I'm worried that it could reach a point where having then as... |
Say I have class with a boolean member variable fancy:
public class MyClass {
private boolean fancy;
}
Case 1. I could the define the setter and getter as follows:
// getter
public boolean isFancy() {
return this.fancy;
}
// setter
public void setFancy(boolean fancy) {
this.fancy = fancy;
}
Case 2. Alter... |
I was reading on this slide show presentation about Elder Scrolls 6. The author writes:
Add some different directions to swing your weapons, more tactical
options, feinting, parrying, literally anything
Let's define a few words here:
feinting: a quick movement that you make to trick an opponent
Parrying: to defend ... |
I want to expand my personal projects portfolio, so I decided to make a card game. To be more precise, it's called Macau. I've read this answer on StackOverflow and tried to follow the steps from the first answer. I made a narrative in which I describe the general rules of the game and its particularities.
Macao game.... |
Trying to change payment related stuff in current project, but still couldn't decide on architecture of small part. I hope you can share your feedbacks.
Flow and state:
We have payment account using which we send money (paypal, swift or iban accounts), each time user wants to (1) add/update his/her payment account, we ... |
Suppose we have domain Character and Player. Character owned by Player.
Player
PlayerID : GUID
OwnedCharacterIDs : Guid[]
Character
CharacterID : GUID
OwnerPlayerID : GUID
While my business logic required both side of references.
Question is
Should I have both direction reference? This will cause redundan... |
I've created a rest generic service which additionally consume a websocket per resource my websocket code looks like so:
initialize(hubSubRoute: string): void{
const accessToken = this.authManager.getRawAccessToken();
let hubUrl = environment.baseUrl + hubSubRoute;
if (accessToken) {
hubUrl += '?' ... |
Say I have different types of operations which i need to perform. I have an abstract class 'BaseOperation' which has all the information common to all operations. Now i need to categorize these operations based on an attribute and then further categorize every operation in each category based on some other attribute as... |
I'm interested to know how software deployment for cross platforms as well as different programming languages happen.
Like,
Customers is on - linux and Windows
Languages - Java, .Net, Ruby and Python
I wanted to understand how Ruby and Python projects/applications/modules are built and integrated with Java or .Net ap... |
The situation
Our system has a MySQL database with a product table whose parameters can't be modified.
In order to add optional extra parameters, a developer designed a key-value pair table which looks a bit like this:
+----+--------------------+----------+------------+
| Id | key | value | product_i... |
Let's say I have a asp.net-mvc application and I have to check that object can be deleted before deleting it.
public class ItemController : Controller
{
public ActionResult DeleteItem(int itemId)
{
// Check if any customer currently uses this item.
var customersUsingThisItem = _customerService.G... |
Here's our problem - we have several solutions with multiple projects using our own nuget packages. We're following GitFlow, but not SemVer. Every time we're developing bigger feature or epic we want to keep it's code up to date with our development branch (which can have some other features or bugfixes done in time of... |
I have an amateur question with respect to CDDL 1.0 License.
This link provides a list of all the open source software used by intellij idea. The one in relevance now for this ticket is: WADL-core that it uses which is licensed to CDDL 1.0.
Now CDDL 1.0 demands that the source of the library also be distributed along... |
I have designed a microservice stack with docker as backbone, about 50 services in total so far, still growing...
Everything works well, happy with the design choice, but room for improvement. I notice a lot of duplicate logic in the different services for instance. Most of these duplication is related to queries to se... |
Let's say, for example, you have an application with a widely shared class called User. This class exposes all information about the user, their Id, name, levels of access to each module, timezone etc.
The user data are obviously widely referenced throughout the system, but for whatever reason, the system is set up so ... |
I already went through several versions of the DOM and HTML specifications on the W3C's websites but I have never seen a complete overview model or meta model regarding the DOM or the HTML.
Additionally I also failed to find such a model on other websites.
Is there a good reason for that, for example does the DOM not f... |
I have been reading on C# Performance Counters and I was wondering if I should be keeping them in my release build?
I have never encountered an application that has it's own custom performance counters which leads me to think that maybe it is not a good practice.
At the same time having performance counters specificall... |
This is a standard confusion I've always had with the concept of story points. I've always been told that the complexity of story points should go up roughly exponentially. Essentially a task pointed at 5 should be more then 5 times as complex as a task pointed at 1.
However, when tasks are assigned the discussion of ... |
I'm developing a CLI based application. It has a "login" command to perform authentication:
$ myapp login
$ Type username: hector
$ Type password: *****
$ Login success!
Internally, myapp login makes a request against a HTTP API and a authentication token (JWT) is returned, so I need to keep it in the client somehow,... |
Sometimes I can see method definition like:
public User findUserById(int id){
}
But my justification is, isn't "(int id)" already include the information of "ById"?
is it better to have naming just like:
public User findUser(int id){
}
instead of having "ById" to repeat the already present information?
|
I have an asp core MVC project for a college and I would like to implement a timetabling feature.
To see if I could successfully even generate a dynamic HTML timetable, I started playing around in a separate console app. Naturally, the more I played, the more classes I ended up adding, and the more complex the HTML gen... |
We use quite a few external open source libraries in our projects, pulled in from Maven Central etc.
I was wondering what is best practice to ensuring that you don't introduce some sort of security risk by using these dependencies. We have quite a few and it's unrealistic to re-write these libraries.
I'm not sure t... |
Let's say I build my code so that I inject ALL dependencies to every class and when I test, I replace those dependencies with test doubles. Let's also say that when I work on a class I run its tests to test it. Given that a regression is an unexpected failure in a part of the codebase other than that which I changed, i... |
Assuming you want to build automated tests for the following (very simple, if odd) class.
// Calculates the distance between neighboring values in a vector
// and provides functions to return the distance from one index to the following
// or to find the first occurrence of a specified distance
class NeighborDistanceFi... |
We need to email our customers once per year (yes it's opt-in etc).
As I see it we have 2 ways to record the fact we contacted them (so we know not to contact them for another year). A log, or a 'lastContacted' field in the customers table.
I don't like adding fields to the customers table - however, if we go the log r... |
We have 4 classes.
Field
ForbiddenField inherits from Field
RequiredField inherits from Field
ForbiquiredField : the subject of my question
I would like to define a function Validate()in ForbiquiredField, originaly defined in ForbiddenField and RequiredField.
I would like to use both of functions X() defined in Forb... |
Is it a bad design if we inject dependencies based on the running environment (production, testing, development, etc)?
Consider the following container in Laravel as an example:
$app->singleton(
\App\Services\Mailer\MailerInterface::class,
function($app) {
if ($app->environment() === \App\Support\Environments::... |
In the Rust documentation, under the structs section, they give this example of how structs need lifetimes when they contain references:
struct Foo<'a> {
x: &'a i32,
}
because
We need to ensure that any reference to a Foo cannot outlive the reference to an i32 it contains.
My question is: shouldn't that be impli... |
Using C# as an example, extensions on IEnumerable to allow code like collection.Each(i => i.DoStuff) rather than a foreach loop are generally frowned upon, mainly because they don't follow LINQ conventions of being functional, in that the functions they take are statements rather than expressions, written to have side-... |
I am writing a software specification and I got confused with the data dictionaries section.
is it a full detail of the interfaces and stored models ( like of a database ) or a just a second step of analyzing the projects's models ( a more detailed text version of the models explained before ) ?
|
Often I came across situations like this, how to write this code in a neat and clean way.
One more issue I find here is performance as I am iteration a list and then it's properties.
Edit : - while the suggested How to tackle a 'branched' arrowhead anti-pattern? post address the nested if-elseif-if concern to a great e... |
Functions are the first line of organization in any program.I believe writing them well improves the readability of code to some extent.I am working on metrics that describe how readable the function or class is ?. One such metric that contribute to readability is Function should do only one thing from clean coders bo... |
I am looking into assembler and I am trying to understand the whole compilation process.
During the linking step I use:
ld -m elf_i386 -s -o hello hello.o
Everything works fine, but I do not understand what the -m parameter does.
In the manual it says:
Emulate the emulation linker.
And here it says:
A linker emulat... |
I have recently seen an example of what I think is a clear violation of ISP, but my colleague argued it is easier to use. This is what happened:
We had Options class that had 2 fields sent as a parameter to one of the methods where both fields were in use.
Then there was a new field added that was used in another meth... |
I am trying to create a reusable component / Cocoa Touch Framework in Swift that would display the current weather based on the user’s location.
Right now I cannot decide which approach should I take.
First approach: A custom UIView that displays the weather and forecast information. And inside this UIView is the logic... |
Situation
Currently I'm developing a web service in which users can (generally) upload binary files. These files are stored in the file system of the host OS and some additional metadata about the file is stored in another SQL database, including its available version identifiers (a file may exist in multiple versions)... |
I am working on RCP application, I'm new to this application.
Spring beans are used to write business logic to save/fetch entities.
But, instead of sending entities directly to client we are converting to DTOs and populating client. While saving, we again are converting DTO to entity and saving.
What's the benefit of t... |
I want to use PowerArgs for a console application I am writing. It offers some nice features I'd like to try. My root looks like this:
public static void Main(string[] args)
{
try
{
Args.InvokeAction<MyClass>(args);
}
catch (Exception ex)
{
Console.Wri... |
I have a simple class Notification, which has a few properties (title, body, op) and only getters/setters. Among all my project I'll use different kind of notifications, this is Notification objects but with different title, body, op depending of the logic of that part.
I'm wondering what would be the best aproach to i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.