instruction stringlengths 34 36.1k |
|---|
Currently we have an application that, upon certain events, will send notifications to users. We use SQS to handle the actual delivery of the notifications.
As an example, when a user registers an account we will create a new push notification task (put onto an SQS queue) that will send them a push notification using O... |
How exactly should AddSomething methods in aggregate roots look like? Should I construct the objects in a call to the method, or should they be constructed inside the method?:
For example:
public void AddOrderItem(int productId, string productName, decimal unitPrice, decimal discount, string pictureUrl, int units = 1) ... |
So i heard that in modern operating systems and device drivers, some parts of them are still written in assembly for better memory optimisation and speed
but do developers actually write it in assembly or they just use a tool to convert their high level code into assembly?
considering that compilers even have code opt... |
Consider this an "academic" question. I have been wondering about about avoiding NULLs from time to time and this is an example where I can't come up with a satisfactory solution.
Let's assume I store measurements where on occasions the measurement is known to be impossible (or missing). I would like to store that "em... |
I have a mobile app and an API. The mobile app is set up to expect back a DTO from the API but has no information if an request was unsuccessful.
This needs to be updated so that better messaging is displayed to the user. I need to update the API and Mobile App so that I can send back a
DTO on a successful request or a... |
Suppose a SaaS product charges per project, whereby the first project you own is free. Ideally, users would open up a project and invite a few members to work on it. If more projects are needed, the same user within a team would open up another project which then is charged for.
With above restrictions, nothing would ... |
I am currently researching the benefits and disadvantages of SPA (Single-Page Applications) vs MPA (Multi-Page Applications).
Having established that MPA is more suitable for my project, I proceeded to discuss Server-Side Rendering vs Client-Side Rendering.
But as I was doing that, I noticed that a lot of benefits, arg... |
I am building an app that uses a client and a project entity.
The clients can extend their profile over various screens in their account, like status, settings, etc. These data sets are saved in seperate database tables by a WordPress plugin.
Now I need a way to display these user related data sets in the frontend.
So ... |
I have read several post about how to give credit in open source projects, but none that target my question.
I have been working on an open source project for about a year now, and one of my latest editions has something that hasn't been implemented fully in any language (to my knowledge...). An author from a very popu... |
In what seems like a deliberate design decision, C++ does not have a null value for objects and references. This makes using objects and references very elegant since we don't have to perform null checks. It also means constructors must always return an object:
void main () {
// o is guaranteed to be non-null by c+... |
All,
Question: Should I have a common data access API between various cross platform applications or keep the data access specific to the UI even though it would result in duplication?
Background: I’ve been developing various applications many with sub applications to interact with various pieces of our internal servi... |
In our automated Java tests, we sometimes encounter issues, such as:
Test A creates a custom file A.sh, that is then added on classpath
Automated testsuite cleanup does not know about random file A.sh, and does not clean it
Test Z fails because it so happens that A.sh has no influence on all other tests but causes fa... |
I work for an ecommerce site and we are looking to expose much of our core functionality via a set of APIs. We plan on re-writing some of our own public facing websites (e.g. the main shop website) to call these new APIs also. Currently a lot of the core code is found directly in the main web app (making it difficult t... |
Can you do everything that CSS Grid or Flex box does with properties such as display, float, margin, position, overflow, etc ?
Edit: See my comment with @PeeyushKushwaha
|
I would like to express a task as either itself or a container for other tasks (recursively). The problem is that each task has to be one of two fundamental types: a goal or a routine. And, children tasks must be of their parent's type. So, each root level task has a type, but no child has a type (it uses its topmost p... |
I have a method that inserts into the Android Calendar an event. You can see a simplified snippet in two steps: 1)declare the variables 2) I put them into a kind of array that in the end will insert it into the calendar, and it works flawlessy:
private void InsertCalendarEvent() {
//1)here I declare the var... |
I have a multi-seller ecommerce platform, derived out of Opencart 2.3. We changed quite a bit of the core code of the Opencart to add our own customizations, including features such as Seller Dashboard (where a seller can check orders, generated invoices for them, etc etc). Repetition of code and lack of basic OOPs pri... |
I have a quick question.
Imagine this scenario:
There is a webapp in server X. There is also another component (file) in server Y.
In the webapp, starting, it does:
<script src="component from server Y">
Should I place the component from server Y in the server Y, or inside the WebApp component, in the Deployment diagr... |
Lets have an application that has real-time chat feature.
The chat requires websockets in order to function real-time.
Now imagine we have "balancer" and 3 application servers. Instance of application run on every server.
The balancer delegates request to 1 of these 3 servers, for example based on traffic.
My question ... |
When working within a single project that contains multiple namespaces, should these namespaces be treated as boundaries? Or is it acceptable that any namespace can access any other namespace?
For example, say I have the following namespaces in a project called Physics
Physics.Models
Physics.Math
Say in this case tha... |
I am developing an asp.net mvc solution, which contains the three layers:
Data Access Layer
Business Layer
Entity Layer
Each layer is a project.
I have developed the controllers and views, but no Models. Instead of using Model, I am using the Entity layer as Model.
My question is: Is this still an MVC project?
I atta... |
I have been tasked with designing a class library that I am loathe to actually build. It is basically a huge backdoor to our software security. The idea was that it would only be accessible from one terminal on a closed system. I plan to lock my code with a password, but is there a way to make sure that my library bina... |
At work, we have an application that is run directly on dev machines, but deployed in Docker swarms (a QA swarm and production swarm). The code and CI/CD pipelines are all in GitLab CE.
It uses several private, internal NPM packages. We refer to these packages in the package.json like so:
"@project/utils": "git@gitlab.... |
Context: design with correlated polymorphic classes
For example, let's consider the following class definitions for representing messages that we would get from some remote service:
class ImageMessage : IMediaMessage
class VideoMessage : IMediaMessage
class DocumentMessage : IMediaMessage
The messages would arrive in ... |
Often software sites would offer signatures and checksum for integrity check after software download. How crucial is checksum(e.g md5) verification process and what other sort of security does or can these process offer?
|
I'm new in development & just developing an e-commerce platform. I'm just confuse about the flow of payment. Suppose I have a checkout page where after logged in user has to press the payment button and it will take him to Instamojo payment processor's page and the after successfully making the payment they will be re... |
Is this some rule that if I have multiple Facade classes they must be combined in 1 Facade Class?
For example, I have a Hospital System with different classes, like Appointment, Patient, Doctor, Medicine.
I created different Facade Classes like, OPD_Facade, Pharmacy_Facade, Visit_Facade, all of them are independent wit... |
I've got a Redux app with a fairly flat state tree. All sub reducers handle one separate part of the state, and they are tied together with combineReducers.
My problem is that in a few cases I need to access state part A in the sub reducer for state part B. The Redux FAQ has a section on this, with three suggestions:
... |
I've got an application where users can log in with varying levels of permissions. From their client they send a username & password to the front end, which passes it to the back end, and from there we've got a few different calls.
Assuming things go well at each step:
Check a username & password with our Identity Aut... |
Here an outline of the setup:
Input data:
I have several sources for sensor input data (GPS, and a bunch of other sensor data from different sources).
All of those individual inputs consist of a timestamp, the name of the input and the value.
There is no defined list of inputs, but new inputs can appear whose name we ... |
I know most (if not all) business logic should reside in its own layer, but what is the general consensus of putting some basic business logic inside of the repository layer itself?
My scenario:
We have a table that has a few optional columns, but should one of the columns contain a value, the other two will be influen... |
This is more of a point me in the right direction kind of question, I have 2 solutions but both of them are invalid because the data calculated is invalid in some scenarios.
I am working on a system in which a vehicle sends location readings to a TCP Server.
All this data gets stored in a Location Log table with the f... |
I am creating an Online Shopping Cart store.
It is built through Net MVC Core.
There is a Front End View website: html, css, razor.
Then we have backend code design for Customers: including shopping cart, searching, buying orders, submitting orders.
Finally, there is backend for Vendors: vendors can submit their invent... |
I have a Jersey server that handles REST requests where I've implemented a RuntimeExceptionsMapper implements ExceptionMapper<RuntimeException>. If there's an unexpected exception, it handles it by logging the exception internally, and returning a 500 with the text "Server Error". I don't want to leak any information l... |
Our company is designing a new ERP based on microservices. The reason we want to implement microservices is because we noticed that some critical parts of the old ERP are being heavily used by our customers and as we plan to grow our business in the a period of 2 years we want to be able to deploy more instances in new... |
Problem statement
dev team
Dev team wants to pre-build the SPA's (Angular App & React App) and provide single package containing JS, CSS, & HTML file. There's no server-side rendering / lazy loading also. Hence, configurations like service URL, app settings etc. have to be a build parameters. And expects DevOps team to... |
I want to write an application which monitors a few URLs (like a couple hundred) of all branches of school. By monitoring, we mean that it sends requests to those URLs at regular intervals (Interval for each URL is defined by user), and on the basis of the response to those requests, it makes some changes to the web pa... |
Given three project modules X, Y and Z on a Maven based project, and Y depends of Z and X of Y and X should not know that Y depends of Z, being this:
X -> Y
Y -> Z
X -X> Z
What is the best way to hide the dependency between modules X and Z ?
I'm aware that on Maven it's possible to change the scope of the dependency, ... |
I'm designing an API that a social network app will consume. I need to manage friend requests between users.
I have this endpoint:
POST /users/{userId}/friend-requests
{ requesterId: string }
that is called when requesterId wants to be a friend of userId. It returns a FriendRequest:
{
id: string,
requesterId... |
Software I'm working on requires simulation of logic circuits, both combination and sequential.
Now the simulation doesn't need to be too detailed, in fact it could be detrimental to the function of software, it only needs to simulate the logic itself and not properties of individual transistors, other elements and th... |
I was wondering what was the best practices in terms of collection of resource ID of different types.
My software has a service for each resource, each of this resource has a unique id (hexadecimal like 3dbea72) of their type.
tomato
potato
carrot
I want to create a new service to manage a basket of those resources.
... |
I'm struggling with the design in a WPF MVVM application. In a few courses I've taken, they say that having a lot of parameters in a constructor is a code smell, but they never address how to deal with it.
In a recent project of mine we used dependency injection to provide services that follow a data adapter pattern. ... |
Here is a high level outline of the project:
We frequently need to convert data from a new incoming system to our in house system (sort of a basic ETL process)
We would prefer to do this dynamically, allowing an analyst to use a GUI to map source fields to target fields and define basic transformations
The basic flow ... |
I'm wondering what the best practice would be for the following task:
I start a program on a remote node, which will generate subsequently new files
in a publicly accessable folder.
Whenever a new file is created on the remote node, I need to transfer this file
to another node, say local node / client immediately.
Plea... |
I have a simple class (details here)
namespace MemoizerSupport {
template <typename T1, typename T2>
using DEFAULT_CACHE = LRUCache<T1, T2>;
}
template <typename RESULT, template <typename, typename> class CACHE = MemoizerSupport::DEFAULT_CACHE, typename... ARGS>
struct Memoizer {
Memoizer (const function<... |
My team is discussing using RabbitMQ for microservice to microservice communication (among other things). We are also supporting a SAP backend that will be pushing data to us in a method undecided at this time (likely through Boomi or Idocs). We know next to nothing about RabbitMQ, except the general concepts of a me... |
I have a controller action which gets all the Plants by location from the database puts it inside a view model and passes it to the view.
public ActionResult index()
{
List<Plant> plants = Context.Plant.ToList(data => data.location = "Canada");
PlantsViewModel plantsViewModel = new PlantsViewModel
{
pla... |
I am the new developer - this is my first programming position.
My issue is this: We use git - I cut a branch from our develop branch, then I start working on the minor task I've been assigned. It's very slow, because I'm inexperienced. By the time I'm ready to merge my branch back into develop the others have made so ... |
I'm building an app with the usual layers like presentation, application, infrastructure. Right now, I have been using WordPress functions in both my controllers and repositories. I figured that controllers need to be re-written anyways should the framework change, and repositories are part of an implementation (like W... |
I'm working on a system where we consistently apply "patterns" or approaches such as Dependency Injection.
I'd rather not expose the current underlying technology as not to get biased solutions, because I think my question would apply to many different languages and runtimes. It suffices to say that I'm using an Object... |
When reading about software deployment/release, I see many people referring to an idea that Wikipedia calls "deployment environments".
The deployment environments of Development, Test, Acceptance and Production are referred to remarkably consistently, but I can never find references that point to an origin.
I've tried ... |
I found in a book (Learning PHP Design Patterns, Chapter 2, page 25) a text explaining the importance of interfaces in OOP design. The author ended up by giving this example:
<?php
interface IConnectInfo
{
const HOST ="localhost";
const UNAME ="phpWorker";
const DBNAME = "dpPatt";
const PW ="easyWay";
... |
I have 3 ARs:
Student
Guardian
Business Rule:
Student should have at least 1 authorized Guardian
Entities should not be in an invalid state right?
Right now I enforced the invariant in my Student constructor:
public function __construct(StudentId $id, Name $name, Guardian ...$guardians) {
if ( $this->hasNoAuthor... |
I read that Repositories should not refer to other repositories. I have a method ProcessFile that refers to multiple repositories, it parses a file, and inserts into many table models in different databases.
If ProcessFile cannot be part of a repository, what should the containing class be called, or in other words, wh... |
If I have a form built on my website. How can I get that form 1 to plugin results into another websites form 2 and extract information to display on my website?
For example, if I wanted to create a form like cartagz.com for registration fees on my website romarinsurance.com so that my customers can see their Registrat... |
We have 10 applications which updates account balance table, without logging credit/debit line transactions (not sure why). They all have the pretty much same SQL Statement. In order to get out of this structure, and log transactions, We propose the following. Are there any other ways recommend to make design more opt... |
I am creating a database table that will store a single number 1 thru 16 in 2 fields (there will be many rows of data).
I'm trying to avoid duplicating a lot of data and make my dbase most efficient. Can I create a separate table with 1 column that has the numbers 1 thru 16 inserted then use this column as a foreign ... |
I read somewhere that one should be generous in creating value objects for entity properties that are part of the class API.
So I did that with my project entity/aggregate, but it still looks weird:
return new Project(
new ProjectId( $project->post->ID ),
new DestinationNumber( $... |
How do we achieve loose coupling in the below scenario:
N microservices (let's call them Callers) needs a logic or business( let's call it Worker) to be executed with different contracts. Although the contract is different, logic is almost identical and work on data stored centralized in a DB Worker is likely to evolve... |
I often run into this decision making scenario of where to call a Domain (or Application Service) when building my Domain Models. Maybe the confusion is in identifying whether this is a Domain service or an Application service itself. I would love to see what others think. I'll try my best to explain this with a simple... |
The only place I have really noticed this sort of programming style is with the graphics engines. Essentially like this:
graphics.clear()
graphics.setStrokeStyle(myStrokeWidth)
graphics.beginStroke(myStrokeColor)
graphics.beginFill(myFillColor)
for (i = 0; i < myPoints.length; i++) {
graphics.lineTo(myPoints[i][0], m... |
I have a business specific pattern for storing their IDs. It's in the format of yy-mm-autoincrement.
I could just store date and incremental id but there's another problem. It should be restarted every year.
Ok, so now having auto-increment PK is now useless right? Since it is actually not auto-incremental.
I could jus... |
I am new to looking into video file formats, and am wondering what it would take to parse one. To do that, I first would need to understand what the format looks like, so that's what this question is about.
Wondering if one could briefly outline how a video file format is structured, or what it contains. Any video file... |
I need to implement product search using Elastic search similar to it is done on any scalable ecommerce site.I am planning below algorithm
for this
Whenever product is added to system, First add it in DB and then in ES server. ES will create the index on document provided to it and then keep both index and document i... |
So by day I work in healthcare and by night I code. When I am at work I can't help but think how much time a functional text editor should help my job. I am constantly writing documentation that has similar elements and constantly breaking the DNRY rule.
Could I do a work around where I create my own syntax/'language'... |
Is there a general coding convention in ordering namespaces? Is it always order of importance, or alphabetical? Currently I order by main important ones first. I know it does not affect program, just curious about coding convention.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threadi... |
Are there 'conventions' / best practices on naming pure functions?
For example:
adding numbers: add or sum?
calculating the square root: calcSqrt or sqrt?
reversing a list: reverse or reversed?
sorting a list: sort or sorted?
What drives such decisions? Is it a matter of brevity? Does it depend on the inputs, outputs... |
I have an EF Core data layer and i want to wrap it around an interface to separte it from the business logic.
Now the issue is that i am not sure i am doing it correctly.
First, i was just using static context to be alive all the time but that seems just wrong to me.
Should i create a new instance of context for each ... |
JuliaLang just hit version 1.0 the other week
I and many other package maintainers have thus updated out packages to work with julia 0.7 (the transitional release) and 1.0.
In doing so, we've often created a backports branch where hot-fixes and other backported features can be made available to users of julia 0.6 (the ... |
Reading Head First Design Patterns. I came to the chapter 3, the Decorator Pattern,
Decorator Pattern is very clear for me. but one of the "sharpen your pencil"
Our friends at Starbuzz have introduced sizes to their menu. You can
now order a coffee in tall, grande, and venti sizes (translation:
small, medium, an... |
I have a class Document and document has a status:
public enum DocumentStatus : byte
{
Incompleted,
Completed,
Cancelled
}
Now I have a dilemma I can't solve alone.
Should Document have methods like Cancel and Complete and domain events like DocumentCancelled and DocumentCompleted
public class Document : E... |
I'm currently refactoring a class that looks (after some refactoring and very much simplified) somewhat like this:
class Foo
{
public:
Foo(bool someFlag) : m_flag(someFlag) { };
void doThings();
void doOtherThings()
{
doPrivateThings();
if (m_flag)
doFlagThings();
... |
What does rotated log file means? There is any example?
I used to see this term in logging libraries documentation but couldn't understand the meaning.
Update: there is any different from a rolling log file?
|
I am looking into the Rope Data Structure, used by some text editors like the xi editor.
I get the basics of how it works, and have seen some sample implementations such as here or here. But I am confused as to how you properly (optimally) handle "upgrading" a rope to be syntax highlighted. It seems to work in the foll... |
I am following the textbook Object oriented software specification using UML, patterns and Java (3rd edition) and I am defining interfaces between system components (subsystems). But I encountered a practical problem in the notation.
Imagine for example a component Transaction Management component that deals with tran... |
Currently working on a DDD application that is using event sourcing with redis as my main persistence store. So unfortunately I do not have built in rollbacks should something fail. The application is a monolith with 3 separate aggregate roots
The following service method will
Create my "Trip" aggregrate
Call store ... |
Imagine that you have a form with which you can edit some data, let's call it a Person form. Let's imagine that a user opens up this Person form, receives the current data that is stored in the database and starts editing it. During this time another user opens the same Person form, receives the same Person data, quick... |
I want to create a set of patterns to use for rendering a PDF Proposal (a set of PDF pages). I have made a good start, but not clear on how to proceed when more complexity is involved.
I am using TCPDF API library for PDF rendering (3rd party library). At first the way to generate the PDF Proposal was in one big file... |
Whenever I find out that a large portion of my code needs to be changed, either because it is incorrect or because it needs to be adapted to major architectural changes necessited by other reasons, this is what I typically do:
I comment out all code that I suspect I might have to change. I treat the commented out code... |
I'm implementing my own simple database with disk storage, and I'm not sure how to go about modifying and deleting entries.
The problem is that as you delete a record from arbitrary position within a file, a "hole" is left there. As you insert a new entry, you may or may not be able to plug it into the hole. Modifying... |
Currently I have implemented a simple UDP server using java sockets, as soon as the packet is received it is added to the queue and there are four consumer threads which process the queue.
This approach is fine till 10000 req/sec, but there is significant packet loss of packets as the number of packets/sec is >10000 r... |
I am have an application using MVVM pattern. It takes a user ID and returns a table with the user's bookmarks. I am trying to decided if it is better practice to include parameters in my model's methods.
ViewModel:
namespace BookMarks
{
public class UserProfileVM : Notifier
{
#region Properties
... |
I don't know which is the correct way to model this requirement in OOD:
A device has many properties, each property has exactly one device parent.
There are a set of procedures and a specific procedure describe one or many
properties.
From the system I need to retrieve the list of all procedures, and
for each procedure... |
I have read through A tour of V8: Garbage Collection and am stuck on this part:
Distinguishing pointers and data on the heap is the first problem any garbage collector needs to solve. The GC needs to follow pointers in order to discover live objects.
I understand the rest of the document for the most part, talking ab... |
How applicable is it to adapt SemVer for content-centric websites (ie/ not web apps)?
Most of the SemVer 2.0.0 specifications able to translate into such type of websites however it becomes vagues when defining following:
What considers are 'backward incompatible'?
Modification of existing navigation?
Change linkag... |
Since there is things like BEM in naming conventions for HTML class attributes, does the name attribute have anything of that sort?
|
I have a class that is responsible for calling a service and returning a response.
The contract is like this
interface ServiceClient {
ServiceResponse process(ServiceSubmissionParams params);
}
ServiceSubmissionParams and ServiceResponse are simple POJOs that are part of the application calling the service (and no... |
Some time ago I read from this book that namespaces inside libraries should be distributed in a way that inner namespaces have more concrete classes than their parent namespaces. We can find an example of this inside the namespace System.Net, where we can find the class WebClient. This class has a higher abstraction le... |
I am posting this question here after it having been determined to be "off-topic" for stackoverflow, and "too hypothetical" for codereview.
I am experimenting with different singleton-style design patterns for an app component having to do with app-wide sound effects and speech.
My theory is that while often frowned up... |
I am translating a piece of software from an old language to c++ and am currently in the optimization stage. The software performs a calculation of loads for several items in a number of timesteps, each of which consists of several iterative loops.
My current testing case contains 400 timesteps, each with 13 iterative ... |
So I'm trying to justify my case of using ASP.Net Core with Angular in a new application, where the .NET application does little more that provide the basis for the Angular app. It's really similar to the case of having an ASP.NET MVC application with jQuery. There is also a Web Api involved.
So the two options being... |
I need to design a system where there are many micro-services which we can think of as crawlers that poll 3rd party resource and if they find some new information they pass it to some other service which processes the data and saves it in some DB.
I guess that I need to have some more component - A coordinator. To spaw... |
I'm not sure whether this qualifies as code smell, or if there may be some better way of performing the same task, but, basically, I want to format a 10 digit string, using C#, and have the following options...
Option 1
public string FormatNumber(string value)
{
int i;
if(int.TryParse(value, out i)) return i.To... |
I wrote a websocket server in Spring Boot and a client in Javascript. These work fine. I also wrote a second client in Java. When this one attempts to handle a frame after connecting to the host, I get this error:
org.springframework.web.socket.sockjs.client.WebSocketClientSockJsSession - Transport closed with CloseSta... |
I am new to restful services and need some clarification with constructing the URI for a restful service.
Suppose the hierarchy of my data is as follows - products/types/prodids/orders.
Is this URI truly a RESTful URI:
/restws/products/types/abc/prodids/1234/orders
What I am looking to get out of this URI is to list a... |
Let's suppose we have to entities, X and Y where Y is part of X, being this:
class X {
private int fooX;
private List<Y> fooY;
}
class Y {
private long barX;
private int barY;
private short barX;
}
Wanting to transport data from a service to a different module, where the data relies from X... |
I'm currently working on updating some old projects (inherited stuff) and I keep running into various small issues with the architecture. Namely monolithic classes too tightly coupled.
One example currently is a giant "results" object that looks something like:
public class Person
{
string Name;
string Address;
... |
I have been having trouble clearly defining/specifying how a URL/URI should be applied to situations such as search queries or different resource formats. The question is what an actual "uniform resource identifier" is, and how it should be applied to complex situations involving queries and formats.
The REST paradigm ... |
I always have just taken for granted that TLDs exist and are necessary to think about when you buy a domain name. But I'm wondering why they need to exist in the first place. I don't see why you couldn't have just had the domain name system be like this:
https://twitter/foo/bar
https://example/foo/bar
That is, I don't... |
What is the difference between Query Object and Repository?
Martin Fowler 'Patterns of Enterprise Architecture': “an object that represents a database query.”,
Also should a QueryObject always be IQueryable? I heard Repositories should Never be IQueryable.
https://weblogs.asp.net/dotnetstories/repository-iqueryable
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.