instruction
stringlengths
34
36.1k
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...
I trying to learn the Command design pattern, I already know how it works and where it is used, but I'm a little bit confused about the implementation. So I know we need to set the context by passing the object to the constructor or as an argument to the execute() function. What I don't understand is why do we need to...
I'm working on a website that has a section that shows the company's stock details and investor-related data. This data is retrieved through scheduled SOAP API calls. I created two scheduled tasks for achieving that: feth-data (every 10 minutes): retrieves data and stores it in cron_last_trade_price_graph which a grap...
There is an LGPL open source code in SourceForge that is quite useful, but entirely abandoned. I can see that the community struggles with code issues, but the original developer does not respond to any communication and the code has not been changed since 2008. The code is under the license LGPL. The Licence.txt in t...
I have received multiple reports from users of a Web-based GIS application we have rolled out one to two year ago, complaining the application becomes unstable/unresponsive. After a brief investigation, I found that requests from the third party Map API take up most available connections of browsers (pulling dynamic la...
I am struggling to understand when to use each of these: 1) Message Bus: Used to send integration events between Microservices. For example, Microservice A could publish an integration event, which is handled by Microservice B and Microservice C. The benefit of a Message Bus e.g. RabbitMQ is that it could be durable ...
For example we have entity object: { "id": 10, "name": "First object", "status": "new", "manager_id": 200, "links": [ { "href": "self", "type" : "PUT", } ] } How can the API express through HATEOAS that the field status can only have the values new and co...
For my domain entities currently, all validation errors cause exceptions to be thrown. I don't like this as it doesn't allow me to compile all validation errors before exiting a method. I'd like to pursue something similar to what's described here: https://enterprisecraftsmanship.com/2016/09/13/validation-and-ddd/ ....
I have a class, that takes a lot of esoteric parameters to construct an object. I didn't write the code and frankly speaking, I don't understand completely, all of it's nuances. There is a valueOf(String) method of this class, that is primarily used to construct objects of this class and it also does fairly complex com...
I'm trying to learn the Command design pattern and apply it to the game I'm working on. First I read about the general implementation, and I feel like I understand it pretty well. Now I want to know how to use it in games. I started reading this book about design patterns in games and in the section about the command p...
In a feedback for a (deleted) question I asked here last year, I was told that there is not easy way to do software testing. We may find prepared test cases for protocols but in most case the test are based on the requirement and most of them are for that reason unique. Today I was preparing a thesis subject for a stu...
I need advice on how to version builds based on shared and separate codes at the same time. I have a gradle project with multiple flavors. Large part of the code is shared. Some parts are flavor specific. Depending on which flavor I target, the corresponding code gets included. I currently use semantic versioning. v1.2...
I'm getting ready to do some work on an embedded firmware prototype that has a GPS chip attached to it (straight C on an arm0, no OS). I'm torn on how to model UTC instants and time deltas. Traditionally in C, I'd just pick a resolution and an epoch offset and model things with "big enough" integers, but I wasn't worry...
I am wondering what is the recommended folder structure for a C project. I read several posts about using src, include, test, build folders. But what if I want to structure the project in modules? Should I use a structure like: src/ core/ main.c sysinit.c interrupts.c ... module...
I have a website that follows the following structure: www.example.com/city1 www.example.com/city2 ... Programmatically we change the logo which is hard-coded in a specific config file for city 1, city 2,... They are files in a folder structure like /cities/city1 or /cities/city2. The colors can be changed by the ad...
I've always used CSS and media queries when it comes to responsive design. I've been developing in ReactJS for a while, but I feel my approach to responsive design is sloppy. I find myself using a mix of CSS and Javascript, depending on the situation, to determine the screen size of the user. I'd prefer to solely use C...
I'm a programmer with ten years of experience. I've worked as full time programmer in 2 companies in these ten years as a software developer. I have always loved to have my own business. My question is, is it ok to start a business project from scratch and write every piece of code from zero? Remember for example if t...
I'm designing the base classes and I don't know if I should add the field 'domainEvents' to the Entity class or only to the AggregateRoot class. I must add the code for add and remove events in Entity.cs or AggregateRoot.cs private List<INotification> _domainEvents; public IReadOnlyCollection<INotification> DomainEvent...
Coming from Desktop development, I'm in the middle of my very first web project (as a small side/learning-project). I'm using ASP.NET Core 2. I'm already thinking about going mobile too. What are my best options here? First thing that comes to my mind is separating logic and data interactions into web API, which will r...
Originally posted at CodeReview, but it was brought up that this would be better posted here. The other question has been deleted. Creating some personal finance software, but running into an architectural issue. I have a class called Account that holds Transactions as well as SubAccounts. I'm very early into the codin...
What are the best steps to convert multi-repos to a mono-repo? This is what I have so far: for each repo, check out the most recent branch (integration branch, usually) for each repo, copy the repo folder to the new git repo (the mono repo) for each folder, delete the old .git folder Stage all the files, commit, and p...
I just graduated from college and got my very first job. I start my first day tomorrow and my boss just told me that I am going to work on a project to build a Spring Boot application. I am absolutely scared because I won't be able to code anything at all when I come in to work tomorrow since I have no idea what Spring...
I recently wrote a program in which I wrapped a map data structure to increase the readability of code like so : package wrappers; import model.primary.customer.Customer; import java.util.HashMap; public class CustomerMap extends HashMap<Integer, Customer> { } I needed all the functions of the hashmap , and want...
Section 15.3.3.3 of UML specification says: Fork Nodes A ForkNode is a ControlNode that splits a flow into multiple concurrent flows. Also 15.3.3.4 says: Join Nodes A JoinNode is a ControlNode that synchronizes multiple flows. Also 15.3.4.2 says: Fork and Join Nodes [...] ForkNode must have a single incoming Activ...
I know that there is a hardware in CPU, the MMU which takes care of mapping a given address to physical address. For example: int *ptr = 0x12345 Will make a pointer to my process address of 0x12345 which gets translated by CPU to a real address. Now my question is if I write a small kernel myself and run the above cod...
Learning docker concepts and tried few hello world. Came up with below questiob which I could not find on google. Say I am on Linux box. I want to to install and run windows (along with java, tomcat) in docker container on top of Linux. Is it possible to run another OS like windows on top of Linux in docker ? I belie...
I have a method that does something like this public void addFunds(Account account, int price) { int credits = account.getCredits() account.setCredits(credits + price) saveOrUpdate(account) } the method saveOrUpdate is already tested, so my question is: should I test the method add funds? I'm trying to follow...
In an UML activity diagram, join nodes synchronise concurrent flows by regulating the flow of tokens. The UML specifications foresees that tokens can be rejected. Section 15.3.3.4 Join Nodes says: If any tokens are offered to the outgoing ActivityEdge of a JoinNode, they shall be accepted by the target or rejected fo...
I'm struggling with X-Script attacks. I think I understand what they are but it's unclear if they only affect public facing web pages (which I will define better). The example I often see is where the attack is 'attached' to something public (such as a forum) where the user does not need to be logged in (and hence, a p...
As a personal project, I'm setting up a MMO, and writing the server in C#/.NET Core. As of now my architecture is as follows: The world exists of different areas ( you can go from area to area trough portals ). An area is called a 'room' on my server. Each room has it's own list of clients ( players, each with their TC...
Suppose I have a live website running on a live database and I have a dev website that is a duplicate of the live website. The live database is where customer transactions are stored. Suppose I do some changes on the dev website and dev database like add another column in a table. How can I retain all of the customer t...
I was reading on this SESE page about using a variable to indicate the object type, more specifically, an enum. The accepted answer states: When your weapon types enum just mirrors the class hierarchy, then this is a blatant violation of the DRY principle - you encode the same information, the type of a weapon red...
I'm working on a dozen enterprise SPA's and PWA's and most of them require impeccable IE11 support. This has been a complete pain with countless problems every step of the way. It occured to me recently that I could just focus on implementing SSR (server-side-rendering) instead and completely bypassing the need to supp...
I'm preparing some web services with Spring WS. Due to it being contract-first, I followed its guide and prepared an XSD. So far, my Web Service request XML looks like this (this is SoapUI rendered request): <soapenv:Envelope ...> <soapenv:Header/> <soapenv:Body> <sch:WorkOrderRequest> <sch:workOrd...
As a fun hobby project, I'm writing a simple bytecode VM and a compiler from a basic high-level language to the said bytecode. (Offtopic: the compiler is inspired by Jack Crenshaw's awesome tutorial - Let's Build A Compiler. Really worth a read if you aren't familiar with it). Writing the VM got me thinking - what is t...
I asked similar question earlier this morning, and for whatever reason, I'm not getting a complete answer to my question. I'll ask it a different way. I was attempting to understand Eric Lippert's blog series Wizard and Warriors and see the difficulties that can happen when you try to use the type system to encode the ...
Summary When writing methods to query for related entities, is it better to have a single method for all related entities or separate methods for each combination? Full Problem I'm writing repository classes for a .NET MVC project where each repository is responsible for querying for a specific entity type. I'm using D...
Why can't we directly convert octal number to base 8 to hexadecimal base 16 directly ? We can convert to octal by first converting it into binary equivalent, or by converting it to decimal equivalent . But why can't we directly convert base 8 octal to base 16 hexadecimal?
I have an aggregate root called SizeRangeAggregate which holds the range of size of clothing piece dimension and price for that range. I created an post rest API which create new SizeRangeAggregate. It follows the CQRS/ES which means it creates CreateSizeCommand publish it to CreateSizeCommand command handler gener...
I am practicing building applications using MVVM and WPF+C# by making a "finance application". The application contains several views with their own ViewModels. The views are in a hierarchy and are defined as UserControl with their ViewModel specified in XAML. One main model contains different financial information th...
I am working at a company that deals with software specifically designed for 3rd-party customers in a Business-To-Business scheme. We have variations of a large software, that for every customer get specialized and ultimately we end up with different editions of the same parent program. Because we are actively dealing ...
I have a set of tables that defines the workflow. Say possible states are New, InProgress, Cancelled, Complete. I have a worfklow steps table that defines which new state the current state goes to using a user response such as approve, decline, cancel, complete. My question is how would you turn this data into a flow...
I work with SQL Alchemy a lot and, as a "lazy programmer", I enjoy the convenience it offers. But the "diligent programmer" in me often worries about optimisation and the performance of the queries and more the performance of my application in respect to those queries. A major pitfall that programmers face when using a...
I am a software developer and I have developed a "software" with the following architecture: the front-end is developed in javascript using VueJs and NodeJS connecting to the back-end in python (framework Flask) via REST Api and as DB MongoDB. If it matters NodeJS and Flask are running on the same machine instaed of Mo...
When I created a c# desktop application and move the exe file to another computer that has anti virus security, the security program shows an alert as unknown exe. I want to create a desktop application and a windows installer. How can I solve this problem? The virus programs should not alert an unknown exe.
I am the DevOps/CI for my team of somewhere around 10 developers. We develop and implement a sophisticated scientific data collection and visualization web application. I am the person who introduced CI to my team and standardized and streamlined the build process using Jenkins, Maven, Python etc. We use Subversion for...
I was wondering what the state machine for a video player would be like. I can think of two states : playing and paused. When the video is playing and the user clicks on a point in the progress bar the video is paused (the video player transitions from the playing state to paused state) until the user stops pressing...
I want to know if including a file summary comment at the beginning of each file is a good way of knowing what each file does or is there a better way.
We are working on API's that call other API's that will inevitably retrieves/update a system of record like an SQL, MySQL or other database. Sometimes we'll have 3/4 layers of API's before the SOR is hit. Normally I would use a repository class when executing functions against a system of record directly via Entity Fra...
Consider two classes Dog and Cat both conforming to Animal protocol (in terms of Swift programming language. That'd be interface in Java/C#). We have a screen displaying a mixed list of dogs and cats. There's Interactor class that handles logic behind scenes. Now we want to present a confirmation alert to the user whe...
If I use .Net Core 2.0 my software must by 'open software' or what? Sorry for my English.
I am planning to set up an event driven architecture using Spring Boot apps that publish and read messages from a Kafka broker. Let's suppose it were an e-commerce application with the usual events (order placed, payment processed/failed, item-reserved, no-inventory-availability, order-shipped, and so on). In my busine...
My question is regarding the polymorphic Open-Closed Principle. Say I have the following client: public class Client { private Server server; public Client(Server server) { this.server = server; } public void purchase() { server.processPurchase(new Purchase()); } } This is the ab...
I am trying to convert an ER diagram into a class diagram. Below image is showing that part of my ER diagram and which contains a weak entity call 'Parent'. Therefore when we consider the ER diagram, what happened to the weak entities while designing the Class diagrams? Does this weak entity it create another class or ...
I'm programming a mobile app which makes use of REST services. Some of the services are for logged users, so I have a login endpoint which lets me enter my credentials and get a JWT token for accessing protected APIs. I want to be able to login one time and have the app remember me without asking me to login again each...
I have a class, call it App, that will instantiate and own a set of classes of type Agents, each of which will instantiate and own a set of Listeners. Ownership is unique and non-transferable, hence obviously, std::unique_ptr. And ownees can vary in number, although they won't usually be to many, hence, a std::vector<s...
When I first a codebase, I frequently take notes about it, as this SO answer suggests. If some code chunk is small enough, I copy-paste to Word, print it out, and make hand-written annotation. If the code is long, I write down the line number and my comments about that line of code. This process works, but is woefully ...
Let's say I create an application that is free, let's call this Software A and then I create the same piece of software but with some premium features, this will be Software B. Let's say I advertise Software A and people like it and start buying Software B. What stops them from (after purchasing Software B) to not just...
When taking an agile development approach, it is obvious to only implement features when necessary. My question is: can the same be applied when it comes to testing, i.e. creating test cases and only test when necessary, or is that a bad idea?
Let's assume that I have to deal with an unreliable system accessed by many users that goes down/fails, let's say, X times for X minutes weekly. If only one of the following can be improved due to whatever reason, what's more important: ensuring double the availability of the service or double the mean time between fai...
for example, Suppose I have a 2d array: let filterArr=[ [1,1,0,1,1], [0,1,1,1,0], [1,1,0,1,0] ]; I want to find and store the index of column that all are 1, i.e.:position 1 and 3, and the codes are the following: Use Array: let filterArr=[ [1,1,0,1,1], [0,1,1,1,0], [1,1,0,1,0] ]; let results=[]; for(let ...
I'm planning a cookbook-like Android app that would let users store/add/edit their e-juice recipes, keep track of the ingredients, etc. Internally, I'll be storing the data in a database on the user's device (Room, which is an SQLite wrapper) and keep a copy on the user's Google Drive so that they can access it from ot...
File Top.h #include <string> ...some code... File Bottom.h: #include "Top.h" void someFunction() { string s = new String(); ... } The Bottom.h does not contain an include for the string header, but the code will work because it's implicitly been included by Top.h Now, if Top.h changes for any reason not to inclu...
I am not sure where this is going to go, and I am not sure if this is even the right Stack group to be posting in for this matter. But simply I want to create from scratch using my knowledge of C# a means of updating a program using Delta Updating. So firstly some background, I want to create an app store (totally hyp...
My team and I want to translate an entire React-redux app into another language (english to arabic) and have a switch that does the app-wide translation via a redux action. The content for the first language is already written and hard coded. I was wondering if I could get advice, tips, pointers on how devs on here wou...
If you create a function, which should make the use of typeconversions more easy, but it maybe leads to more errors, would implement it globally, and what may speaks against it - when the readability seems to have improved? For (a simple) example: public static T EnforceConversion<T>(this object Result) { return (T...
A long time ago I asked about using an enum to essentially use as a poor version of instanceof to make decisions about an object. As stated in this answer: When your weapon types enum just mirrors the class hierarchy, then this is a blatant violation of the DRY principle - you encode the same information, the type...
I've come across a problem that doesn't occur in our development environment or test environment, but does occur in our production environment. Obviously, this environment is pretty locked down, and all the code is compiled. Are there any tips on how to debug problems with back end code in a production environment? If ...
My team has been trying to switch to Agile recently. The line manager has been taking 1-2 days per user story as a hard limit rather than a guideline, and framing it as a failure of the developer if the time limit is not met. I am not sure if that should be the case since there are a lot of unknowns and possible blocke...
I have a question about how I should implement a new action for a resource on my API layer. I have a Timesheet which is used by people to let us know how many hours they worked on a job. This timesheet has a status: Open (Still in progress) Submitted (Will be reviewed by a department) Rejected (Rejected by the depart...
Disclaimer: I'm sure this has been asked here before, but I haven't been able to find it. I'm trying to create a system where one central computer (master) can initiate commands on other computers (slaves) without them requesting anything first, and have those slaves respond to the master when the task is completed. My...
What I'm going for is something like GNUCash or any type of personal finance tracking software that looks similar to this: That is the main page listing all your accounts; then when you click an account it opens up a data grid that allows you to add new transactions. So obviously you want your balance to be updated im...
I'm developing a computer game. It is a single person hobby project. I will implement it in common-lisp. As proof of concept I'm trying to procedurally generate a scene by randomly selecting entries from several tables. The scene should dynamically react to the player. I intend to use a custom kind of entity compon...
I like to separate business logic out of POCOs into controllers. If an object must be thread safe, where do I put the lock code? In the POCO itself? Or in a controller? Might make sense because value types cannot be locked? I.e., the controller: namespace Project1.Controllers { public class LogManagerController ...
Is it possible to write a program in a language unsupported by an editor or IDE, save it, then run it in different IDE or editor that does support the language?
Consider endpoint /projects that returns a list of projects with the following headers: HTTP/1.1 200 OK Etag: "superEtag" The etag value represents a hash of the entire collection and it does not allow a client to update a single resource e.g. /projects/1. Fetching the resources individually makes no sense, so how can...
I'm fairly new to DDD and have been building a virtual airline app for flight simulators and I'm having trouble modelling the scheduling part of the app. A bit of the domain details: first you start an airline, then you use your money to buy aircraft. Then you schedule flights, fly them and earn money. Any clashes in s...
I am trying to define the boundary between two broad types of users. The first are those who make use of corporate systems (accounting, ERP, CRM, etc.) and this also includes B2B users, for example external consultants, market partners, businesses which use our corporate services, and so on. The second type are end-use...
My question relates to usage of delegation together with inheritance and dependency injection. I have a MailerService class that requires a delegate in order to do its job. Furthermore, I have a hierarchy of delegates with an abstraction: MailerServiceDelegate together with a number of implementations amongst others an...
TLDR: not quite sure whether I got my Bounded Context right. Situation I have a domain model in one Bounded Context: Entire model is in the same bounded context. Bounded context has two responsibilities: administering products/rules/parameters parsing/executing products' rules Business invariants pertaining to admin...
I am experimenting with an web app for searching and buying bus tickets. I came up with a few objects like RequestedRoute, Passenger, and Ticket: I have some Flask view functions as well. The home function is called when the user visits the home page. The home page has a form where the user can enter the departure, des...
I'm developing backend for a dating app, in which each user has a profile of his/her characteristics a profile of ideal match's characteristics There are dozens of characteristics like gender, height, looks and so on. Some characteristics are strings, others are numbers or arrays. Each characteristics has ascribed...
I do not follow SOLID strictly in general, but I do try making sure to separate responsibilities of my classes. I was developing a small app with a Windows service powered by Topshelf and realized that I don't quite understand what should Program class do. Obviously I could probably shove most code into Main, but what...
I have a personal finance 3-layer application setup as: UI, BLL, and DAL. My domain looks like: // Write Model public class Account { public Account(AccountId id) { _id = id; } public AddSubAccount(Account account) { // add subaccount to this account } // more business logi...
In the JEE World, we were used to write front-end application with Struts, JSP, JSF. But now, we are following the trend of modern front-end applications with modern technologies (Angular, React, etc.) in a NodeJS ecosystem (npm or yarn, webpack, etc). Theses new technologies change a lot, and make the maintenance of a...
Modern languages like Rust, Kotlin, and TypeScript, define their syntax to declare variables as: myVariableName: VariableType As opposed to the C-like approach not so old languages like JavaScript, C#, and Java take: VariableType myVariableName My question is, why the new trend? What was wrong with the old syntax and...
I'm beginning a new project at work, and will likely be nearly the sole developer on the project, though one or two other developers will need to integrate existing applications or simple scripts into the main project. The project needs to handle small-scale bulk and streaming data ingest/processing, and both event-dri...
I'm developing an API in Rails and the following requirement is established (it's really more complicated, but I want put a simple example): There are users and messages. users have a gender (gender_id), belong to a country (country_id) and also have a civil status (civil_status_id). When a message is created, these c...
Building my last application, everbody started to lose control over the increasing complexity of business rules, which would be added every week - most of all the app owners themselves. In the end, we had to explain the behaviour of their own app to them, because they forgot what they had defined a few weeks before. Wi...
I have this following scenario: A user makes a GET request to /projects/1 and receives an ETag. The user makes a PUT request to /projects/1 with the ETag from step #1. The user makes another PUT request to /projects/1 with the ETag from step #1. Normally, the second PUT request would receive a 412 response, since the...
I have a mail_queue table that is written to by web requests then worked on by a worker to send the mails. I've now had a moment of enlightenment re. what I was not comfortable with in the design. Before: One database table called mail_queue, which the worker processes, & adds a sent_at field when sent. That means to ...
I recently came across Herb Sutter's video from about how the meaning of const and mutable has changed in C++11 to mean bitwise const (and thread-safe, as a consequence) instead of the traditional logically const. Five years later, have programmers migrated to this new meaning of const? I've tried using this while writ...
I have public class SomeDomainService { public SomeDomainService(IDependency1 someDependency1, IDependency2 someDependency2) { // ... } public void TestableMethod(int parameter) { var result1 = this.someDependency1.Method1(parameter); this.someDependency2.Method2(result1); ...
I'm trying to determine if using '-1' in an Identity column has any drawbacks, or if there is a better way to do what I want. In my database I have User table and a Group table. All users must belong to only one group. Table definitions look something like this. CREATE TABLE User ( UserId int Identity(1,1) not null...