instruction
stringlengths
34
36.1k
We are implementing Specification Patterns with Domain Driven Design. Company architect also wants us to utilize Generic repository (not my choice). Currently require specification Pattern for Filter Where, Sorting, and Paging- 3 different ones. Are specification patterns supposed to return IEnumerable, IQueryable, o...
I am currently working on a Physics Engine in C++. The Physics Engine is for a sandbox video game. I want to build a powerful physics engine, so therefore, it needs to be very precise. I have written the following function: Vector3D* rotationX(double theta); This function will rotate a vector around the x-axis at t...
Say every word belongs to a dictionary. What's the preferable URI for a single word, either /word/:word (with dictionary_id a required GET parameter), or /dictionary/:id/word/:word? I'm thinking the first one, just because otherwise there's a possibility that things could get out of control if the child resource in tur...
I am starting a financial software company and in the process I have been studying Agile principles and methods and the one aspect of development that I have not yet seen addressed is where to fit the continual need for developers to learn new skills and technologies into the development process. Before working on fina...
Before the creation of Agile, what were the most used models in Software Development? I am writing a thesis on the various ITS software (like Jira) used to implement these models and I want to put a paragraph about the most used models before Agile and its derivatives.
I have a project with the code hosted in Azure DevOps and I'd like to start using the Pipelines feature to handle the builds. My first problem is that I have a set of tests that use Azure storage emulator (I'm using Azure storage in my project). These tests fail on the build server, since there is no storage emulator ...
Currently, I am working on the project that consists of two teams which we track also in the JIRA software tool and it is basically two teams that are working on the same project so this is my question and concern: Should we create parallel sprints (they start and end at the same time) for the X and Y team and then tr...
I am writing module that other people can use in their code. It's a calendar. I want to allow users to set locale parameter so that they have month names and other data in language of their choice. I could create Calendar class that accepts locale, startOfWeekDay as arguments. Methods of that class will those properti...
As I was creating a metadata repository, I came across a doubt. As I'm new to databases, I was wondering if I should add the foreign keys data into the tables that have them (for context, imagine a table that is related to other in a way that it has a FK. Do I need to add this FK into its metadata repository table?). W...
I've written this set of convenience functions which give nicer names to certain trivial one-line computations. The thing is, I don't feel I can write a test for any of them; anything I write is just "check that f() returns the same thing as running the body of f" - which seems contrived. What do I do in these situatio...
Suppose one plans to implement authentication for their web app. There have been cases, like with Instagram, where passwords were accidentally stored in plain text due to logs. While we'd hope to never make this mistake, we're thinking it might be best to do an unsalted SHA512 hash on the client-side, and use that as t...
For example, say you have a class Point which has floating point components. It's tempting to overload the equality operator so you can do something like a = Point(1.1, 2.2) b = Point(3.3, 6.6) b /= 3 a == b // should always hold true This could be achieved through an expression like abs(a-b) < epsilon. Is there any p...
I asked a question about duplicate validation in domain or application layer. Now, I decided to put all the business rules in the domain layer. I have a value object like this, it has a method for validate business rules. public class OrderId : ValueObject<OrderId> { public string Value { get; } public DateTime...
I have a three tier architecture API to add and remove customers. Every customer has some employees that are responsible for that customer. Those employees are located in another collection of documents (I am using a NoSQL db) So if I am adding or updating a customer the customers gets a list of employeeIds that refere...
I'm currently facing a difficult problem regarding re-archituring a legacy webshop, i would really appreciate some insight. The system depends on a 3rd party API for it's product/variant data the latter returns a JSON "page" containing an array of products. Currently to keep everything in sync the process is to query t...
In many languages there is a scope that is just less than public called internal. Wondering, Why none of the language, implemented a feature on internal such that one can specify Only what other classes are permitted to access or Accessible to all classes in the module There are many examples where a group of cla...
Let’s say fn(x) is a pure function that does something expensive, like returning a list of the prime factors of x. And let’s say we make a memoized version of the same function called memoizedFn(x). It always returns the same result for a given input, but it maintains a private cache of previous results to improve perf...
My question regards the use of import statements. In most programming languages I've come across (e.g. Python, Scala, Go), it is necessary to first import a library before you can use its functions. Why do you need to specify this import statement? Why can't you just use a function/method, and the environment finds a...
I have a Business Layer, where I have put all the Entities of the Domain Model. Also there are Domain Services, where I put Domain Logic related to n Entities. One entity is : public class TypeOfIceCream { public int Id {get; set;} public string Name {get; set;} } public class IceCreamOrder { public int Id...
Where the application has the ability to mark dropdown items 'inactive' - this means to the user that particular item is no longer in use and should not be shown in dropdowns. However, it is used on existing files (has FK relation) and therefore cannot be 'deleted'. When loading datasets for lookups, how to account fo...
My research indicates that the ideal database design is: Mobile App -> Local Database -> Syncing -> Remote Database using something like PouchDB to do the data replication/syncing. But wouldn't it work just as well, if not better, to simply skip the Local Database step? Mobile App -> REST API -> Remote Database Note ...
I'm working on a feature where users can get data based on the if statement they write. The if statement looks something like the excel's conditionals. Basic syntax: IF ( lhs == rhs, ifTrue, ifFalse) Examples: IF ( (2 + 2 - (2 * 1)) == 2, "Equal!", 0) IF ( "ABC" > "a", IF (1 == 1, 100, 200) , 0) IF ( "hello world" == c...
I'm building software with 3 layer architecture and asp.net core , as you know the Dependency Injection is Built Into Asp.net core As i know the 3 layer architecture diagram is like this: According to above diagram we don't have any direct connection between Data Access layer and UI layer My project is: My questio...
In my project, I have two type of Service Class : The simple one, they are interface that use the DAOs The complicated one, are Rest Api Service The Rest Service will make call to an API, and map the resulted JSON file as a mapped Object. Till here, there is no problem. But, the thing is, that I had to make Unit Tes...
Given a number of intervals: -- (1, 3) a - (2, 3) b -- (2, 4) c -- (3, 5) d intervals = [(1, 3), (2, 3), (2, 4), (3, 5)] I would like to generate the minimum number of groups so that in each group any 2 intervals overlap. [a, b, c] [c, d] Please note that (1, 3) and (3, 5) are not considered overlapping int...
Under orchestration it is pretty straightforward to return errors upstream (to the client). Client <---> Orchestrator <---> Service A " <---> Service B " <---> Service C The orchestrator can wait until all the responses from services A, B and C are received, before retur...
There are plenty of resources that explain what unit and integration testing are and why they are important. That is not what I am asking here. I am trying to understand how unit/integration tests are run and how they work. I have a very tenuous grasp of how these tests work behind the scenes and I'd like some help in ...
I find myself often looking up questions online, and many solutions include dictionaries. However, whenever I try to implement them, I get this horrible reek in my code. For example every time I want to use a value: int x; if (dict.TryGetValue("key", out x)) { DoSomethingWith(x); } That's 4 lines of code to essent...
I've been struggling with modeling something out correctly, the DDD way. The use case is quite simple. You're a User, and you can be part of a Group. So we have a 1 - many between group and users ( both are aggregates ). Now, a user should know about it's users , so it contains a list with user ids ( I'm not putting a ...
What is the meaning of the words asynchronous and synchronous in computer science? If you google the meaning of the words you will get the following: Asynchronous: not existing or occurring at the same time. Synchronous: existing or occurring at the same time. But it seems like they are used to convey the opposite m...
I'm working on an e-commerce solution and as part of this we have concepts of things like Stores, Currencies, Payment Methods, Shipping Methods to name a few. For each of these, we have an admin interface so developers can setup a new currency or payment method and configure it's settings. For example, for a currency t...
I have a schema containing contracts, sub-contracts, services offered by each of those, and sub-services. I also have an application that allows me to extend the duration of the contract and to modify data on the services and sub-services. I've been thinking about the best way to keep track of the extension and I've fo...
Consider this example system consisting of the following resources: Family, Person and Role. A Family and Person has a many-many relationship and each family member has a certain "role". For example, a family may consist of persons with the following roles: a mother, a father and two children, but the parents may thems...
In Kotlin, specifying the return types of functions and the types of variables is usually optional but can be optionally included. I've encountered a few benefits of including them: It sometimes makes type errors more understandable as when types don't match it helps the compiler determine which is wrong and which is...
We have two-week sprints and our PO organizes grooming activity when it's needed looking after that it should not exceed more than 10% of the development time. Question is: - Should refinement activity be ''locked'' in the calendar? - Must all of the members in the Scrum team participate in it? My concerns: - If all...
I have a simple service that fetches an article from the repository. If it finds it then it returns it otherwise throws an exception. In short the function is totally dependent on the database interactions. public class ArticleService { private ArticleRepository articleRepo; public Article getArticle(Long art...
This is the case: A new team which consists of 6 people. They are a new team so there is no velocity that can be used for further sprint planning. A problem: The project manager wants to know when the project will be finished. We have the user stories stacked in the product backlog and now we need to estimate them....
We have a big angular project that works with several APIs provided by other projects. This project has a common part that is shared by all. It includes smaller sections dedicated to different teams and back end APIs. My question is "How to divide these sections into different teams through the git so that each team ha...
I'm working on a console extender project and I'm getting to a point where I feel I need some refactoring. The only public class in the project is called ExConsole, and to make it just as easy to use as the standard Console class, it's also a static class - however, I'm starting to think that's not such a great idea ...
Recently I've been trying to explain pointers in a visual way, as flashcards. Question 001: This is the drawing of a location in computer memory. Is it true that its address is 0x23452? Why? Answer: Yes, because 0x23452 describes where the computer can find this location. Question 002: Is it true that the charac...
We have a use case where an AWS Lambda function is called from AWS API Gateway on user request from the browser, it fetches data from the database and returns back to the client. The amount of time taken to retrieve the data or the amount of data depends on what filters the user has selected. Do you think the Lambda fu...
Definition of Done and Definition of Ready may be very helpful in the organizations that are new to Agile methodology and Scrum framework. Must all teams share the same DoD and DoR or it can be adaptable?
I have two models Permission and Role, now in roles/create, I need to show all the available permissions to allow admin to select the permission and create a role, now should I import both PermissionRepository and RoleRepository in RoleController and pass to roles.create view or I should retrieve all the permissions in...
There is an increasing interest toward GraphQL and Falcor across the Web. Each time I see an article or discussion about those, I get reminded about SQL, at least its DQL part. Obviously, sending raw SQL queries over the wire gives the client too much power; however, with the most recent versions of DB—Postgres could b...
We have an off shore group that is responsible for a SOAP service. The service has a method that returns a key as a string, when everything goes correctly. When it doesn't the key is an error string. A short pseudo-code demonstration: var key = soapService.GetKey(username, password, moreFields); var assignments = soa...
I get a database every month with the prior month's data in it. There are three types of data: flag settings, demographic and transactional. I need to import the data into my standing database. My original plan was to just add a date field to every table and populate my standing database with the new data. As ...
I'm creating a new project usin Nestjs, which I'm really starting to like. I cannot figure out though, what the right way is for separating Business layer and Application layer. Following the tutorials on the official Nestjs docs logic is usually separated into modules. This is approach feels natural, except the same ...
I'm currently working on a C++ project in Visual Studio and can't make up my mind on how I should be organizing my files. As of currently, my file directory looks similar to the following. ->source -> game ->file1.cpp ->file1.h ->file2.cpp ->file2.h ->... -> libraries // ...
I am working on a machine learning project at the moment which requires me to transfer the data from an old Java app(which is also the custodian of the data in current paradigm) to a python service which will do all the machine learning related stuff. So, I have data to the tune of a few GBs that needs to flow through ...
I'm learning DDD and I'm wondering if it's ok to invoke domain model logic from inside the repository layer? I don't mean that the business logic exists as part of the repository, merely that the repository calls the business logic of the domain model. I've been reading a lot about DDD and it seems that the Service lay...
I am working on introducing unit testing to a class in my project which is responsible for verifying customers according to a specific criteria. For clarity, let's say one of the methods in my class is shown below: public static MyCustomStatus IsCustomerVerified(int OrderId, int customerId) { MyCustomStatus result = ...
I have a group of classes (let's say B,C,D,E) that basically represent specific operations a user can execute. I would like to have a single point of access for creating these object and launch their executions. My first idea to accomplish that is to create another class (let's say class A) which will hide the complexi...
Let's say I'm maintaining a piece of software that I version following the semver spec. I am also maintaining a docker image for said software, tagged with version tags. What do I do if I need to publish an updated docker image even though the underlying software hasn't change? Maybe there is a security issue in the ba...
In our solution we have a couple of projects, a project for data layer, service layer, business layer. etc. Inside the business layer, we use models to transfer data from classes to classes. Is it good practice to make these models and all their properties, methods and constructors internal? I just realised, if a class...
This question relates to a somewhat more specific case than the one discussed in How can I create a RESTful calculator? It should be assumed that the values to be calculated are not simple integers, but large and complex puzzles. Such a puzzle can also contain several subpuzzles. Both can be stored/read as resources on...
I have an angular 8 application, with a Python + MongoDB API on the backend. At present, I have 4 collections, namely: Users, Tasks, Companies and Groups. All of these resource types are retrievable via the API on their own routes. In all collections except from groups, the objects reference at least one object in anot...
The gateway uses Rabbitmq with Masstreansit to send commands to services. Some of services require event sourcing in their internal architecture. Since I need my aggregate states available, and the system requires speed, The actor model seems to be a good fit, but require to deal with a couple of issues: The actors sh...
In my current project, I am trying to implement an environment to perform simulations of different workflows in a range of programs, websites, and mobile applications. These simulation subjects can run in different environments, such as inside a docker container, inside a virtual machine, or on a remote physical node, ...
Lets say I have the following interfaces // used by generators and other read only systems interface IRealmProvider { Tile GetTile(int x, int y); } // used by interactive realms that can be modified interface IRealm : IRealmProvider { bool SetTile(int x, int y, Tile tile); } // used by realms that have a fixe...
I am currently making a game project that will have players play together. And i am basically planning to do it by only sending player inputs and have each client run the simulation on the pretence that the math will be fixed point throughout. I am wondering if algorithms like A* path finding needs fixed point or are ...
When everything seems to be a collection, how do you enforce rules for members of said collection without the use of an interface? As far as I am aware, in languages that don't fully support OOP features (like JS) you cannot control that each member must either be of certain type / return a certain type / structure. It...
In a Service Oriented Architecture, is it a violation of its general philosophy to have a service that is responding to a request put another request on the service bus to fulfill said request? Or should the original request have the dependency provided so that the service can handle the request without putting another...
If I want a function to be idempotent, is there any framework, language or extension which can allow me to just mark the function as idempotent and the rest will be taken care of behind the scenes without me actually manually making it idempotent? I believe it could get quite tricky to accomplish a general solution lik...
I am using the fetch api in my handleSubmit function in a React component to post data like this: handleSubmit(event) { event.preventDefault(); var error = false; var { username, password } = this.state var mailFormat = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{...
Consider a table of m columns where columns represents some smooth functions with potentially some minor noise. Each function is given for the same set of argument values. However, the rows in the table are ordered from smallest values to largest as opposed to each smooth function being in its separate column. For exam...
For a project I'm working on that will help people learn Spanish, I would like to create a standalone service to handle the retrieval of data about words. For this, I've captured and codified data for a few thousand words from Wiktionary. Currently, this is in JSON format, but I intend to put it into a PostgreSQL db....
I am working on a Typescript library (to be used by many users within my org, possibly open-sourced) which provides access to some remote storage. I am contemplating between several variants for the main methods. Let's take the "query" method as an example. Here are several alternatives for its signature: // alternati...
Problem domain: There are different types of financial products and I am trying to simulate them in different scenarios. Each of the product types requires different input data. Suppose the input data are organized with a database table, then the input data for a certain product may have its own total number of column...
we are tackling the domain of https://en.wikipedia.org/wiki/Factoring_(finance)[factoring][1]: Factoring is a financial transaction and a type of debtor finance in which a business sells its accounts receivable (i.e., invoices) to a third party (called a factor) at a discount. we are facing a major re-engineering of ...
I'm reading a book in Design Patterns, and below is some code example used by the author. The author tries to build a html builder as (code in C#): public class HtmlElement { public string Name, Text; public List<HtmlElement> Elements = new List<HtmlElement>(); public HtmlElement() { } public HtmlEleme...
I am new to UML and I have a best practices question. I would like to model separately: logical architecture: logically interconnected software components; physical architecture: physical installations of operating systems with possibility of physical interconnections like Ethernet; mapping of one to another, modelled...
I am confronted to a question regarding synchronisation between threads having shared data. This is a stripped down versino of my class : class Foo { private: boost::mutex m_mutex; std:vector<float> m_data; public: void update() { boost::mutex::scoped_try_lock tryLock( m_mutex ); if( fal...
We are a software development company with less than 10 employees. Each employee may be a part of multiple projects. Also, the project manager may look after multiple projects as well. We use Azure DevOps to keep track of work items in each project. The problems we face are Because we don't work on only one project, ...
I'll come straight to the point. I'm trying to create a Recursive Descent Parser in C++ for a hobby project which involves creating my own minimalist programming language. One thing that puzzles me, though, is a dilemma about global variables. Clearly recursive descent requires me to implement multiple functions for ea...
I did a couple of simple projects following Anemic Domain Model . Now I am trying to do the similar type of projects in Rich Domain Model. But I am confused in implementations. Previously , I used to have a domain model, entity and all of its logic used to reside in Services and persistence was made through repository...
Say I have BusinessService & domain logic as part of MyProj.MiddleTier csproj which connects to MyProj.DAL DataRepository via interface IDataRepository. I am using IOC unity container to build my dependency object graph. Composition root and BusinessService are all part of MyProj.MiddleTier (BusinessService is WCF base...
I'm considering refactoring some Java code that passes around objects that implement the interface Map<String, Object>. The strings are all (as far as I know) from some fixed list of string literals. But as I said, I don't know which particular strings are used. I think it would be better if the Maps used an enum for t...
The problem that I am chewing on comes from parsing, i.e. constructing objects in a sequential manner. The grammar is not prefix free, that is, there are more than one syntactical elements sharing the same sequence of terminals at the beginning. To condense it to a simple example, lets say we have foo = "bar" ";" fo...
It is a common approach to use specialized exception types to indicate exceptional results of a method. These exception types are not considered to indicate a programming flaw, but, as I pointed out, are intendend to return exceptional results. Let's assume the following base class: public class MyCollection { privat...
We are planning to move into Microservices. Currently on the design talks stage. Thinking of how to versioning the releases? Let's say we will start with 10 microservices. We want to develop them and deploy separately. Possibly every microservice in different point in time. Then, when tested, each of them will become r...
I know the question is a bit broad, but will give it a try. I newly joined a backend team in our company that is about to release an app to external users, I noticed we don't have an operational plan, just basic monitoring and alerting, but I don't know how to come up with that plan. I have some ideas but I am sure the...
I am trying to get some preliminary insight into the pros and cons of using either a hybrid model (jsonb document-relational) or an all jsonb document store model for customer data in PostgreSQL. Both models would key to non-changing relational tables for non-customer specific information. I am new to database design, ...
I recently found Googles pytruth package. I am very used to pytest and I am wondering what the value of the way less commonly used pytruth is. The only reason why I didn't directly discard it, is that it comes from Google. From the README, it seems to be mainly (only?) that you have the following ways to write assertio...
I found this question about sub systems & UseCases, just I lack understanding / mapping to my specific situation. I want to model which sub component fulfills which UseCase realized by my system component10. (I use sub component and sub system simultanously - mistake?) my pov I show first my component diagram: there ...
I am working on a project in which I am following clean Architecture from Google ... and for making code testable I am following an approach in which,I am creating a new ViewModel Class ViewModel Factory Dagger Component Dagger Scope for every single screen which makes it independent from all other classes which is G...
I have an Azure SQL database with 20 million + records that i need to manipulate (including joining other tables, etc) before inserting into Azure Search. The procedure needs to be reproducible in case i need to rebuild the Azure search index. Some of the data in the search is quite complex i.e. a json model. The routi...
Back in the 2000s a colleague of mine told me that it is an anti-pattern to make public methods virtual or abstract. For example, he considered a class like this not well designed: public abstract class PublicAbstractOrVirtual { public abstract void Method1(string argument); public virtual void Method2(string argu...
I'm working on a website using server-side rendering approach. I'm using React and Redux for this. Redux handles the state of the application and provides API to change the state. All asynchronous data fetching is done via Redux. The problem is that a URL may be like example.com/news/:param where param is some dynamic ...
In our environment, we often have to import CSV files into a database, where each line represents a record. Though there is no actual business use case for storing the original line numbers inside the record, I noticed that storing them helps for debugging or tracking back certain records. So does it make sense to make...
I am new to the concept of DDD (with CQRS) so please, bare with me for this moment. I understand what are Aggregates, Entities, Domain Events and Commands but I really have a terrible time comprehending the relationships between them. My questions are: Does a Command, well, command an Aggregate to do something? Or does...
When a major data structure has been changed in an app, what is the best way to handle such kind of errors in the front-end side so that the app doesn’t break? For example, we have a list of users that used to have this structure: user: { firstname: “John”, lastname: “Doe”, // … some other properties }...
I have these concepts for a database application: Session, Subsession and File A session can have multiple files A session can have multiple subsessions A subsession can have multiple files A session and subsession are completely different concepts, they don't have much in common so they cannot be merged into one tabl...
I have a REST API where authorised users sometimes need to make changes to data about their company. For the most important information (e.g. IBAN details might fall under this category), we need to implement additional security checks before actually allowing a change to occur. The aim here is to ensure that changes a...
This question is different from What are best practices for testing programs with stochastic behavior? be cause it's particular to Regression testing. We are building a chat bot, and for regression testing, we are planning to run the new system through all the conversational data that we have received till date. Then ...
I am fairly new to database design and now trying to build my own forum-based application. The app will have nested categories as countries > systems > levels > subjects In every subject category, user access the same type of data e.g. user can post and answer a thread, can reply to each answer accordingly (Just like h...
We have an app that receives a web service request, processes it and sends it back to our client by another web service call. There is a unique field in the request, a tracking Id, which currently follow the pattern [A-Z][A-Z][-][0-9][0-9][0-9][0-9][0-9][0-9]. It is better explainable with a sample in that format, let'...
Case: Several methods with same params validation inside, like: public Response method1(...params...) { if (someCondition) { //do some stuff with side effects ... return Response1; } if (someCondition2) { //do another stuff with side effects ... return...
Let's say process A has an exclusive lock on some shared resource. Is there a way to ensure that after it completes execution, Process B will definitely get the lock (as compared to say, process C being able to get it)? I am coding in a language that is relatively less used, but didn't want to limit my question to a la...
I'm trying to design an API for an object manager that registers and retrieves different related objects. When I want to retrieve an object, I can query it by its object id. I'm wondering if I should be returning a smart pointer or a reference in this case. Here's code to fully illustrate the design and some associated...
I'm mainly a mathematician, and I am currently doing research into something that I would need to compute. Using basic Octave or Python commands makes the application unresponsive. However, I have seen instances of where computers (even mine) can run such computations over time. For example, the Prime95 software from ...