instruction stringlengths 34 36.1k |
|---|
Say for example, in this mock bank ATM app solution, I have 3 projects:
UI Console
Domain Model (POCO)
Persistence (Entity Framework for CRUD)
Domain Model (POCO): I have 2 classes
public class BankAccount
{
public int Id { get; set; }
public string AccountName { get; set; }
public decimal Balance { get;... |
I have PERSONS entity and I should add ASSIGNED_LEVEL (INT) field to it and keep the history who assigned the level, when assignment was done and what documents were used in the assignment.
My proposed solution is to add ASSIGNED_LEVEL to PERSONS entity and then use after insert/update triggers to fill automatically PE... |
Assume I have an Ingest object that will only work with objects that implemented the MyInterface interface. The ingester takes all the said objects but our language does not have complex return types, as such, these objects, when implementing the interfaces, can only be "forced" to implement basic return types. Our int... |
I'm still learning C# and best practices around it.
Consider this block of code
public class Counter {
private int _value = 0;
public void SetValue(int x) {
_value = x;
// Validation check
if (_value < 0) _value = 0;
}
public Counter() {
_value = SomeSingleton.Instance... |
tldr: In building a platform where users can create private groups, and invite other people to those private groups, how is it be to secure those groups?
I'm building a platform around private groups and communities. I'm not really sure on what is the most suitable pattern/mechanism to secure groups so only those invit... |
In the classic 3rd party shopping cart, you create a pending transaction with the amount, redirect the user to the 3rd party shopping cart, they complete payment, and then they are redirected back to the calling application.
Let's say the calling application handles its own catalog, and tracking items the customer has ... |
As far as I understood, synchronous messages will be handled one after another.
Then we have the interaction operator for combined fragments called "strict" which states, that the operands inside the fragment should run one after another.
I can't see the difference to the normal behaviour with synchronous messages.
... |
I am using PlantUML and it unfortunately does not support qualifiers on a class. I simply want to show in PlantUML that a Task has a qualified association to User through the Task.userID property.
A link to quick explanation of Qualified Association
Here is a simple snippet of the two classes which can't be associated... |
My research team and I are using Git to manage our various scripts and notes/publications for our on-going projects, and I'm wondering about what is considered best practice for the situation we are in.
Until now, the scripts we were using were fairly small and did not require too much computing power. We were usually ... |
I'm expressing my frustration here somewhat, but why do many new libraries only have asynchronous APIs? For example I'm creating a small utility to fetch a web page and parse some data from it. However, making use of HttpClient from the System.Net.Http namespace in .net core requires a lot of async and await boilerpl... |
The fifth concept in the SOLID principle is the dependency inversion principle. It is heavily related to dependency injection, and Inversion of control, and when any of these concepts are mentioned, they are often used in a way that makes them synonymous with each other. Example:
Autofac is an addictive Inversion of C... |
I am trying to design a system where a Product can only be sold while inventory is available. This is an e-commerce platform where users can buy specific products with designated inventory. A similar example would be someone purchasing a seat in a movie theater. No two people could ever get access to the same seat at t... |
Scenario
After having written an integration test in in JUnit 5, that executes the compiled project.jar, I used to manually compile the project after modifications, then manually execute the integration test. However, it is part of an click once installation, which automates the project compilation and execution using ... |
I'm having an issue with a junior developer bikeshedding PRs. They are the primary approver for one repository. Things that should be up for an hour or minutes on PR spend days sometimes with back-and-forth comments.
An example from yesterday: I added an artifact to our build system. One line change. Get three back-and... |
I want to model an XML schema that has the following composition relationships:
A can contain B, and in another case B can contain A.
Using a bi-directional composition is not an option here as it is not allowed by UML and does not reflect the two different cases of inclusions.
Is using two compositions, as the followi... |
I am trying to apply Domain-Driven Design here in this bank ATM mock app.
I have 3 layers at the moment:
Domain Model Entity layer (Pure POCO classes)
Persistence layer (Entity Framework)
Console UI layer
In Persistence layer, I have RepositoryTransaction class which perform CRUD operation.
namespace ATM.Persistance.... |
Variables in JavaScript are lexically scoped. But, I wonder, is the this keyword, referring to the receiver of a method, an example of dynamic scoping. Or is this unrelated to the lexical/dynamic scoping discussion?
var foo = { x = “how am I scoped?” }
function bar() {
console.log(this.x) // the free variable this ... |
In his DDD book Evans promotes the idea of layered architecture, and in particular that the business logic should be confined to domain layer and separated from UI/persistence/other concerns. He also introduces Repository pattern as a mean to abstract access and persistent storage to Entities and Value Objects. To me t... |
Say a dictionary belongs to a language. For the endpoint dictionary/{id}, which is preferable out of:
{..., 'language_id': {id}, ...}
and:
{..., 'language': '/language/{id}', ...}
?
|
I have dynamic IP provided by ISP. Say IP is x
I type google.com in browser. Http request goes to google server
IP changes to Y.
How does http response comes back to my laptop/broswer when IP changed from X to Y ?
Does google continue to send to X and NAT layer in b/w play the role of switching it from X to Y ?
|
Our main product is written in C++ MFC and follows the same code standard as MFC.
Now we will start to develop new components, and think about whether we should continue to use the same outdated standard, or whether we should write it with modern C++ according to modern coding standards.
The disadvantage is that ther... |
I'm working with a C# API Wrapper project that is entirely flat, meaning 1 project and namespace for all the files. I'm attempting to put the Models into a separate Models project, but I've hit a design snag.
The Model classes all have a static Parse method for loading the properties of the Model from the JSON.
Ex.
pub... |
Preface
I'm currently building a very small scale platform I plan on bringing into a trial-production phase here within the next month.
As of now, it's just a simple web application. It contains things like:
Users/Profiles
Commenting Systems
Posts created by users
Nothing too astounding or complicated. I have more fe... |
I'm looking for a bit of guidance or someone to point me in the right direction.
I have a C# WPF desktop application which accesses a local SQL Server Express database. The application is on a single computer with a generic login and not connected to the internet.
Users enter a username and password to log into the app... |
I would like to ask for help with activity diagrams in EA and decision block (branching).
Lets assume we have simplified activity diagram with decision block "Is working day today?" with 2 branches "Yes" and "No".
Lets assume that we need to change it to "Is working day or saturday today?"
I am supposed to add to the ... |
I had asked a question here, and someone had recommended that OrderLine be a Nested class within Order Header. Is that a standard practice in Domain Driven Design, or more one of many debated methods of conducting DD, with nested class? Just want to validate if this is industry wide practice recommended from DDD Autho... |
In our Ruby on Rails projects we use a linter for our slim templates: slim-lint. It doesn't support any automatic fixes, not even the easiest ones. So I'd like to abandon it because I don't like to go line by line through the report and fix small things in the slim templates manually. After all code formatting tools sh... |
Currently I'm working with a lot of modules where the original developers used global variables to control states and to exchange important information between functions, like so:
STATE_VAR = 0
def do_something(arg1):
global STATE_VAR
if arg1:
STATE_VAR = 1
def say_hello():
if STATE_VAR:
p... |
Suppose I have a entity called Appointment. This entity represents an medical appointment between one Doctor and one Patient.
To create a new Appointment, I send somethind like:
POST /appointments
{
"doctorId": 98173821,
"patientId": 2138212,
... omitted for brevity
}
Works well.
As you can see, this object is n... |
The specific scenario in my case involves PayPal but it could easily be any other external system.
According to a lot of sources on the Internet, including the official documentation, a basic PayPal integration (say, for an e-store) would look like this:
Call the PayPal API to execute the payment for an order.
Save th... |
I am working on a microservice architecture using CQS and with domain objects built using DDD aggregates. I am just beginning to learn about CQS, CQRS, Domain Driven Design, so excuse me if what I post is completely wrong from either perspective.
Currently, the architecture within a microservice is as follows:
Write si... |
In my code let's say I have a function which does most of the work:
def compute(x=3, y=5):
...
And I have a CLI wrapper program using argparse. I intend end users to use the CLI program and not the function directly, but also other developers may work on the source code. Argparse has the capability to add default ... |
I have the following interface, it defines a loadable resource that depends on other resources that should be loaded first so it can load itself:
It does its job, the Find method allowing to search for a particular dependency for Load method.
Now I have another problem for which I haven't found an elegant solution for... |
You are given an arbitrary function f. You may invoke it with arbitrary parameters and read the return values, as well as record any exceptions it raises, but you may not read its implementation.
How would you go about writing a function g that replicates f's implementation?
Note that by "function" I do not mean to res... |
In my project, I found one of the project's classes reusing the same name as an official one.
For example:
from django.db import models
class Model(models.Model):
class Meta:
abstract = True
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
I ... |
I just started my internship as a computer science student. The project I'm working on is web based price calculation. Previously, the price calculation have been done in a quite huge excel spreadsheet, taking a ton of factors into account when calculating. My first thought when tasked with this, was to study the sprea... |
Background
Our users can have a single role per account (internally an IAM domain), but may have roles across multiple accounts.
Each role is defined as a list of permissible actions.
Problem
In certain cases such as failed payments or suspicious activity, we'd like to limit some of their actions.
We can also imagin... |
I want to make three layers of application all served through Rest API.
For a user case we can say it's school management system where there could be multiple schools where the teachers are administrators of different classes.
Super super admin:
Is the service provider (me) creating the account for the schools which w... |
I have a static class that performs xml serialization. Is it better for the static class to be responsible/implement for converting objects of type foo to their proper xml representation or to have foo implement its own foo.ToXml() method? The conversion just transfers information regarding foo into a data class with c... |
I have two systems (for sake of example, and orders and an account domain). Their interfaces consist of an api per system (an orders api and an account api).
I have a UI that is sitting on top of both of these services. This ui provides search functionality, which provides visibility into both domains. The problem I... |
I am currently creating an Android application and I have the following questions:
We have a server which provides data for the app in form of a REST-JSON-API. The App is following the MVVM architecture. Now my question is: When should we fetch data from that server? We could fetch all data at once when the user reache... |
I'm a Rails developer and I've always had this doubt, let's say I have to develop things for the user's controller and views (branch feature/users-endpoint) and imagine I end up developing several helpers (sorters, paginators, etc.) and concerns to modulate the code a bit. Then let's say I have to do the admin's contro... |
This is maybe a strange question, but I just trying to understand my colleague.
I know what is DTO, and what should be on it, but not that long time ago I found the whole micro-service written on the way where all DTO classes had just protected properties with public methods that throw *DTOException (there are multiple... |
We are currently working on a Xamarin Forms (.NET Core) application. We use Microsofts DevOps for the code repo, building and deployment.
Since we want to test newly developed features in a safe testing environment, we need to configure the app before building. At the bare minimum we need to swap out the backend uri (e... |
I am currently on the decision, whether to use interfaces throughout my whole spring project or not. I scouted some open source projects and saw, that many big projects are handling that quite heterogenously. All the big sample Spring apps aren't really doing that, although I thought that this would quite improve maint... |
Like for example, /api_1/login and /api_2/login writing in the same table of the same database.
|
I am having a lot of trouble understanding the logic behind the infamous "Find total ways to achieve given sum with n throws of dice having k faces" question. After extensively searching for explanations, I have come up blank.
My confusion stems from the fact that it does not seem to follow the same logic as the "nu... |
In Domain Driven Design, should the specification pattern for paging/pagination exist on the Repository level or Application level, or another layer? Trying to see what Eric Evans author of DDD stated. Then I can implement the code in correct layer. Sample code below.
Paging meaning, example have 100 products, and want... |
As far as I know, most "serious" VM implementations, such as CPython and the Oracle JVM, do not request new memory from the operating system ("malloc()") each time they create a new object.
As far as I understand it, these VMs usually request a large chunk of memory once, and then manage it internally for allocating ob... |
I am using unity in C# to achieve dependency injection and inversion of control.
What if I have a class, let's say a viewmodel, that depends on several services like a repository, a validator and a log BUT its also dependent on just a simple list of data
objects. So I would have a Constructor like this
ClientVM(DB... |
Tiled images
Tiled images are large images that have been split in smaller square tiles.
There are several tiled image formats, with different ways of organizing
the tile files.
A tiled image on the web can be downloaded only by finding all the individual tile URLs, downloading them, and stitching them back together.... |
I am working on refactoring codebase for a JAVA API thats used by multiple clients. Though the api provides the same overall functionality for all clients, actual flow changes a little bit between some clients. Two major examples are old clients using older version of dependency services and some functionality applies ... |
Which layer should hold pagination information? (Page Size, Page Number), Eg say 100 products, 5 product per 20 pages.
User can type in API url layer.
api/Product?Page=1&Limit=2&ColumnSort=Name
Our current architecture is this:
DomainClasses --> (Domain Repository Place in DTO) ---> Business Application Layer --> (A... |
I'm interested in knowing what is a good way to architect a system that can act differently based on the subclass being passed in. I assume polymorphism is the least computationally intensive.
I'm going to paste some short, functional code. The Program class is the same for both snippets. I deliberately left out Interf... |
I saw a lot of discussion, but I don't know how to do it in a real world.
I understand that validation duplication in the client and server is needed.
But how to elegantly validate in server and return friendly messages to client.
I have a value object like this, it has some business rules.
public class OrderId : Value... |
In my Springboot project I need to perform a validation of the type validFromDate<validToDate.
I was wondering whether would it be a good or bad practice to place a validation in the model itself (pros and cons?) or should it be in the controller which feeds the value in model.
I have taken reference from this questio... |
I am new to mobile development.
As i understand the best way to authenticate/give authorization to a user is using OAuth2.0 with the social providers as Facebook, Google ect ... When we enter the credentials the server returns an access token which is stored in the device so we do not need to re enter every time the cr... |
I'm creating a chrome extension which needs a large local database.
After researching my options, I figured my best bet is probably to use the chrome.storage.local API and give my extension the unlimitedStorage permission.
As far as I understand, this API lets me get and set individual objects referenced by a key.
I ne... |
When I was looking this question, a question comes my mind.
Think about using an interface like :
public interface ICommandProcessor<T> where T : ICommand
{
void Process(T command);
}
When you think about just interfaces, is there any advantage over direct using? Like :
public interface ICommandProcessor
{
voi... |
If logical not ! will switch a boolean value from false to true or true to false and a double not !! will cast a value from one primitive type to boolean is there any reason one can not use a logical not with a double not to create a triple not !!! to cast a value to a boolean and then switch it!?! Is this what creates... |
Had a discussion that i felt i needed some external input on. Normally always use interfaces instead of concrete types (on lists, injectable services and so forth). For example in lists i just pass around IEnumerable instead on List and so forth. The same applies for custom types (ICustomClass instead on CustomClass). ... |
Good day,
Please help me solve the dilemma. I am trying to write an e-commerce engine relying on DDD.
Problems associated with two aggregates, ProductType, and Product. Product is a classic product like in any other system with the exception that it can have a different set of additional properties.
Features and compos... |
I'm working on a new project. It is a smartphone application made with react-native. In the app, you can create "cards" which are having a title, a description and a photo, taken by the user's phone.
I will use a SQL Server database, hosted on Azure and I'm currently working on the REST-API whit ASP.NET core with the E... |
Say I have a controller
public function someAction(){
$something = Helper::something();
}
And I have a test to check Helper::something()returns/does whatever it should.
Down the line I refactor someAction() to not need that method anymore (and for arguments sake it's not used elsewhere). When I run tests/coverage,... |
I want to follow the MVVM app architecture. I also need to have some communication between some fragments. But the official approach is pretty confusing.
Taken from the docs (https://developer.android.com/training/basics/fragments/communicating):
"The recommended way to communicate between fragments is to create a sha... |
After recent years working mostly with SLA, Incident Management and ITSM, I'm considering moving back to software development management and agile methodology. I'm returning to SCRUM lessons and would like to learn another framework alongside. Considering Dynamic Systems Development Method (DSDM), is it industry releva... |
I would like to collect feedback on possible solutions for creating testable classes/interfaces.
In a normal C++ development we can use references/pointers and forward declarations to achieve dynamic polymorphism (see "Solution with references" below).
However, certain types of embedded software have constraints that p... |
I am recently having a discussion with colleagues about where should a piece of code reside within our django project.
For the sake of the question, let's say we are creating APIs for uber-like quotation feature
We have the following modules(an app in django's lingo), each concerns with persistence, business logic and ... |
I am trying to separate my domain model and associated business logic from my persistence model, particularly such that the domain model has no dependency on the ORM. One apparent way to do that was to make an ORM-coupled subclass of my POCO domain model object, with persistence layer specific properties and logic in t... |
Should documentation be added for constructor parameters that are passed via dependency injection? In my current project I have decided to omit documentation to describe each of these parameters and my reasoning for this is as follows:
These constructors are not meant to be called by a developer (outside of unit testi... |
An application App-a I maintain publishes some events to an event bus for other team's application App-z. So far, the events were published right after being generated.
Now, I need to delay events ~30 minutes before publishing them. This is fairly easy to implement, but my concern is, that when App-a shuts down (restar... |
I am trying to make a system where a user can view/download his statements (say salary slips). The user will have ability to download PDF versions of these statements and can also save them to Google Drive.
I had some questions regarding Authentication and the Architecture of the application.
These are the components o... |
I'm building a web app, where users can create locations, which are displayed on a map.
Also, users can click on the map objects in order to get to a place details page where further interactions with the server can be done.
Users also can delete the places they added on the map and this could happen pretty often.
Al... |
Say I have total RAM memory of 1GB , HD of 10 GB with 250 MB swap space
Say I have two files(f1 and f2) each of 500 MB opened on my my laptop. Now both files are in memory and have consumed 1 GB of RAM.
Currently f2 is in front of me. Now I start writing in f2 with 100 MB of characters.
Now will OS will swap space he... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.