instruction stringlengths 34 36.1k |
|---|
I have recently joined the company where I see below stack to handle the http request
CDN -> LVS(Load balancer) -> NGINX -> Apache
My question is about using advantage of NGINX b/w Load balancer and Apache. Folks who took this decision left and most of the team is new.
I read couple of articles on google where most ... |
As far as I know, there are two commonly used patterns when dealing with services communication in a microservices architecture:
Direct-calling other services. For example: Service A handles some data, then it needs to tell Service B to do something with that data. A knows B's endpoint URL and calls it directly.
Using... |
For our project, a protocol is specified for communication between an embedded linux device and a PLC/HMI. This protocol includes CRC checking.
However, the communication is now done over TCP (TCP protocol includes CRC), so my question is whether or not a CRC on top of TCP has any meaning ?
|
Currently, I'm trying to migrate multimodule angular + spring 4 app build with ant and ivy to Spring Boot and build it with Gradle. The issue is that I don’t how to create build upon some custom requirements.
Currently, app consists of 10 separate modules, each module is built to WAR file and deployed on a standalone t... |
A common pattern I've been using for JS/NodeJS applications is the following:
import { utility1, utility2 }
function exampleScript() {
utility1()
utility2()
// Does something
}
Basically my main application function would rely on smaller helper functions that I could separate and modularize. But I'm not sure what sty... |
According to my teacher,
A CONTEXT diagram NEVER shows what goes on INSIDE a system!
It only shows the EXTERNAL entities and the circle is the SYSTEM BOUNDARY. ie the boundary between what is INTERNAL to the system and what is EXTERNAL to the system.
In the context flow diagram I'm given, driver entity is not show... |
First of all, I am sorry if it is a duplicate, I could not think of any "correct" wording to search about this.
Second let me clarify: By "equivalent" I mean methods that are meant to have the same behavior, either because api design or other reason.
An example of this is the Java Deque interface (or ArrayDeque if you ... |
I have used some kind of "listeners" where I have an interface implemented by classes that need to be notified of some event (e.g.: CurrencyListener, with a method currencyUpdated(Currency currency))
Then, the object that needs to send a notification, has a list of listeners (List<CurrencyListener>) and just iterates o... |
A team created a structure like this (pseudo-code):
struct Rectangle {
int left, right, top, bottom;
}
Half a project later, the team realized that two thirds of the code was filling this structure with coordinates where top < bottom and the other third used top > bottom.
A requirement is that the coordinates wil... |
I have seen examples of methods whose name ended with a preposition applying to the first (and most often only) parameters.
But other examples don't use this kind of naming convention.
Which do you think is more readable?
For example, should I make a method like this:
getColorFor(Player player)
or like this?
getColor... |
I am making a REST API in Go using PostgreSQL.
Quick introduction:
I suddenly have a case where I have different variations of the same basic entity, one of the variations have maybe 12 extra fields than the base, and two other variants have a few more fields. I have mapped this using the Inherits syntax in Postgres wh... |
Most of my work is written in Java using Spring Boot. In a recent project my entities contained no business logic, Spring Data was used to handle repositories and I have service classes that controllers would call to retrieve certain data or perform actions on an entity. For example, you might have a UserService with a... |
Working in the embedded systems space, our products usually require multiple binaries for each of the microcontrollers within a single product. Using SVN previously, we would bundle validation and production releases into folders that contain all the necessary binaries to be loaded, e.g., v01_00_00, v01_00_01, and so o... |
During the development process many migrations may appear. Is there any point to keep them instead of merging them all together?
Let's take a look into a simple example.
During development we introduce a new model Person:
public class Person {
public int Id { get; set; }
public string Name { get; set; }
}
Migr... |
For example, suppose I have 2 arrays:
let arr1=[5,2,1];
let arr2=["abcde","ab","a"];
my work is simple : to check if length of strings in arr2 are larger than corresponding element with same index in arr1, so:
let arr1=[5,2,1];
let arr2=["abcde","ab","a"];
is true,
let arr1=[5,3,1];
let arr2=["abcde","ab","a"];
is ... |
I hope the question title already answers the subject here. Lets say I have a number of ids that needs to be validated in a request.
Example:
request uri:
[POST] /album/{album_id}/song
Request payload:
[
"song_title": "hello world",
"genre_id": 2,
"artist_id": [100, 102],
"lyrics_by_id": 201
]
Now, as we know... |
In the space of 3D geometry, I need to compute the magnitude of the cross product of two Line3D because I want to check whether these two Lines are "parallel" to each other.
Line3D is consisted of 4 fields, x1, y1, x2, y2 denoting the two points. the x and y are of the type double
In theory, two lines are parallel if ... |
I'm unsure about several things:
I have a class that implements a NotificationDispatcher interface. This class I named WhatsappNotificationDispatcher, another implementation goes by EmailNotificationDispatcher.
The Whatsapp message delivery itself is implemented by the API of an external service provider.
So now I h... |
An algorithm takes 1 second to execute a dataset of size N on a particular computer. Replace it with a computer that is 10 times faster. What will be the size of the dataset you can process in 1 second on the new computer if the execution time for a dataset of size n is proportional to n^2?
I am having a hard time wrap... |
Is there really any actual use for private variables and specific moments where they would be your only possible option? Or can you just set all of your variables as public without any actual changes to the program? It seems like a pointless practice that doesn't really change much, from my perspective, so I'm wonderin... |
I'm working on a portion of an ERP system where I need to process data in a way that's similar to a series of batch jobs, and I'm struggling with deciding the best program architecture to use. I'm asking here because I know I'm ignorant of a lot of state-of-the-art programming methods, and I'm worried about designing ... |
Would there be any downsides of creating sub-interfaces for virtual member functions that have different parameter types? A drawing of this is shown in the image attached.
Apple and Orange do not share similarities and they themselves are interfaces. Making a higher level Fruit interface would run into the same issue... |
I want to understand different ways to object design classes. I have three different classes. Generally I am creating a file parser.
The classes:
CustomerData - which shows text Data Model.
A File Parser, which will take data from file and place into Generic List
And Folder reader, which will run FileParse for All F... |
Reposting question as Previous post on same Topic was not clear.
Currently our financial application receives multiple feeds in csv format from client, there are usually 100k to 5M rows of data. When this information is processed we need to enrich the data and store them, various look ups are performed and based on da... |
I'm familiar with the serverless programming model e.g. GAE and AWS lambda etc. But what is "serverless mesh"? I googled it and found no definition.
|
I have a very large class of 59 methods and about 3000 lines of code. I know that's far larger than most people would want, but the class represents a virtual machine, and most of the methods are run time functions, so I think this is one of the times when a large class is warranted.
The question I have is how can I be... |
I am thinking on how to structure a project. I wonder if it is a good practice to use different entity classes between the BL and DAL in order to decouple these layers.
I have worked on projects where entity classes where in a separated project/package. Then BL and DAL used the same entities.
But I can imagine that ... |
What is the official name of the principle, in language design, where the language tries to offer one way of accomplishing a particular task (as opposed to have multiple ways of accomplishing the exact same thing)?
|
We've got a situation where I have to deal with a massive influx of events coming in to our server, at about 1000 events per second, on average (peak could be ~2000).
The problem
Our system is hosted on Heroku and uses a relatively expensive Heroku Postgres DB, that allows a maximum of 500 DB connections. We use connec... |
I have to rectifiy an application that basically serves content by using two REST endpoints. Both endpoints transfer files to the browser, one endpoint does so by providing the file in binary format, the other sends the file base64 encoded.
The application had a file handle leak in the endpoint that serves binary data.... |
I am planning to design a new web application using ASP.NET MVC 5. I used to write a lot of JS/Jquery code on UI when I was a beginner with Web forms applications. After reading/learning a lot of software designs/patters/practices:
MVC pattern suggest that you should not include any business/application logic on Views... |
I was wandering around google and saw a paper in which the author says in introduction that Agile methodologies, (in my own word) does not put enough emphasis on software architecture and design...
Why does it bother me ? I'm a junior software developer. Being a junior, I mostly write codes. I don't bother about higher... |
Assume the following C code:
#include <stdio.h>
int main()
{
int a = 5;
int b = 15;
return a + b;
}
Compiling it using gcc creates an assembly code which includes the following:
movl $5, -8(%rbp)
movl $15, -12(%rbp)
movl -8(%rbp), %eax
addl -12(%rbp), %eax
Why is the compiler moving 5 and 15 ... |
What’s a good strategy for storing point-in-time data in a relational database?
For example, let’s say you have products and orders. Every order has some products. But they’re not the products as they exist now, they’re the products as they existed at the time of the order. You may later change the product price, remov... |
I am writing a simple program to parse a text file and place into Generic List.
Sample Text:
1,Joe,CA,58,2
2,Matt,TX,63,5
Sometimes, there may be an error, with missing data in the file
1,Joe,CA,58 // missing one number
2,Matt,TX,63,5
I wrote a catch statement to handle such errors.
My Software Principle Question... |
I'm sure this must have been asked before, but I can't find anywhere that actually answers my question, so apologies if I have simply overlooked this.
I am currently learning Haskell, and loving the way it balances flexibility allowing rapid prototyping with functional purity. However I'm trying to get my head around b... |
I've reading about Domain Driven Design and Anemic models.
I generally work with an ORM such as Hibernate, and I'm struggling to understand in DDD what a business model can and can't do.
For example, if I have a Customer object, I would need to pass this off to a Service class in order to have it persisted to the datab... |
I need to create a distributed application with timers / periodically checking two timestamps for elapsed time.
Is it possible to achieve following behaviour with the actor model:
Spawn Child actor
Send Message to Child actor to start the routine for checking the timestamps
Do something when timer expires without rece... |
The paper in question is Peter Keen's "Information Systems and Organizational Change". This is considered a classic paper in software engineering, I'm studying it right now for a retrospective on a project that has been difficult. The paper is about why the implementation of MIS (management information science) system... |
When writing large amounts of recursive code (for valid reasons), I have come across many parameters that are not used in specific functions, but are still needed for a subset of all of the functions.
IE this situation (a, b & c are numbers):
function fun1(a, b, c) {
if(a > b) {
return fun2(a, b, c);
} ... |
In Laravel 5.6 an Illuminate\Database\Eloquent\Relations\BelongsTo relation was given the ability to support default models. This allows a model that will be returned if the relationship is empty.
Most of the code for doing this lives in the Illuminate\Database\Eloquent\Relations\Concerns\SupportsDefaultModels trait, w... |
In our company, we develop information system software in C#.NET, which has client-server-module architecture. Module project does not depend directly on server/client project, but only on shared parts. So the structure of core projects looks like this with their dependencies:
server depends on
server-shared library... |
I am currently developing on a small library allowing to read and write Java .properties files while retaining all the formatting (comments, whitespace, etc.): https://github.com/hupfdule/apron
This library has a saveTo method to write the content of such a PropertyFile to a file or an OutputStream. At the moment this ... |
I have looked through answers related to this but they don't seem to solve my problem.
I am fairly new unit testing and testing as a whole. I just finished a small web application using ASP.NET Core MVC and I wanted to write tests for the projects. I am using xUnit and Moq.
The project has a business logic layer that c... |
The Domain has the Domain Models.
The Infrastructure layer has Commands and Queries, forming CQRS.
Commands return Domain Models, and Queries return DTOs.
In any API, the DTOs are stored in the Application layer, never in the Domain, but if Queries return DTOs, must the DTOs be stored in the Domain? Is it a good idea?
|
I have the following aggregate:
Checkout (root)
Requirement: CouponRequirement, AnotherRequirement, YetAnotherRequirement
Coupon
A Checkout has many requirements that need to be fulfilled in order for a Checkout to complete. Each Requirement has a fulfill(data) method that is responsible for the fulfillment process.
... |
I really love clean code and I always want to code my code in the best possible way. But there was always one thing, I didn't really understand:
When is it too much of "separation of concerns" regarding methods?
Let's say we have the following method:
def get_last_appearance_of_keyword(file, keyword):
with open(f... |
I work on a small team (2 primaries with one or two other occasional contributors) on a project/product that spans a number of separate platforms. We do embedded firmware in straight C on Arm0 chips. We write python and a little bit of shell scripts for small Linux computers that are similar in size to Raspberry Pi's. ... |
The paper in question is Peter Keen's "Information Systems and Organizational Change". This is considered a classic paper in software engineering, I'm studying it right now for a retrospective on a project that has been difficult. The paper is about why the implementation of MIS (management information science) systems... |
Is there any engineering reason why is it like that? I was wondering in the case of a RDBMS that it had something to do with performance, since a "YEAR" is more specific than a "MONTH", for instance: you only have one year 2000, but every year have "January", which would make it easier/faster to filter/sort something b... |
We have a developer toolchain, governed by a config file. Each developer can have their own version of the config file. What is a good way to store separate versions of that config for each developer in a single Git repo? All I am thinking is just separating it by developer's name and putting all the config files in di... |
I looked through a lot of articles, blogs, and SO topics about separating domain object and data models. Almost every answer said: You should have separate classes for the domain and data persistence, because...
I understand why it is good, but I haven't found any even pseudo example to solve this problem, and I have ... |
The distinction between roles and claims is that roles describe a set of users and claims describe a property of a user. So there can be a role "Administrator", but there can also be a claim "HasElevatedPrivilegeBadge". Both can allow the same action. Now which one should I pick if I want to allow only certain people t... |
We are restructuring our entire database / filesystem / user identity system. As a first step, we have determined that we need to assign each user/employee in an organization unique ID. Surprisingly enough, there does not seem to be theoretical resources regarding such a problem.
I wonder whether there are some recomme... |
How can consecutive periods of time (defined by a start and end date) be stored in a database?
For example:
from 2018-01-01 00:00:00+01:00 until 2018-06-01 00:00:00+02:00
from 2018-06-01 00:00:00+02:00 until 2018-10-01 00:00:00+02:00
from 2018-10-01 00:00:00+02:00 onwards (meaning 'indefinitely')
The important factor... |
Please note: although my question relates to DDD, I am also interested in this from an architectural and OO design perspective. This question may also be a simple case of CQRS and/or interface segregation. Code examples are in Swift as this is the first language that comes to my head right this second, but this is uni... |
Let's say I have a function that calculates a sensor output, all values are >=0, but also I have to detect some error situations like "NO_POWER" which I encoded with value "-65500". On my application there are classes that only care for the real output value (regardless if an error is present) and other classes that ne... |
The way I explain it to myself is that a business rule is a requirement for a domain concept of an application.
One of the core tasks of my current app is to send notifications. Therefore I have a Notification entity, amongst others.
We are now facing the situation that I need to split a message in 2 parts and batch se... |
Is it acceptable to use id in HTML forms and subsequent code processing (controller, view, model, repository layers)?
For example I need to show something like this on a web page:
Select Motor Choice:
* 460/50/3
* 380/50/3
* 460/60/3
In HTML this can be done with a radio control, where each line has a value attribute,... |
We are going to develop an enterprise level application which will be run by a dozen microservices. Every microservice will be inside docker and all this will be orchestrated by Kubernetes.
Obviously, we need some logging solution and here is a catch. The application will have two kinds of logs, the first one is regula... |
I am working on an enterprise level application. I have an event table in the database. I need to update my events' states in the database on a precise date and time. There may be 200 milliseconds delays max. Since my event table will grow over time, I think long-polling may be a performance issue. In my application, w... |
I understand we need it to mark a class whose objects can be serialized, but do we strictly need this for behind the hood logic to work? We could just serialize the object using necessary methods. On the other hand, if we want to prevent serialization, then having this attribute makes sense, in that case [NonSerialize... |
I'm trying to decipher/understand the best way to implement Model-View-Presenter architecture for the following Android example app...
The App:
I'm attempting to implement a very basic weather app using MVP but I'm hopelessly lost on the best way to implement the pattern. The app consists of two Activities - MainActivi... |
I'm an undergraduate student and I have this assignment on a Discrete Event simulator. Currently I have completed to the end of v1.2 here. Attached also, is an algorithmic overview.
I have wrote my code as such to solve the problem at hand. This code passes all given test cases, but I think there is definitely room f... |
I am working on trying to understand the SOLID object oriented design principles. I was able to get the "SOL" pretty easily, though "L" required some hand holding because I am bad at definitions. I think I understand the "I" (I might not, which may belie my confusion). But "D" or Dependency Inversion is tripping me up.... |
I recently came across a dictionary with lists for values passed as an argument:
Demo(Dictionary<string, List<string>> arg)
It got me thinking---normally I would abstract any list or array to an IEnumerable with the same element type. Similarly, a specific dictionary could be abstracted to IDictionary. But a nested co... |
I have an existing SPA application where api calls from user browser are forwarded to application server hosted separately. My application server have all business logic and repository to connect to DB. Something like below :
we are thinking of merging application layer with rest api so that new design would look like... |
I am trying to wrap my mind around a Liskov Substitution Principle and I came across this article.
SOLID Class Design: The Liskov Substitution Principle
In this article, the author gives an example of a Flightless Bird(Penguin) to extend a general Bird class that would be closed for "addition to the new type of birds."... |
I'm confused about the behavior I should expect from a client when thinking about design patterns. To be more precise, I'm reading the Head First Design Patterns book, and on the difference between the abstract factory and the factory method pattern, it explains that by using a factory method, we don't have full contro... |
In a distributed asynchronous system serializability cannot be achieved, but we still have to somehow provide the semantics.
Consider quite natural requirement that user must have unique email or no email at all. (Option of not having an email implies that we cannot use email as a unique actor's address.)
What should h... |
I have a class UnitInfo which represents a collection of unit information with methods to get the unit information in a structured way, such as a specific encoding, etc. This unit info consists of information which must be read from the unit via serial port communication. The constructor of the class is given the seria... |
I am trying to solve the following problem in a microservice architecture. I am very new to this architecture so let me know if I miss use some of the concepts.
Here is the problem I need to solve:
In an E-Commerce system, a user can place an order for some products.
15 days after the order creation, the system must... |
Consider this code:
new FrameworkClass( [ 'query' => $_POST[ 'input' ] ] );
FrameworkClass is supposed to do input sanitization and validation. Should we just trust 3rd party code to do it's job?
My argument would be that I would rather have my input data sanitized/validated twice than trusting an external library.
If... |
I try to use the best coding standards/practices, however in all of my googling and classes I have never learned which is proper form for declaring/defining variables like the examples below. I have seen numerous different people (teachers, classmates, coworkers) define variables inside and outside of the constructor s... |
I have a Flask application with tens of complex models, almost all of them related to each other.
A simple pseudo-schema of some of them:
+----------------+
| FoodGroup |
+-------+--------+
^
|
+-------+--------+
| Food +<------+
+---+------------+ | +----------... |
When I write python code for simulations, I often end up with the following situation: I have a class describing the general environment which contains a list of instances of a class that describes the individuals being simulated. In turn, they contain a class describing their behavior which depends on the environment.... |
I'm working in a scenario where I have a backend (let's call it the server) and a frontend client app (let's call it the client).
The client is entirely headless, and can connect to any instance of the backend installed on a server (supply the URL).
Over time, we can expect the backend to grow and branch into new API v... |
I'm trying to understand event driven design better and have not picked up a book on it yet. But just from others explaining it to me it seems to be really similar to state machines/charts. What are the similarities and differences between the two?
|
I'm reading Software Engineering book written by Ian Sommerville. On chapter 23 (Project Scheduling), a hypothetical activity chart is given with tasks, their dependencies and duration.
Following the table of the tasks with their dependencies and duration:
Now from this table an activity bar chart is created:
Now I'... |
Is there a way to ensure that serviceA is called only by serviceB(or a set of whitelisted services)? All the services are independent and do not go through a service gateway as they are completely independent.
Are there any good microservice patterns to follow up on this?
|
I am a newbie to algorithms. One thing that i always get confused is about calculation of algorithm runtimes.
For example: The following piece of code in Python
for i in range(n):
#O(?)
i*=k
What is the runtime of the above for loop?
The answer that has been provided to me is: O(log n to the base k).
I am fin... |
I have a tendency to invoke methods directly on a new class instance like this:
new Person().GetAge()
when I don't need the instance of the class (here Person) after the invocation.
However, I have seen many developers recommend using this pattern:
Person p = new Person();
p.GetAge()
What are the benefits of declarin... |
I am learning Event Sourcing in my spare time. I see lots of references to 'CRUD type systems' online. I understand a CRUD type system to be:
1) A database driven system (website or application) i.e. a system that supports creates, reads, updates and deletes. A domain model is not needed in this case.
or
2) A system... |
For my Android application, I wanted to store values such as username, userid and stuff in a sharedpreferences object. However, when I read more about it, rooted users can still have access to those values. So I am wondering, if I store those values in static variables in a class, for example:
class foo{
public stati... |
Following reading Thomas Owens response (many thanks to him) on Is it reasonable to build applications (not games) using a component-entity-system architecture? and his explanation on what is ECS compared to others architecture design patterns.
I am using Angular5 and Unity a lot. I am asking myself what is the differe... |
I'm wary about on-premise solutions. It appears to me that the client has access to the source code and can easily steal it. Is this software business model safe for the vendor?
Are there any successful companies that are based on on-premise solutions?
|
I started working at a very small company that regularly (not too often) has to outsource some software developments. The external suppliers than have to deliver something.
As I now have seen is that the suppliers deliver a very varying quality of the deliverables - this covers sometimes only being the binary executab... |
I have created some stateless functional components that represent round social media icons used for links/sharing, the code looks like this:
AbstractRound
import React from 'react';
import { withStyles } from '@material-ui/core/styles';
const AbstractRound = ({
imgSrc,
classes,
alt,
}) => {
return (
<im... |
Facebook systems claim that this picture may contain violent or graphic content.
(When opening the link, Facebook asks you to login. I suppose it's because Facebook considers the image offensive and hides it from people haven't logged in).
Here's how it looks before you click on "Uncover photo":
Compressing the pictu... |
I like SOLID, and I try my best to use and apply it when I'm developing. But I can't help but feel as though the SOLID approach turns your code into 'framework' code - ie code you would design if you were creating a framework or library for other developers to use.
I've generally practiced 2 modes of programming - crea... |
I need to consume data from a WCF service, which pipes it through a stream. The data itself is contents of an archive file, so it needs additional logic, which I am splitting off into a separate class.
Now, normally, I would use a couple of nested using statements, like so:
// Inside class that does the retrieval
usin... |
I've recently been introduced into Domain Driven Design and we've done a lot of event storming in a simulated environment with a lot of people.
Now I'm back in the real world and I've been given a task but I need deeper insight in the process.
Does it make sense to go out event storming on your own to do this? Or is ev... |
For example, I have a toggle button, which would show the current selected element, and would show next element when it is clicked, and it can loop back to first element. I have 2 ways to store the current selected element:
1.Use a variable i to store the selected index:
<button id="b" onclick="onButtonPressed()"/>
<bu... |
I'm thinking about adopting the clean architecture.
The main thing in this architecture, as I understand it, is the dependency flow from top to bottom. So the first thing that I asked myself is: what would be the cost to change the bottom layers (i.e Entities)? This layer will have lots of dependencies, and by changing... |
A typical highload reactive architecture is:
(Q means queue)
And usually arrows are from client to DB at such sketches. My question is how the response is going back? The same queues and other stuff?
(Pictures links to presentations / video are appreciated)
|
This is a very common feature in software, and I am sure there is a whole deal written about it, but I really don't know what the technical term is, so here I am:
I am talking about giving your service or product the ability to save the state of some data to be able to access it in the future and rollback changes. This... |
I need help settling a disagreement, a co-worker and I have. We're working on a pretty huge Angular project and are in the process of looking at incorporating some Domain Driven Design principles into our project.
While we were looking at this picture, we discussed how our Dependency Injection Framework would factor in... |
We have a C++ project managed by UML software, which generates code for instantiating and passing data between objects. Unfortunately, this software adds a lot of overhead to our builds and development so we're looking to migrate our code away from it and cut out the generation step.
The generated code has container cl... |
I am writing software that deals with ephemerides—tables describing the positions and orientations of celestial bodies or spacecraft—and I am struggling with how to represent them in the my code.
Some background: the inputs to this software are a set of ephemeris files chosen by the user, in various file formats. I ne... |
I have developed an application which I intend to sell. I set up a website with information and download links, advertising, payments, everything is ready to go - except the digital signature. I want to sign my application so that Windows and various antiviruses won't nag my customers about an unsigned, unverified appl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.