instruction
stringlengths
34
36.1k
Usually, I open a git branch to work on some task. When I finish the task I send it to be reviewed. Then it's sent to central staging git branch which contains all tasks that have passed review. Our QA team does qa for tasks in the staging branch. Before sending my work for review I usually have print statement in quit...
Dependency Injection forbids casual use of new. It favors good old reference passing. It says to put new as high up the call stack as possible. Convention over Configuration says the common path should be the easy path. Building the typical version of something shouldn't require much effort. These ideas seem to be at...
I am developing a Bank Management Project. Now I am stuck in a point. I want to create a login page where a user will submit his/her username and password then after clicks on the login button, a new page will arrive and show his information on text fields or panels. So how can I connect my login page to my user dashbo...
Python, has the library pathlib with the concrete class Path. I have a class called Cleanup, that looks like this: from pathlib import Path Cleanup: def __init__(self, source : Path, destination: Path): self._source = source self._destination = destination The Cleanup class uses certain methods o...
Link says MVC – Model View Controller Let’s look at MVC first. You’ll notice a few things about the diagram: The input is directed at the Controller first, not the view. That input might be coming from a user interacting with a page, but it could also be from simply entering a specific url into a browser. In either...
I am trying to build software in JavaScript that emulates an operating system. For all intents and purposes, it is an operating system, even though it is JavaScript and we are running in the Node.js or the browser basically. But that shouldn't matter, the fact that it is JavaScript. It could be in any language or platf...
In MVC, the view component doesn't receive user input directly, but the controller component does. When the view component creates a view, does the view component deliver the view to the user directly, or does the view component send the view to the controller which then delivers the view to the user? Are the answers...
I am learning about MV* architectural patterns, thanks to the help from several answers here. I learned that they are used for designing the architectures of user interactive applications. I also learned a little about functional programming (Haskel, Scheme/Clojure, SML/OCaml, Scala). I was wondering if MV* architectur...
I have rewritten a package that has been abandoned for a while now. The old package is in active use, but has problems. It is a client of another API, and does not provide all features that the underlying API supports. And its documentation, GitHub repository and release are out of sync with each other, which is very c...
I have read some blog articles, papers and books about Continuous Integration and Continuous Delivery, but I still can't find a point where you could say this is where CI ends and CD starts. I understand that CI is about integrating code changes by automatically building the new version of the software and testing it ...
I'm planning an empirical study on function passing - specifically lambdas aka anonymous functions aka arrow functions. Now, although functional or even object-oriented approaches are highly favored over procedural/imperative programming nowadays, there seems to be very little empirical evidence for their superiority. ...
Procedural Paradigm according to Wikipedia: Procedural programming is a programming paradigm, derived from structured programming, based on the concept of the procedure call. Procedures, also known as routines, subroutines, or functions, simply contain a series of computational steps to be carried out. Any given proce...
For the purposes of this question I can use an example document straight from the HAL spec, since my problem is very similar: { "_links": { "self": { "href": "/orders" }, "next": { "href": "/orders?page=2" }, "find": { "href": "/orders{?id}", "templated": true } }, "_embedded": { ...
I'm curious how the async/await syntax is converted to Promises. Maybe I'm just not thinking about it properly, but I don't know how this code would be converted to a Promise: async function myFunc(doAwait) { doSomething(); if (doAwait) { await doSomethingAsync(); } return doSomethingElse(); }...
Conisder the following piece of code : cin >> a >> b; int x,y,z; x=0; y=1; z=1; if (a > b){ x = a*b; while (10 > a){ y=y+z; a=a+5; } else { x=x+b; } Its Directed graph is shown below : Now the next figure is Annotated tokens showing the slices on which the tokens occur Now from the above figure we can calculate ma...
Well in the past during education about integrated systems we've been thought a lot about FSM and how to design those. It was a good tool to "talk" about complicated systems and create a common baseline. Now in an update to our application (some kind of webshop integrated into a lot of other tools), the "state" of the ...
Some modern languages (e.g. Swift, Dart) do not support the protected access modifier keyword. Swift is a protocol-oriented language, but I've heard that Dart is a completely object-oriented language. Why don't these modern languages ​​support protected? Do you only need private and public for complete object-oriented ...
I am implementing a grid-like game. The initial state is shown here: +++===+++===+++===+++===+++===+++ | | | | | | | | | | | | +++===+++===+++===+++===+++===+++ | | | | | | | | | | | | +++===+++===+++===+++===+++===+++ | | | ...
I've seen the Wikipedia page about it a while ago - but I can't find it now. The problem is something like: Mary lives next to Jane Rob has a green door Mike likes dogs Jeff likes cats and can't live next to Mike Steve lives across from Rob and Jane Who lives next door to Jeff? It's a really old puzzle (I think Worl...
Is there a design pattern or structure that helps to organize code with variables whose values are related? For example, let's imagine I have an object with three properties (gonna use some pseudo code): isVisible: true | false; activeUser: User | null; type: 'editable' | 'read-only' | null; The issue here is that, on...
In framworks for developing app whether it be a joomla or react or angular i see app class. What does it mean. Like if there is some user class, or some input class or that make sense for some purpose we are creating these. what about app class for what purpose one creats app class. thank you
I'm exploring Event Carried State Transfer patter, I understand how it works, but there is one problem I don't know how to solve. So, in ECST, a service can listen to events and then build a private state from those events. As an example - let's say I have a User service and my service consumer CRUD-like user-related e...
Lets say I have a component that render some "static" information and another one that is the parent of these components. function Foo(){ ... return ( <Bar name="I" {...otherPropsThatChangeFromEachChildren} /> <Bar name="am" {...otherPropsThatChangeFromEachChildren}/> <Bar name="a" {...o...
I am wondering which API url scheme should I use. I am designing multi-site project so that the URL can looks like: [GET] /website/1 [GET] /website/1/category [GET] /website/1/product Which is life saving since we inject the root website id for the resources we want to list but there are cases when this is not importa...
I'm writing a parser that needs to accept unstructured input. By that I mean it needs to take in a raw signal (text, in this case) and look for significant character sequences while accumulating the non-signal text. For example, given the following input: Hello! I am a block of noisy text. This is a \symbol significant...
I'm new to Airflow and I'm working on a proof of concept. The project is fairly simple... every day some 10,000 JSON files are loaded onto a folder on AWS S3. I have to get each one of them, parse them and then load them into a database. It seems like this just requires on PythonOperator? This is my idea: Check the S...
If we start a .NET Core 3.0 project today, which will use database connection (for example ASP.NET Core Web API), is there still a place for non-async operations while talking to the database? Or in other words: Should we always (by default) use async/await in Data Repository methods, while directly querying the databa...
I am developing a small ERP software. I'm wondering how to design entities as well as where to join them. I'm just gonna start with an example, that makes it way easier. Say I'm modelling a maintenance contract. 1 Contract 1-n Machines 1-n contacts 0-n appointments 1-n purchasing prices ...
Suppose I have a big project, called Northwind. It's a website in front of a database. Now management want me to create a public API for this. I create a new ASP.NET Core project called Northwind.Api But now the customers want a nuget package to invoke the API with. (They don't want to invoke REST calls directly). I wo...
Say I write a function which expects the input to be A or B. The input may be C, which is technically valid but should be impossible if the logic of the rest of the program is working correctly. Should I: Add an if-else clause to handle all the possible inputs and throw an exception / return null if necessary. Assume ...
For example, I want to convert json from server to generic object: Shape, as follow: { "type":"Circle", "radius":"3", }, { "type":"Rectangle", "width":"5", "height":"6", }, using c++ and rapidJson as example here: /*main.cpp*/ void getResponse(const char* responseText){ Document d; d.parse(...
SCENARIO I am implementing "command pattern"-like classes. Since they are so similar to each other in so many sense (e.g. functionally, their relation in domain problem, etc.), it is desirable to enforce them having similar structure. Let us use an anecdotal example Merger. class Merger { /* ... details are omitt...
From Distributed Systems by Coulours, a distributed system is partitioned into layers Middleware is defined as Middleware was defined in Section 1.5.1 as a layer of software whose purpose is to mask heterogeneity and to provide a convenient programming model to application programmers. Middleware is ...
"All modern chatting interfaces, without exception, implement a hierarchical and a not-chronological schema for chat" I was searching for SO answers and came across this: https://dba.stackexchange.com/questions/192172/how-to-create-a-flexible-table-schema-for-storing-messages-from-different-chats What are the benefits ...
You probably know PRG (Post/Redirect/Get) pattern used in web applications to avoid double form submission (and usually conseguent item duplication in a data store). But I keep reading this is not a 100% safe practice to solve the double submission issue: The PRG pattern cannot address every scenario of duplicate form...
Some requirements of a system are for the system itself, or for the developers, how do I write user stories for this? For example, there are requirements for a system to: provide APIs so that partner apps can interactive with it, and the APIs should be flexible and rich enough for various apps. I can write user stor...
I am learning OOP, concretely Java, by developing a real life business application for aimed for repair shops. I have followed MVC pattern design for GUI elements of my application. I was wondering do my input dialog controller classes has to much responsibilities. They set ComboBox models, button ActionListeners, veri...
What's the most intuitive way to organize a set of endpoints to fetch users and their roles in groups? i.e. Users and their roles in a specified group. Groups a user is in, and their role in each group. Attempt 1 We began with the following: message UserWithRole { User user = 1; Role role = 2; } message GetUsers...
I have a C# Program that creats PowerPoint reports filled with statistics of a chosen (by the project manager who operates with the tool) company (each one has a companyID). The statistics are coming from a SQL Server Database but they are calculated over many different tables some based on surveys(like average workin...
Before the advent of OOP, how were systems modeled in other paradigms of Programming. Obviously, software programs existed prior to 1970's and they interacted with people and where used in crucial places. How did early programming paradigm tackle the problem of modeling data.
As far I as I could tell, the proper way to show an object creation in a sequence diagram is with an asynchronous arrow, e.g., However, in Java (and other OO languages I have used), as far as I know, a new() operation is blocking. I noticed that some references (Craig Larman) use a hybrid message (dotted line with fil...
The website I am building has a real-time messaging component. The backend is built with Flask and I have integrated Flask-SocketIO to handle Websocket connections when users are on the messaging page. My current infrastructure is pretty simple. Flask handles both HTTP requests and Websocket events. When users land on ...
I'm creating web applications using Asp.Net Core Identity with N-Tier architecture. Lately I've been discovering many properties of this library that I didn't know before as I need to configure the system. I'm at a point where I'm trying to learn how to customize these parts of my system rather than developing my own c...
According to Understanding "programming to an interface", as I understand, I think I should depend on abstract class only. However, in some case, for example, Student: public class Student { private String name; private int age; } to modify it so that it becomes depend on abstract class only (which MyIString m...
I've been reading about machine learning models deployment and pipelines and so far most of the sources suggest that the data should be ingested from some sort of cloud based storage or source, be it AWS S3, Kaggle, Bigquery or whatever else. Now the thing is that in my company we analyze sensitive client data which i ...
Hello, I want to secure access to a POST request so that the user cannot forge it via software such as postman. Let’s say a player plays a game and gets a score. At the end of the game, the score is sent to the server through an API via a POST request. I want to be sure that this POST request was sent by the applicatio...
I am reading Domain Driven Design by Eric Evans and there are 2 sub-chapters - Abstract Core & Pluggable Component Framework - that seems to me to refer to the same concept. I believe that there is a subtly difference, but I am missing it. Abstract Core Identify the most fundamental concepts in the model and factor th...
This is more a general question about this project I have on. We need to implement some UI for our costumers to upload multiple files (2000+) every month, so we can send them by email to another customers. Now a day we have a project in PHP, reading the files locally (customers upload via FTP client) , then upload each...
We got a distributed application where a client syncs certain data portions to its offline storage and performs modifications on it. The data is structured in container entities "Container" and entities "Entity". Each "C" contains many "Entity"s and each "Entity" has to belong to a "Container". When the client updates,...
I am building a web application connected to MySQL database that is supposed to work like an e-shop. User should be able to filter products, but I want to display the number of results that would be added to result with each choice, like in this picture: This should work across all parameters (like all display, batter...
I'm working with an old C module that was originally ran on Power PC architecture and compiled with gnu 3.0.6 I'm porting it to run in a VS2012 project on Intel hardware. The module creates a 3D model of a storm cloud based on a bitmap file and other IO. I keep seeing signed magnitudes (x- and y-coords, -differentia...
I recently saw a comment on StackOverflow that basically said it is a bad idea to alter tables on the fly. In my case I have a json file that is storing some information about some "products". One of those pieces of information tells other programs which column in a data table is related to this product. This id is not...
I have a method that calculates the price a certain vendor gets for an item. Simplified it checks whether we have a price for that specific vendor, if not check if we have prices for that specific vendor group, if not get the normal price. There are several possible outcomes here: Success nothing found MultiplePricesF...
I'm currently completing a school assignment that asks me to create an architectural design for my system, and then an appropriate set of system models. Though, I'm a little confused about the difference between the two. Can anyone explain? I've been trying to find lists of Architecture Design Models and System Models...
I've always loved trees, that nice O(n*log(n)) and the tidiness of them. However, every software engineer I've ever known has asked me pointedly why I would use a TreeSet. From a CS background, I don't think it matters all that much which you use, and I don't care to mess around with hash functions and buckets (in the ...
I've been working for the same software company for nearly 14 years now. Over that time I've seen plenty of technical debt being accrued. I think that is inevitable for any long lived software company. However, we've never had a strategy for dealing with it. We are aware of the technical debt, people complain about the...
I am currently trying out DDD with a sample application, "Task Management System". This is not related to any specific domain as such, it will be a generic application which can be used in any domain. Main concept of Task management is "Task". It can contain multiple sub-tasks. Every task will be created with some pre...
I have a service which is composed of various independent small "blocks" of logical code. A block stands for a class which implements an interface "IBlock" which includes an "Execute" function that gets a BlockRequest parameter and returns a BlockResponse parameter. Each logical block usually does the following: Get s...
I was arguing this point with my boss the other day. He claims that the larger the code base the riskier the deployment. I argued that this is not true, though I see why he might think that. In my experience the size of the code base doesn't matter if you follow solid principles and have good tests. I tried to give exa...
Bartosz Milewski, in his book "Category Theory for Programmers" says that: Composition is associative. If you have three morphisms, f, g, and h, that can be composed (that is, their objects match end-to-end), you don’t need parentheses to compose them. In math notation this is expressed as: h∘(g∘f) = (h∘g)∘f = h...
I have the following hierarchy: venue -> concert -> booking And within booking I have a relationship for the concert. But should the booking also have a relationship to the venue? Or is it bad practice to have relationships at that depth? What about if there was also a seat in a booking? Would a relationship to venue ...
I'm embarking upon a project where the goal is to create a bidirectional sync mechanism between two database systems with differing schemas. One is a custom CRM app build on MongoDB, the other is Salesforce (conceptually SQL), but I'm looking to build a mechanism that can theoretically link and sync any two database s...
I have a use case like this and I am wondering if this solution is a good practice or not. Say I have a website called dashboard.com and this is only for US region. When users login here, I am storing their session into USRedis instance. However this dashboard has two buttons named USWebApp and EUWebApp. Assume that t...
I've been working on a web app that's divided up into different web pages (around 20). It's only used within my company and it looks at financial data. It's a few years old and is in dire need of an overhaul. Over the past few months I've been tweaking it and the plan is to completely revamp its styling and a lot of th...
I need to get rid of if, else statements from my code as it is a smell. I know you can implement the state pattern to get rid of them, however in my code I'm checking if the string input is a certain operator and then doing things on a stack. How would I go about this? Should I make different states which do the maths ...
considering you need to design a simple wallet service that keep tracks of transactions, and give balance for each account. I started designing the solution using event-driven architecture, so every transaction is an event, and for each transaction we might have different status records, as we use event-sourcing for ke...
I've built a meme generator using React as an early project to master the basics. I have 6 files in my "mememaker" folder on my desktop, which I created using "create-react-app". They include: index.html, the parent file that will be displayed which links to style.css and index.js. Index.js is simply rendering the App....
With a monolith we have one huge api project for which we used plural nouns to represent each entity. For example http://monolith.domain.com/Payments, http://monolith.domain.com/Customers, http://monolith.domain.com/Orders, etc. With the microservice architecture, we now have the plural noun as the microservice itself....
I have an offline application and the data is 2-way synchronised between server and the app using pouchdb-couchdb. One requirement is both the server and the app must able to mutate the application data. Now I have the problem to maintain large application logic on the server side, as there will be multiple version of ...
I have a tree generated by configuration. Each leaf of the tree is a long running task (like DB query, reading from file, etc.) that gives a result I want to store in a mirrored tree with only the results; non-leaf nodes don't have any computation (the structure and height of the tree is given by configuration). In th...
Background I have a system that comprises of 3 components: a web application that displays data and allows data manipulation by users (React) a server application which serves the data to the web application and handles the manipulation requests (Node) a command line application which builds said data (it takes inpu...
Is it possible to have a scenario where there are 3 email addresses. Each on a different mail server. alice@contoso.com bob@fabrikam.com charlie@treyresearch.net Charlie writes an email with Alice and Bob listed as recepients. Charlie uses a rogue SMTP server treyresearch.net that only carries out the SMTP transactio...
In an UML 2.5 State Machine, how can I model sending a Signal as an effect on a transition in a convenient way? In one of the older UML versions you simply prefixed the name of the signal with a send keyword in the effect part of the transition specification, like: response [buffer.size>N] / send request But in UML 2....
From Distributed Systems by Coulouris: Tiered architectures are complementary to layering. Whereas layering deals with the vertical organization of services into layers of abstraction, tiering is a technique to organize functionality of a given layer and place this functionality into appropriate servers and, a...
I recently switched jobs to a new company which develops a .NET framework based product which has been on the market for like 15 years already. Some of the engineers are in this project almost from the beginning, while most of them are in the company for a shorter period of time. I was used to write lots of tool / exte...
I have a basic java Dropwizard service within cluster of microservices. It manages user resources with restful api styles. Let's call it user-app Then there is a new operation / api endpoint that takes long time. I decided to have a background jobs (with Quartz) to remove the long running operation from user-app and in...
Research leads me to believe the most common architecture for a multi-instance (horizontally-scaling) message relay service (the typical example being an instant messenger/chat service) is to distribute client connections among the instances via some load balancing strategy. The instances hosting the clients wishing to...
I am in the process of evolving architecture for an 'equity analysis system'. I will be using SQLServer as the database, but I am not going the .NET route and won't be using the built-in 'membership' features. I have designed the user, user_credentials, roles and permissions tables. The 'credentials' table stores id, u...
Imagine there are two solutions that each have their model, and data layer separately, and are developed separately on different git repositories, but they both are using the same database. Now, team A is working on SolutionA and team B works on SolutionB. team A makes a breaking change on their model while they are wo...
Suppose I've a Person object. This Person object in turn is having name, address, accountNumber and many other fields. Now my requirement is that I want to maintain multiple version for each person in such a way that if I'm asked to give what's the state of any person at a given point in time, I can "re-construct"/"fe...
I am writing an android app. Some of its functionalities require the user to be authenticated. I am planning to create an annotation like this: @RequiresAuth fun commentOnTask(){ .... } This annotation would check user status. If authenticated the function would be called; if not, it would navigate to login screen. ...
i am building a single page react app that uses redux as state manager and an express node js as backend server but i don't know what is the best way to authorize my users in the application! if it was php or express-js website i could use PHPSESSION or express-session to manage users sessions data but now the single p...
I have a collection of view objects. Each one of these objects must 100% implement the following interface: /** * Interface that each base ViewBlock object must implement. */ interface ViewBlockInterface extends CosmeticInformationInterface, ScriptInterface { public function getBlockName(); } Now, here's 2 inte...
I have lots of experience with regexes. I just want to make sense of this. Am I missing something here. Which one of these would you rather validate with a regex? Question reads, Which of the following is the best use case for a regular express? Select the correct answer: Validate an IP address Validate a SQL query ...
I am working in a system which only supports 32bit integers, in order to have a 64bit (unsigned) integer I decided to simply use two 32bit integers with one being the upper 32 bits (hi), and the other being the lower 32 bits (lo). I also needed to create arithmetic for this [hi, lo] structure, but I found it near impos...
I am trying to design a Chess Game using OOPs concepts that has a UI element to it. My idea is to show the number of squares / cells a piece can travel to when selected. Basically I want to show the paths / directions in which the it can travel / attack in a different color. Some thing like the following () So I have d...
Is it correct that MVC is an architectural pattern only for user-interactive applications? (That is my understanding.) An application can interact with users via GUI or CLI. Does MVC apply to both GUI and CLI applications? (I guess so, but am not sure.) What architectural pattern(s) is used for CLI, if not MVC? If ...
Is the purpose of the indexing data structures to address the limitations of disks? If data is stored in RAM, do we still need index into data? Thanks. Question comes from Design Data Intensive Applications The data structures discussed so far in this chapter have all been answers to the limitations of disks. Compa...
I am trying to design a Chess game where each piece of the game inherits from an abstract Piece class. The piece just does a few things: It tells which color it is (White / Black) It tells what type it is It tells if a move is valid or not and maybe what cell / square on the board it is currently at Earlier I was th...
The have been tasked to create a software application that will parse a set of 150 documents, extracting certain data elements (not html elements), such as tables, comments, invalid content, invalid characters, etc. Unfortunately there appears to be very little conformity in how these documents are arranged or formatt...
I am reading Kafka, the definitive guide and I came across the below point for consumers. heartbeat.interval.ms must be lower than session.timeout.ms, and is usually set to one-third of the timeout value. May I know why is it, I thought both should be the same, let's say if I set the session.timeout.ms to 10s and heart...
I have a setup of a class that represents a building. This building has a floor plan, which has bounds. The way I have it setup is like this: public struct Bounds {} // AABB bounding box stuff //Floor contains bounds and mesh data to update textures etc //internal since only building should have direct access to it no...
I am working on setting up a game in pygame and I've noticed that there isn't really a lot available for event handling. Basically, pygame has a queue of events that you can pull and iterate through every frame. It's easy enough to do, but I feel like it makes for messy code and a lot of copy-pasted logic. I created a...
I have an angular application, which is querying an API as a client (written on Spring Boot 2.2.1 + Spring 5.2.1) that supports 3rd party authentication over OAuth2. The API has altogether 3 different authentication strategies namely, Username + Password - For initial authentication. Upon successful authentication, th...
I have an existing piece of code that uses a database. In order to understand its algorithm, I try to represent it with a flow chart. In this algorithm I need to fetch some data from the database in order to run a procedure. For example I have this algorithm that stores a reservation for a hotel room: Fetch url slug,...
I programmed a CAN Bus logger for the ESP32 with ESP-IDF. Currently this is just one main program with one loop. In that loop data is read from the CAN-Bus receiver and written to one log file on a SD-Card. Now I also want to receive data from the UART serial port. And that data should also be written to the same log f...
I'm creating an .NET Core 3 API with Entity Framework. The data is from an existing database. Now I've the following situation: /persons -- get all the persons /companies -- get all the companies /attributes -- get all the attributes /attributes/groups -- get all the attribute groups /attributes/types -- get all the at...
You'd often see that JavaScript is actually being transported over the web with all the useless stuff that doesn't need to be there -- Comments, particularly those containing licenses, indentations ('\t', '\n'), etc. Given enough time, it could end up wasting terabytes of data worldwide! Would a JavaScript bytecode ca...
I have a aggregate root named "Project". It has some basic attributes like name, duration, documents. I have another aggregate root named "Task". It also has some basic attributes like name, duration,documents and some more. We have scenario where a user can add more than 200 tasks to project. Creating List of tasks a...
My team is currently developing an application using a microservice architecture with publish/subscribe interservice communication over a message bus. Certain types of HTTP requests and messages received as inputs to a service might cause that service to subsequently publish certain types of messages as a result in add...