instruction stringlengths 34 36.1k |
|---|
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
|
Especially when working with some kind of ORM like Entity Framework I often see classes like:
public class Foo
{
public int FooId { get; set; }
}
accessing the id will look like foo.FooId
Is there any logical reason why is this preferred over just naming it Id?
public class Foo
{
public int Id { get; set; }... |
I've seen many articles describing differences between Domain Model and Data Model. However none of the articles have picture representations showing difference.
https://stackoverflow.com/questions/3507671/whats-the-difference-between-data-modelling-and-domain-modelling
Can someone provide a picture example showing dif... |
I've been doing a little research into algorithms for matching spelling mistakes in names. From Soundex through to metaphone and Beider-Morse. All of these algorithms generally focus on last names with an ever widening language ability (beider-morse being the most useful across a lot of different languages).
I'm wo... |
From what it sounds like, a 64 bit processor means aligning to 64 bits, which means if you have unicode utf-8 stored in there, each 8-bit chunk would take up 64 bits of space. That doesn't really make too much sense, so I think I need to do a bit more to understand exactly how cache aligning works.
But thanks to this g... |
I am developing against a file spec that lists the data type for certain fields as
CHAR(<length>)
The spec is for a fixed width flat file. In most cases, possible values to populate the fields are obvious (either delineated in a list of choices, or simply alpha/numeric by design). One of the fields stores an error mes... |
I'm starting to dive into domain driven design for a new project.
The software solution will be used by several departments to assign tasks to their employees.
The task assignment process is mostly similar for these departments.
One of the differences is that some departments assign tasks to their employees only, other... |
In an environment where you can't merge code that fails tests you obviously can't merge new, failing tests.
But how to deal with a newly found bug exploit, meaning you wrote a new test exposing an already existing bug? Test-driven-development would say: Hooray, you have the test, now fix the bug and then commit both.
B... |
This is my first post here and I'm glad to join this great community and I hope to learn a lot here and help if I can(though i am a very beginner).
I have a theoretical question:
I am trying to add to the single cycle datapath the following command jm IMM($rs), that will, using address in the command, will jump by the... |
My web app generate log entries on hooks such as model.save. Right now, I have a class Entry (representing a log entry) with a string field content to contain the text of the log entry.
Examples of such entries:
Entry(content='Account 123-456-7890 spending changed to $500/day')
Entry(content='Account 123-456-7890 pa... |
I'm coming from the monolith background, using a single large relational database. From my research, many proponents of the microservice architecture favor the event-driven rather than REST driven architecture. The following question applies to inter-service communication, between bounded contexts (in DDD terms) and NO... |
The structure of our project strongly separates the three different parts:
core - data classes, POJOs, sometimes aggregated with annotations (e.g. for XML/JSON serialization)
plugin - plugin for a large enterprise application that is based on Swing
ui - additional UI components in JavaFX, does only use the core data c... |
Given following microservice architecture:
Every post has a user, for which we want to have all information available.
Is more custom to:
Have a local user cache in the posts microservice
Make api calls to the user service on every request
Store user information along with every post
I don't particularly like... |
I have a number of attributes I need for various page loads and other backend tasks, and I'm debating on whether storing these things in a database or calculating them on the fly.
For instance, if there are files that users can upload, and you want to track the size, space taken, format, etc. would it be better to calc... |
I create an object that holds the status of a job. The job has many stages, some concurrent. Worker threads constantly monitor the status object to see if it's ready for the next stage to begin, if it is the perform the job, update the status object and end. Is it some form of pub-sub? Is there a java framework for im... |
We have two developers working on the same project. One is doing the front end and the other doing the back end.
Everything is working well, however we have come across the developer doing the back end stuff and getting though it faster than what the front end developer is working on. Therefore the back end dev skips a... |
I am writing a type checker for an ML dialect that involves generating "fresh" (new and unique) "type variables" (values representing unknowns). My strategy, and the strategy that seems to be used in tutorials, is to identify type variables with a unique integer and keep a counter that is incremented whenever a fresh t... |
I am looking for text compression algorithms (natural language compression, rather than compression of arbitrary binary data).
I have seen for example An Efficient Compression Code for Text Databases. This algorithm basically uses the words as symbols, creates a dictionary from them, and replaces them with integers. ... |
FIRST AND FOREMOST: Forgive me if the following question falls into the "off topic" category of this StackExchange, due to its slightly opinion polling nature. This is not my intention, I am simply looking for good practice advice in regards to general API design.
I am current implementing an applications development f... |
The question is about choosing the appropriate design for the scenario described below. This is a repost from https://stackoverflow.com/questions/51940180/unity-injection-with-too-many-constructor-parameters where it was suggested to put the question here.
The question seems to cause a severe controversy even among so... |
I'm working on a code base with a coworker who has a habit of checking the results of a constructor for a null in a fashion similar to this
Person p = new Person();
if (p != null)
{
p.Name = "John Smith";
}
My understanding of the .NET landscape is that a constructor will never leave an assignment unfulfilled unle... |
I am currently designing a web application which is pretty similar to Twitter but with some unique features for my company.
Technologies are Vue2, Spark framework and PostgreSQL.
I am trying to decide on how to design the ER and how to integrate the client side with my API. Let me break down the problem.
These are the ... |
I am working on a project to help learn DDD and am trying to do CQRS and Event Sourcing. Code is in C#.
For this example, lets say I have 2 aggregates, Customer and Product. My aggregate repository has a get method Get<TAggregate>(Guid id) that loads all events for that ID, creates a blank TAggregate instance, and then... |
I am in a situation where I believe type providers would be useful. Consuming type provider in F# could be the way I finally dip my toes in F#.
However, I understand that writing type providers is hard. It may not be a suitable first task in F#.
Is there a reason why it would be problematic to write the type provider ... |
I have a module as below:
def normalize(sub_item):
pass
def process(sub_item):
pass
def cleanup(sub_item):
pass
def calculator(item):
pass
def main(item):
for index, sub_item in enumerate(item.sub_items):
normalize(sub_item)
process(sub_item)
if index == 0:
c... |
I have a Web server (Local) and File server(Remote).
I need to create a duplicate of an xml file in the same location with different file name in the File server. The size of the file is random, but the maximum file size can be 45mb, and I have 200 users a day. I'll be using ftp_put in transferring files between server... |
I want to use gitflow in combination with semantic versioning. In gitflow, you bump version numbers on every release or hotfix branch. This inevitably leads to version conflicts if a new development cycle (with a new version number) is started while the current release process is still ongoing.
Let's say, 1.0.0 is on ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.