instruction stringlengths 34 36.1k |
|---|
I'm trying to set up a good class diagram for my Angular application, however I have a problem figuring out how to solve the following situation:
I created a base Link class that can be used anywhere throughout the app. We have many flavors of links in the form of classes, RouterLink, ExternalLink, ClickLink (Links wit... |
I started studying functional programming with JavaScript. After this, I started to study it with Java 8 (streams, lambdas and method reference) and I realised that I tend to use streams as much as possible, avoiding collections.
I heard that there is no sense to use streams when there are no events in the context. So,... |
Another way of asking this is; why do programs tend to be monolithic?
I am thinking of something like an animation package like Maya, which people use for various different workflows.
If the animation and modelling capabilities were split into their own separate application and developed separately, with files being pa... |
In the context of Clean Architecture, is the following execution path right?
The controller sends a request model (input) to an interactor. The interactor executes a use case dependent on the request (input).
Is that right or am I mixing something here?
|
I'm writing a program that will interface with an external device. It will support numerous devices that may use different communication interfaces like USB, serial, etc.
This is what I have so far:
An abstract Device class with some generic methods and some pure virtual methods:
class Device
{
private:
bool initia... |
I'm doing research to a problem occurred in our company. We have a front-end web portal which communicates by API with a back-end in a same syntax, for example: "www.123.com/api/v1/getCustomers".
Now we have a new clients who uses another companies back-end/API but our front-end. This means the front-end has to be cus... |
I am trying to come up with a design of document exchange system.
System should be for business-to-business communication.
Description:
There will be possibly 100+ clients(consumers) - they will have to develop clients independently.
Clients should send and receive documents.
Message Data:
Author client ID
Recipient c... |
Say I have a read API and a write API:
MyApp.Write.api
MyApp.Read.api
Both API's handle integration events from other apis/microservices. Say I had certain integration events that only need to be handled by the read api. Then is it necessary for the write api to handle them first? The reason I ask is because the wri... |
I have a web application that is currently of some different services, one instance each.
My current goal is to scale some of my services to ensure fail over. One big problem I foresee is that a service may execute the same task with all the instances, here's one example:
I have one service that sends a mail composed o... |
I have an application which needs to store different objects in different data stores based on the user's authorization credentials. I.E. the user may need to save object 1 to their BI postgres database, object 2 goes to their S3 bucket, and object 3 goes somewhere else.
Inversely, they may want to read data from diffe... |
I'm new to DDD, so please bear with me.
I am trying to design a domain model around an extremely large and complex existing system, where most of the current "domain" logic is either in the UI or in the persistence tier. The need is to begin moving some of this logic into a domain model that can be used for our server... |
Recently I started working on a rather large monolithic system. The solution has web, app and api parts and in general just a lot of stuff.
It relies heavily on dependency injection and I noticed that this makes it really hard to figure out what’s happening.
A search for a controller name returns multiple results and ... |
Suppose, there's a site that provides an API, such as this:
Users post questions, answers on that site
You can make GET and
POST calls
There are two types of authentication: weak (only gives
read rights) and strong (gives both read and write rights)
Right now, I'd like to read users' questions and answers (only need w... |
From what I have read and seen clean architecture assumes that you have some entities which know nothing about persistence though at the same layer as they reside there might be an interface which has a purpose to be a contract on how the entity should be read/updated/deleted.
// project Core
public class CarModel
{
... |
It's well known that end-to-end and integration tests are costly. Of course if we develop applications where people might die if things go wrong it's a worthwhile investment. However in applications where errors are not the end of the world, would it not be cheaper to skip the E2E tests and integration tests altogether... |
So I was learning about forward compatibility, and I was wondering if you could warn a "dependent" that a dependency is backward compatible, but not forward compatible*, and vice-versa.
The SemVer specification requires that:
7. Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards compatible functiona... |
I know there is no right and wrong answer here, I'm just looking for other opinions on who should handle immutability, dependency inversion and decoupling.
Example 1: Here each function caller has the responsibility to pass a new object, let the function handle the changes and then return the response. The function imp... |
I'd like to get some advice on what would be a good approach at hiding the creation of an object graph. In the code below I would like SomeClass to not be directly responsible for the creation of the entire Thing object graph (all the objects in the CreateThing method. I don't have any control over any of the objects i... |
I am confused here on how real time analytics is accomplished with web sockets when data is inserted into the system via a REST API. In my (admitted immature) understanding of web sockets, you have many clients connected to the socket server and the socket server emits events to the connected clients. The only communic... |
I'm just getting into OAuth2 and I'm a tad confused (you've probably heard that before)!
I am writing a small independent service which will expose a basic REST API enabling client applications to upload and download files. Please don't ask why I'm not using S3 or some other cloud provider service - suffice to say that... |
I'm working on a CMake module which, at some point, invokes try_run(). The file I'm compiling is not really part of the project's sources - it's not used anywhere. It's only ever useful for CMake, to determine some hardware-related setting.
Now, the module is under cmake/Modules/. Where, in my repository's folder hiera... |
I've been working on a personal project in C# whose purpose is more or less to allow the user to execute scripts written by other users and restrict the permissions of that script. My program compiles the scripts using a third-party library, sandboxes them using the .NET Code Access Security mechanisms and makes sure t... |
Just a general programming best practices question.
If I have a function like that takes in an array of items and the function then calls a series of other functions which filter and act on the items in the array, should execution continue if at any point we are acting on an empty array?
E.g.
arrayItems = [ 1, 2, 3 ]
... |
For example, suppose if I had a Character class and an inventory, before taking out a weapon to use it, it's probably a good idea to check if that weapon exists first, so I might have a method called has(GameObject weapon); that returns a boolean. I can then use it in an if statement like this:
if character.has(sword):... |
Out of curiosity, are there any languages that let you tag a function with an attribute that indicates that it may only be called from a single call-site, such that if any code tries to call the function from a second call site, the second call-site is flagged as a compile-time error?
For example (pseudocode):
unique_c... |
In Clean Architecture boundaries are interfaces, which I model in Python with abstract classes. The input boundary, which is between the controller and the interactor/use case does not need an interface in my opinion, since it just executes the use cases coming from a "higher level". Is this true?
Other boundaries make... |
I've developed an IoT device utilising OpenWrt so my design needs run a on a shoe-string budget of resources.
I need to be able to push small amounts of data, up to 300bytes to my app on a very irregular basis, something once a week and other time maybe 10 times a day, so I'm not looking to over-engineer this thing, b... |
Right now I'm doing this:
Update the readme to include the new version number and what it does.
Commit the version number in git commit message (i.e git commit -m "1.2.1: this does that").
Push the repository.
Is this the proper way of doing it? I had a hunch that this is wrong, because this way I have no idea how to... |
One of the requirement, in the complaint management system were are designing, is to implement complete history of the ticket. For example
Status was changed (new to pending to work in progres to done)
Ticket was assigned from one person to another
Ticket need extra details
Address was changed on the ticket
Descriptio... |
A part of a system I am currently reviewing, consists of a master node which calls several slave nodes using REST APIs.
The slave nodes are scattered throughout the world on different servers, and the master can run the job on the servers up-to every minute. The result of the API call will not take longer than about 50... |
during uat, the user realizes a major missing functionality that should be included in the system. this is not related to the implementation of the application, but with the design and the initial laid out initial requirements.
if you push the current state to production, the app will appear unusable since it is missin... |
I hope this fits more here than SO because it is mostly about code design than making it work. Also, this is not tied to RxJs, but more to the reactive paradigm. (TypeScript tag is only added to make the code highlighted.)
So this is what the code looks like, though this is just an overview. Actual function names are d... |
If my software has some screens, how do i express the various states of those screens? If, for example, I have 3 checkboxes in a screen, so I have 8 combinations total and at first thought, 8 states for that screen. What if there is a popover widget, a slide, etc... And all this variations combined represent many and m... |
There are a few questions similar to this one but I feel the situation is a little different because I do not have the methods available to me or they are not working. I have been working on a solo project for 7 months now and the thing that is really killing my productivity is getting stuck on one little issue like an... |
I have a question regarding HTTP methods and what would be most proper in terms of conforming to REST principles.
I have two services, A and B. When new data is added, or old data is updated at Service A (e.g. POST/PUT) it triggers Service A to contact Service B to let it know that new data is available. Then Service B... |
My coworker and I have having an argument. The Open and closed principle is defined as:
A module will be said to be open if it is still available for extension. For example, it should be possible to add fields to the data structures it contains, or new elements to the set of functions it performs.
A module will be ... |
As I understand, consensus is the mechanism that will ensure the ledger is kept in sync across nodes. Is that correct? Also its nothing new and wasn't something that was invented with the advent of blockchain. It is an integral part of distributed databases and has been around for decades. Many algorithms exist to driv... |
I am aware that this might be a question with only subjective responses, but i keep coming back to this thought.
When you are designing a software's architecture, do you group components by their kind of task or their "theme"?
For the lack of a better example, if you have a lot file exports to do in your application... |
For example, suppose I have an android application, in simple, there are 3 activities :
MainActivity -> Main2Activity -> Main3Activity
,which user can visit them in sequence (eg: by button click), also there is some global data to show:
public class GlobalData{
public static String userId;
}
public class MainAct... |
Can there be different use case diagrams for the same system with differing levels of complexity?
My question arises due to the fact that use case diagrams can represent a single system in a complex way (more use cases and different relations with detailed representation of each feature) or in a simple way (just an ove... |
White-box testing focuses on testing implementation details of a component. Black-box testing sees a component as a black box accessible only via its API.
Both Lean and Agile software development focus on the value delivered to the customer (Lean calls everything else "waste").
Taking this seriously, white-box testing ... |
I built a form builder with which administrators of the system I work on can build forms (or blueprints as we call them). The structure of these blueprints are as follows:
blueprint X
section 1
question 1 (Text)
question 2 (LongText)
question 3 (File)
section 2
question 1 (Text)
question 2 (Dropdown)
section 3... |
I'd like to share my approach to writing database applications for small businesses. It's possibly unconventional, but it's something I have been developing for nearly 20 years.
The approach I use is to place ALL the application logic in the database, with only a thin "dumb" layer which passes http requests to a SQL st... |
We have to support multiple releases, so we are following git branching model similar to the above diagram. Now the problem is that we have to do lots of merging here example for fix/011, we are merging it three different branches(master, release/1.0 and release/2.0). Also there is question of from where to create thi... |
I want to develop a virtual garden with a lot of kind of insects like ants, bees, etc...
For example, if I want to create an area of 10x10m².
I can implement this with ArrayList<ArrayList<Insect>> area an put all the insects in a specific position. With this approach, my space is limit of the array size, but I think th... |
We are about to develop a microservice architecture with azure functions inside azure. We thought about using interservice communication with durable functions.
On app site we want to use an async pub/sub pattern to publish request/commands through a single function gateway. This command will be forwarded to other dur... |
Introduction
In our development team, we divide developers into back-end and front-end teams. To develop a feature for a website, the 2 teams have to work in parallel. We starts by analyzing the requirement, talk about all possible business cases that should be handled, and have agreement on APIs interface specificatio... |
We are a central team, responsible for around 10 services. Other parts of our company depend on these 10 services to write their applications, and we often have to collaborate on new features before they're ready for production.
I'm wondering how to accomplish CD with this sort of situation. I'm sure it's been explaine... |
There is a series of procedures, each of which falls into one of two general categories.
Most of these are of category 1: it would be best to execute them one at a time - the overhead associated with threading or even using a thread pool negates any gains.
However there are a few of category 2: it would be best to move... |
I am running into this issue:
Suppose that there are two independent services, A and B, and both process messages from C.
Suppose that I have a service X that needs to know if a message m from C was processed by both A and B. What are the reasonable patterns to design such thing? How can I sync notifications from both ... |
I need to model the following requirement in an Entity-Relationship diagram.
"Customers place orders, which contain a list of products with their quantity and prices. A shipment is made when products are ready to be delivered to a customer. A shipment may include products from multiple orders, but only if they all be... |
I have an interval partitioned into “MECE” subintervals, and I want to check which subinterval a number lies in.
(MECE stands for “mutually exclusive & collectively exhaustive”, meaning the partitions do not overlap and they leave no gaps in between.)
First I simply used if .. else if:
; if (0/6 <= h && h < 1/6) { r... |
I am considering mutliple options to face a problem.
I want to develop software following DDD style.
The problem arise when I have to define my entities and I am working with Entity Framework Core, any other ORM would have the same problems.
ORM generates plain POCOs entities that represents the Tables in our DB. That ... |
Consider an Eg. of Library Management System, we can have a design where in a student can search for a book based on it's title from the list of books using a function, something like below (in c++)
std::vector<std::string> GetBookListBasedOnTitles(std::string title, std::vector<string> books) {
// iterate through l... |
While creating the architecture of a new project I struggle to come up with a good solution to handle public IDs.
For example our users will receive a membership card. Each card has the membership ID printed on it. But because in our branch of industry we expect cooperation with other businesses the format of those mem... |
As I can understand, assembly language is just a symbolic representation of hardware instruction opcodes that a hardware manufacturer has offered/documented, based on the way they have designed their electronics.
Now I saw the term "Windows Assembly" in another post. As I understand, Windows itself is a software that r... |
I am trying to figure out if there is a better practice for initializing class members of derived classes in ES6 - in the child or the parent, and why?
For example:
Option 1:
class AbstractAnimal {
constructor() {
this.voice = null;
}
makeVoice() {
this.voice.make();
}
}
class Dog extends A... |
A coworker of mine insists that this is the right way to write enums in C#
public enum ExampleEnum
{
InvalidItem,
Item1,
Item2,
Item3,
MaxItem
}
We have enums defined like this all over our codebase. Everywhere we use the enum we then check that the values are between InvalidItem and MaxItem.
To... |
There is a swarm of objects. When a new unit of certain kind appears on the frame, the swarm integrates this object by calling some add_new_unit method. Above the swarm is a controller abstraction, which handles multiple swarms of different types and the interaction with an image processing abstraction that detects uni... |
I wasn't sure exactly how to word this question, but basically, I have a struct stNeuralLayers (for a neural network I'm playing around with) with fields that are matrices (such as a double[,] neuralWeights field and a double[,] results field), and I have a field that's an array of those structs (stNeuralLayers[] fldN... |
I'm currently working on my own open source project.
There are two parts to it at the moment, a .NET core web API and an Angular client side app.
I would like to get your views on installation/setup for my users. What I have at the moment is an install endpoint in the API itself and an install component/page on the ang... |
We are working on several products as the IT department and we try to provide solutions for different departments within the same company. The core of our business is insurance and the main goal is to have automated processes for brokers, back-office people, and finance department (there are some other groups, but it i... |
For example, suppose I have a string constant like this:
const TITLEBAR_MESSAGE="Welcome back, %USERNAME%!";
I think it is more readable when it is named as
const WELCOME_BACK_USERNAME="Welcome back, %USERNAME%!";
because I don't need to move to the definition of TITLEBAR_MESSAGE to see what is the string context, a... |
I am writing a service, which is to be consumed by API and Web controllers. The result of each call depends on a UserContext state. Should I pass this UserContext with each method, which includes a lot of repetition, or include it as a property of the class, which requires the programmer to properly initialise the cl... |
I have ERP database whose good or person entities each have several hundreds of fields. Many of them are used for some subjects only. And hence senior companions (especially from the business division) are quite reluctant to allow me to add new fields when such need arises. E.g. I am not allowed to add such new fields ... |
Moderator note
This question has already had seventeen answers posted to it. Before you post a new answer, please read the existing answers and make sure your viewpoint isn't already adequately covered.
I've been following some of the practices recommended in Robert Martin's "Clean Code" book, especially the ones ... |
I am currently working on a program in which I encountered an issue (not for the first time) where I have two acessor methods for a data structure. The methods are identical, except one is const and returns a const pointer while the other is non-const and returns a non-const pointer. The code in the methods is non-triv... |
My team is currently making some changes to our solution structure. Before the change we basically had a single solution file with about 40 different projects. Most of these projects are libraries that are consumed by a handful of applications.
To improve the load and build times, we decided to split the solution into ... |
It is true that the bitwise left shift operation (shl) doubles the value of the integer being shifted. However, when constrained to a finite space, such as 8 bits for example, left shift will begin to push bits off the high-order word and will cause loss. What mathematical effect does this loss have on the number? Does... |
Is there a usable programming language that disallows all side effects except for its input stream (aka STDIN) and its output stream (aka STDOUT)? All executable scripts in the language should be guaranteed to produce exactly the same output when given the same input (unless they don't terminate soon enough). This excl... |
I have a microservice-based system that has a product service and a store service. I'm using eventstore to propagate events between microservices, so for example when a product is created, the store service receives a notification and can then add the new product to a store.
Now I need to implement multiple stores and ... |
Given that this question is related to my work, I will simplify what I need to do. The system consists of 4 primary types of statuses (internally, we call them events):
Working, not operating machinery.
Working, operating machinery.
Break period.
Off work.
Based on those types of events I have to keep 4 different cou... |
I have a load balanced service that needs two data inputs to correctly give a result.
One of these inputs comes from a queue, the other comes from user input.
Most of the time the data that comes from the queue arrives long before the user input. This data from the queue is saved to a database and when the user input ... |
I have a class called GatewayAPI, which has to load configs from a file, when used. I first wanted to put the get_config() method in the constructor, but I don't like this design for testing purposes.
Now I plan to do a factory, which creates this GatewayObject. Is this a typical usecase for the Factory Pattern?
Second... |
I have a DeviceManager class which can handle different physical devices, and to say there are Classes A,B,C, which require a DeviceManager instance as dependency. They should always use the same instance of DeviceManager, however, at some point of time this DeviceManager should create a new instance in order to wrap a... |
For me, the data I want to retrieve may be in database for which I can use properties of model and also relationships, but if the record is not a property and no relationship exists for that particular record, I need to check it from an API end point, so where I should place my API request code, is it okay to put the c... |
I have an implemented UDP receiver which is continuously receiving DTN packets (UDP encapsulated) and performing some operations on them. This whole process is working on a single main thread. However this consumes time on processing the packets and results in packet lost when a sender sends a huge chunk of data.
int m... |
I am modeling a system that exposes a number of "plugins" (not known at modeling time) through a web API. I have a number of "system" plugins that permit to interact with the system, something like "list plugins", "describe plugins", "submit job (plugin execution)", "get job status", ...
System and user plugins are exp... |
Say that we have Kubernetes running with n pods, each being a separate microservice. Now, some of those services need a caching layer. When we take into consideration:
the fact that Redis was tested to hundred of millions of keys and that it was performant
the fact that you can tag keys by namespaces (which would be ... |
I have a User class, this class handles things like:
login (UserAuthenticateModel)
Handle user sessions: user login tokens, fetching user from session if set in session, ect' (UserSessionsModel)
Fetch & Set user data to populate $this user object. (UserFetchModel)
Update & change my user data (to this user object - a... |
I'm building a helpdesk-type system, where there are:
Customer - can submit/resubmit tickets;
Manager - can review submitted tickets, assign to developers (one ticket to multiple developers), review completed tickets, decline then and mark as complete;
Developer - can work, close and decline tasks.
For now I have 2 c... |
Dynamically apply methods/"rules" to documents
I hope someone here can help me/guide me in the right direction. I am currently creating a web application, where users can import a text file, and then programmaticaly apply different methods on the text.
Example
Imagine that an user have imported a text document, that lo... |
I know it matters for class libraries, but does it matter in projects that are not class libraries, e.g. console applications or GUI applications?
What's the difference if I use public or internal or private when it's a console application and it won't be reused?
Is it worth the effort to add access modifier in such ca... |
I want to create a class ProcessHandler for Windows that pretty much uses the WINAPI.
The class ProcessHandler should be able to scan memory, emulate keyboard and mouse, needs some DLLInjector, some hooking, and provides some process information. Since I want to use some design principles, I think I should split every ... |
I am wondering if the following would be a good technique to allow user to download files from the server in the below scenario:
Info about the scenario:
User logs into a system (HTML,JQuery and CSS, Javascript based), There is a Download button in the UI. Clicking on it triggers a backend Java Message based (JMS)proce... |
If I had an application that pretty much had a "fail-safe" as in, if I need to terminate the application quickly and not free the malloc'd memory, or close the threads that are running, would Windows handle giving the memory back and terminating the threads?
|
If I could get some input on the design of this, I would be grateful as well.
Note that I'm programming in python.
There's a function F that takes lots of data, runs some analysis on it (taking maybe a minute or more) to compute some crucial fruits theta, and then spits out a function g(x), that has a lot of functional... |
By default, the HTTP response code for "file not found" has always been 404. I never really thought about it until recently someone was saying that if the missing file is part of an application then the response should be 500 (internal server error) because it's not a client error (4xx error class). The example for tha... |
I'm trying to figure out how to create unit tests for a function, which behavior is based on a third party service.
Suppose a function like this:
def sync_check():
delta_secs = 90
now = datetime.datetime.now().utcnow()
res = requests.get('<third_party_service_url>')
alert = SlackAlert()
last_value =... |
Considering a medium-big software with an n-layer architecture and dependency injection, I am comfortable to say that an object belonging to a layer can depend on objects from lower layers but never on objects from higher layers.
But I'm not sure what to think about objects that depend on other objects of the same laye... |
We're developing an Angular application that consumes a web method exposing some information that is not sensitive, just bus seat promotions; the user enters where he wants to go and when and he will be presented with the available offers (if any). The site does not require any kind of authentication for this informati... |
I wanted to summarize a quick discussion we had in my stand-up today. We have a big feature branch merge coming up in our system. We are replacing the old live, system (branch master) with a redesign (branch feature/v1). In addition, there are 2 other branches--feature/celery branched from feature/v1 and feature/aggreg... |
I have an OO design concern. Let's say my models as following:
class Account {}
class LocalAccount extends Account {}
class SocialAccount extends Account {}
These Account entities are persisted and I could retrieve them (or do more operations on them) through a typical Repository. Let's say I have the following interf... |
I'm working with a 3rd party company who are providing an API along with an unusual security approach.
The security approach is essentially using a JWT by itself (no oauth). What's odd is that they're expecting us (the client) to create the token which seems the opposite way round.
My API will communicating directly ... |
OK, so I have been at this problem for the last few days, and I must admit - I am stuck.
I am trying to make a web application, where users can upload documents or send inbound e-mails.
Each document or email will be added to a stream. So a stream holds all the docs/mails.
Now, what I want to allow my users are the fol... |
I ran into a situation where my build speeds have started to become large and have affected productivity. I had already minimized header dependencies before using forward declarations. Now I've turned to forward declarations to further reduce these dependencies as a method of trying to reduce compile times.
I unders... |
I am working on an application that involves alerts as well as notification policies for multiple users. I am using microservices and am trying to keep them stateless if possible. I have one service that will do the alerting and another that stores and handles policies.
I currently have it partially working by the aler... |
I'm currently doing a web based system for multiple organizations, so on my login form, there's 3 simple field:
Company code, such as CNN (this is implemented so we can have same username, as long as they work in different company)
Username, such as James
Password
Now we are actually studying on the fingerprint authe... |
I have a parent object that has some other objects as fields. The parent object fully owns these fields: they can be declared as fields of the parent object (MyPart part), directly, not as references.
I would prefer to initialize these fields in constructor, but in some cases they do need to reach the parent object ins... |
We are doing an architectural refactoring to convert a monolithic J2EE EJB application to Spring services. In order to do that I'm creating services by breaking the application against the joints of its domain. Currently, I have three of them and each calls another service via Rest.
Our domain contains User, Customer, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.