instruction
stringlengths
34
36.1k
I would appreciate if you could point the flaws as well as any positives ( if there are any ) about this kind of approach. What's my problem? Every request that comes, gets mapped to a specific controller and a specific method. Now, when a request comes, there are two options: Display a view for that request OR call ...
We know that there exists many testing criterions . As an examples : 1) Statement criterion 2) Branching Criterion 3) Path Criterion. My questions are : 1) Where do we just use these measures I mean do we use them in white box testing and unit testing only ? Because these measures deals with the structure of the cod...
I have some php scripts that use mysqli() to connect to MySQL which is located on the same server. I currently have the connection stored outside of my sites root and I am using include() to make the connection. For remote MySQL servers it is recommended to use an ssh connection. For my environment, should I take any o...
We are creating an office application in C#. Originally, the persistent data like customer details, orders, agenda, statistics, etc. were stored in a local SqlServer database on a server. The application runs on a single computer and acts as a client. The app grew and became bigger but still maintainable until some dec...
Apologies for the awkward title; I wasn't quite sure how to concisely describe what I'm trying to do. My situation goes like this: We have a Product table in our database; Each Product may have 0 or more Foo objects; Foo objects are defined in their respective table. As it stands, a foo just has an id, a Product id,...
For complex object creation, I am quite fond of Builder Pattern. My 1st question is "Do I need the Builder to be inside my complex class blueprint, or Could I actually have it outside?" e.g. Are the following two classes as 2 different compilation units okay? public class MyComplexObj { // Have loads of props } pu...
Disclaimer: I previously posted this on Stack Overflow, but it seems that perhaps that was not the correct site for the question. If this is still not the correct site, please let me know. I'm working on a Java project that needs to connect to a database. I don't know what the DBMS is ahead of time (the client could be...
I am designing an internal API that deals with images. As part of this, I hit this use case where: I specify an image format as a single value. An image format implies a collection of settings (values to pass to OpenGL, fragment shader code, texel bit size, …). In essence, a trait would be perfect… except the image f...
Not sure if the question is relevant here, but basically it is expressed on the title. I'm curious to know if a certain library/technology is used in a proprietary software. How can I satisfy my curiosity?
I recently came to a situation where I could not really figure out how to react. During a project, in a paired code review, the software architecte began pointing out even the smallest detail of my code before aproving the PR, even when production day is really really close. It would seem fair, if not for the fact that...
Would you ever ship backoffice admin UI functionality together in the same distribution package as the public client functionality? For instance - you are building a public web application for ServiceCorp-A. The public web application will be used by ServiceCorp-A clients. However, ServiceCorp-A also needs an Admin UI ...
I'm wondering how other people approach the problem of working on a particular screen in an iOS app that is, for example, behind a login screen and requires a lot of interaction to navigate too. It can make the development process quite long and tedious. Every time I tweak a part of the UI I must then build and run, lo...
I'm doing something wrong and I can't tell what, but I can concretely say that my problem is the fact that I'm looking at things wrongly and I reached a point you should never reach. I have a factory object. This object can be created in order to generate objects of interface MyInterface so that I can pass them to othe...
We're developing a big project for our company, and they asked us to use Angular even though none of the devs have any considerable experience with it. The back-end is C#/.NET Core with ABP. My expertise is back-end, and when I had to work with front, there was an adage to try to limit the number of requests or trips a...
i have a rest API that is a front end to a more complex SOAP based service. The soap based service uses extended(custom) WSA-addressing headers in order to perform its routing. The extension of the WSA-Addressing adds two header parameters country and city for example. Since the routing elements are mandatory I need to...
I'm doing some Java code practice to better understand the Single Responsibility Principle. Currently, I'm working with a network of data structures, where each structure implements an interface called Location. public interface Location { void removeObject(Object o); void addObject(Object o); } Different Lo...
In the flow documentation they mentioned an upstream and a downstream flows: Flows can be transformed with operators, just as you would with collections and sequences. Intermediate operators are applied to an upstream flow and return a downstream flow. Given code (from the same source): (1..3).asFlow() // a flow o...
It was recently requested that I accepted system Environment Variables in paths for my applications and that was really the first time that's come up for me and I didn't even realize that C# didn't just automatically resolve those. So now I'm wondering if there is ever a situation where I wouldn't want in all my metho...
It is my understanding that: It's particularly difficult to compile ahead of time, to efficient native machine code, a dynamically typed language like Python. Largely as a result of the above, the implementation of these languages is often interpreted (usually with JITC). In other words, largely as a result of point ...
In my company, the style guide requires imports, class properties, enumerations, and consecutive variable declarations to be sorted alphabetically. I find this unnecessarily tedious. What are the possible benefits from this practice being enforced?
I'm wondering, in general, if a part of a program can be safely parallelized with significant performance gains, should we? Or do we need consider the importance of this work because it can affect scalability. What is your thought process when deciding to parallelize something? For example, in my application, users are...
How will a kafka consumer differentiate/behave on the type of events that is stored in a given topic ? Let's say I have a consumer (Consumer1) which is set up to consume from a topic with event of MyType<OneInnerType>, and then I have another consumer (Consumer2) which is set up to consume from that same topic as Cons...
I have a factory, GuiTable.cpp where I create multiple GUI-related classes. I also have a database class, CommonStrDatabase.h which serves as a database file for different strings used in the GUI. One of the classes I create in the factory looks like this: #include "display/DisplayMenu.h" #include "CommonStrDatabase....
I need to collect statistics during an algorithm. To not mix the statistical code with the algorithm code too much, I'd like to decouple that by publishing "statistical events" that can then be consumed where appropriate. For that I'd like a lightweight implementation using an Enum instead of an interface. Code speaks ...
I have a node js app, in which I need to perform background jobs. My plan is to use a data structure which will contain all the jobs needs done. My design also suggests that this data structure needs to persist between application restarts. To achieve that I can think of two options to store the datastructure: a) use ...
I am constructing modular logic for my object: separate pieces of functionality are going to separate modules. I will have the ability to connect and disconnect modules on demand. At some point my object will iterate through collection of connected modules: class MyObject { private List<IModule> modules = new List<...
I'm currently working in a project that aims to implement automatic testing of a software package. You can imagine this software is a bit like Excel in that it has a workspace that contains all the data, and a user interface that executes code that works on this workspace data. We are primarily focused on testing "core...
Out of 5 creational design, would Builder and Prototype mixture be a valid use? The reason for this question is - Builder assists building complex objects with various combinations of attributes. But Prototype ensures that a reference object can be cloned so that expensive (and more frequent) object creations can refer...
I'm currently working on class with some async tasks under the hood. In fact I need to delegate few tasks to asynchronous execution and be sure that all of them are finished before class was destroyed, I was thinking about await all the tasks until finish inside class destructor. While research existing approaches used...
I have no idea where to post this question since it isn't about the Go language specification itself but rather the justification. In the Go language, functions can have receiver parameters to achieve an extension-method-like syntax feature. However, only types declared within the same package are allowed as type of a ...
I'm running a commercial accounting software packages which uses a SQL server database. I've also developed a WPF application which is basically a slimmed down version of the commercial software. Using the commercial software, I can open up an account and see such info as the name of the account holder, which of our cl...
I see very often to pass around unnamed data objects in JavaScript, e.g. { a: 1, b: 2}. Is it a good practice or is better to make a simple data class for that like in other languages: class MyDataClass { constructor({ a, b }) { this.a = a; this.b = b; } } E.g. to improve code quality, maintainability, r...
If you have a matrix class with overloaded operator*=, which order should the operands be placed for the interface to be useful and intuitive. One can choose A *= B to be equivalent to either A = A*B, or A = B*A. From one point of view A*=B looks like it should do the first (this is how Octave implements it), but putti...
On several occasions, I was faced with the following design issue that I don't know how to resolve. Imagine, for instance, an application which at some point receives a JSON object from an API. Before being able to use this object, the application should perform several transformations: for instance, one transformation...
I've been trying to create a grid system that can use any grid size and start at any given anchor point rather than always at 0,0. The problem however is imprecision makes it impossible, even the simplest imprecision and i can't get it to work, yet i've seen people manage to create local grid systems... so how are they...
I practicing DDD concepts on smaller applications and I use to have the same problem when I have to rely on data coming from outside the domain. In a previous project, when I wrote an appointment scheduler the appointment could not be cancelled after due date 5 am. So cancelling appointments was dependent on the actual...
Until now I used Arduinos with shields and ICs and mostly I used libraries to communicate with i.e. ADC, DAC, Real Time Clock, etc. Now I want to do the same kind of programming with the same ICs with the ESP32 and ESP-IDF framework. But often there are no libraries so I have to do this from scratch. This is obviously ...
I'm in a dilemma that might look silly. Where should Service Providers live? On a dedicated Providers folder: - Providers - CarProvider.foo - UserProvider.foo - Cars - Car.foo - Users - User.foo In the same folder for the Service it provides - Cars - Car.foo - CarProvider.foo - Users - User.foo - UserP...
Database System Concepts says Database applications are usually partitioned into two or three parts, as in Figure 1.6. In a two-tier architecture, the application resides at the client machine, where it invokes database system functionality at the server machine through query language statements. Application prog...
I am programming a UART interface (in LINUX) and I want to use a class for that. The way I have it right now is I have a method for write and one for read. The reading is started in a new thread to get new data, but because of that it has to be static and I don't like that because it needs some attributes from the cla...
I am running a personal project of offering 3D model generation as a service (in this case CAD model). Since most of the generation of 3D models take a long time, I thought about using cache to improve performance for the users. The 3D models are generated based on well-known parameters, and those would be used to acce...
We have some ETL jobs that are scheduled to run every day, and some that are scheduled to run every week via Control-M. These types of jobs tag data with the date the job was run and perform filter operations to get activity for that particular day or week. There's also a final step that involves taking the daily file,...
I am trying design a generic hardware facade interface for different camera types. below is my incomplete generic interface for camera devices template <class Data,class Configuration> class CameraDevice : public Device { public: CameraDevice(DeviceModel model); virtual void startStreaming(std::function<void(D...
I'm currently building out some functionality on a page. When writing JS I've been making a set of smaller functions like FindCarouselLocations(elem), GetImagesFromLibrary(url), and BuildCarousels(images, locs) which all use a subset of functionalities found in my global JS file. When designing a page that's fairly hea...
I am working on a microservice, in an event driven world, where I have tens of 1000s of rules configured which depend on data type A, B, C, D and so on. As soon as an event arrives I want to be able to identify which rules are dependent on this data and execute those rules. The current approach which I am thinking whic...
I have a grid of values, something like [ [0,3,1], [0,2,5], [1,0,3], ] I have objects that move on that grid, so they have positions { x: 1.87, y: 1.21 } If we check the upper grid, then the nearest grid point to that position is {x:2,y:1}, so with the simplest algorithm the value for that positio...
I started getting into VueJs and Vuex development and I'm looking for a "mainstream" architecture for large scale projects. I think the question doesn't depend on whether you take a ready to use UI Framework like Vuetify, Bootstrap-Vue or Buefy or write everything yourself. So first I read about the atomic design. This...
I'm trying to develop a CSS library where I style each element on an example HTML page. However, I came across those two elements (<cite> <blockquote>) whose examples must be shared with since they are always used together. Here is the example code: <blockquote> <p>It was a bright cold day in April, and the clocks ...
I am having trouble finding a lexicon which provides terminology for the explicit patterns that are employed when parsing syntax. I am trying to write about the niggling differences between the 10+ different markdown parsing rules as they apply to nesting and how different markdown syntaxes which appear to have similar...
I have about 15 years software engineering experience, writing business software with relational databases. Mainly SQL Server and Oracle. I've always been of the opinion that you should define relations in your database and let your database handle the relational integrity. And in my case, 99.9% of the time I utilize a...
I try to understand what cohesion means when designing modules. Myers states in his book "Composite structured design": An informational-strength module has the following definition: It contains multiple entry points. Each entry point performs a single specific function. All of the functions are related by a c...
I have a question about the responsibilities of the Scrum Product Owner and the Scrum Engineer/Architect. It is said that in Scrum the Product Requirements (PRD) specify the "what", but not the "how". In other words, PRD should not dictate (or be concerned with) the implementation details. We are building an app that ...
I am reading about the Observable pattern (Head First Design Patterns) and it is not very clear why it is saying that "You can push or pull data from the Observable when using the pattern". I understand that you can use the API for subscribing and being notified when something is happening in the Subject/Observable obj...
I'm developing a Twitter-like app and I have some doubts about my service oriented architecture. I have a User Service with a REST endpoint POST /users/{userId}/follow so the "connected" user starts following the user userId. After that, this service publish an event UserStartedFollowing with a payload like this: { "fo...
I have 30-ish million html documents in a file system. There is no emergency, the files are in a reasonable directory tree, it's not breaking the file system. But I'd like to be able to organize and query them. EDIT: Let's make a specific requirement to query for documents in xpath or a similar syntax. For example, //s...
As of C# 7.2+, you can add a parameter modifier in before the parameter type to define a parameter as const, essentially. It is like the ref or out keywords, except that in arguments cannot be modified by the called method. - MSDN Example from MSDN: void InArgExample(in int number) { number = 19; // error CS8331...
Let me use Wine as an example. Wine on Ubuntu uses the server-client architecture. While I am using wine on Ubuntu to run some .exe programs, I upgrade wine. While I am able to continuously running the already running .exe programs, I can't start to run new .exe programs after upgrading wine, because I can't start a n...
In many languages, it is common for a function to have multiple return values (as a tuple), such as: def foo(): return "Hello, World!", 0 I often do this when a computationally expensive (or an often called) function calculates multiple values. For example, a function that walks through an automaton to find the st...
I have a Base class that all other classes inherit from, including the User class. However, in the Base class I need to capture the createdBy, updatedBy, and deletedBy fields which all are going to reference Users. Therefore, I need to reference User from within Base for the fields, and I need to reference Base from wi...
I'm currently with with a Progress ERP database, which has two connection brokers: 4GL (aka ABL-used by the "desktop" apps) and SQL-92 (for any other language to connect, using ODBC or JDBC). The number of connections is a little unbalanced, being 80% for 4GL (used by Progress GUI Apps - the legacy) against 20% for SQL...
consider in a supermarket system , there is two actors : Customer and Clerk. To create the order , the customer interacts with the clerk and the clerk creates the order in the system. So my question is it valid to do the following use case : In more details , is it valid in uml use case to make an association between...
I have encountered the following design requirement in an app marketplace like project from a client in which users can rate games/apps they download (only in a special way more helpful than traditional marketplaces). My question is regarding microservices architecture, If I have a game user, app owner, market place m...
most OOP languages implement a class as a garbage-collected reference. however, a task (coroutine) based implementation may offer several advantages over traditional object references: -- method calls are transfer points and not separate functions. as such a coroutine directly intergrates method calls into its contr...
The context I have two components A & B, which communicate through events . Components B is responsible for long running background processes and it listens to the following event: startProcess(uniqueID) Component A is sending the startProcess events. The issue I need the IDs sent by component A to be unique, cause...
I'm mostly a Front-end Developer. One day I heard about such a thing at work like "authentication service", "registration service" and it turned out our product's backend has many services running apparently separately from each other. I tried making some simple backend for my own projects but it's always been like I h...
In code dealing with hash tables, I often find the constant 0x9e3779b9 or sometimes 0x9e3779b1. For example hash = n * 0x9e3779b1 >>> 24 Why is this particular value used?
I came up with an model to reduce DoS and DDoS attacks and would like your input on its effectiveness... Basically, once a request reaches our servers without having a valid key, we add a key as a query parameter of the url, then return a redirect response to the client with the same url but with a valid key. Then we...
What is a tear-off? I ran across the term reading Flutter documentation: Returns a CallbackHandle that can be provided to PluginUtilities.getCallbackFromHandle to retrieve a tear-off of the original callback. Googling the term only seems to yield "tear-off menus" which I understand but are unrelated.
We currently have a monolithic application. Currently an API end-point will look something like: public async Task<IActionResult> Post([FromBody]ContactViewModel model) { //... update the entity in the database //Then perform tasks... TriggerRegisteredWebhooks(model); SendNotifications(model); Em...
I have seen some posts on the subject of hidden input fields for use with postbut none were able to answer my question. I have a delete button tied to a user in a table. The delete button uses a hidden input combined with post. The value of this input is a primary key for the users table. Im sure this creates some vuln...
I'm working on an application in python. One of the functions we have is called def createThread(user, status, title, ...): # some code here system.db.runUpdateQuery("INSERT INTO table(value,...,value) VALUES(%i,...%i)"%(user,status,title,...)) The gist is simple - takes parameters and runs an insert on them ...
We have a fairly complex Meetings Management solution which would have one meeting to contain different agendas which would contain some tasks and also documents, etc. There are also different roles such as agenda creator, agenda reviewer, agenda approver, user responsible for actions etc. We could have participants a...
The Wikipedia article on separation of mechanism and policy says The separation of mechanism and policy is a design principle in computer science. It states that mechanisms (those parts of a system implementation that control the authorization of operations and the allocation of resources) should not dictate (or overl...
I have been designing an email alert system for my customers which allows them to choose what alerts they receive. AlertManager seems suitable, except for it's static configuration file; A customer subscribing to an alert will require an update of the configuration file. It seems like a hack to dynamically rewrite a co...
In Distributed Systems by Tanenbaum, p67 says CHAPTER 2. ARCHITECTURES 2.1. ARCHITECTURAL STYLES Cabri et al. [2000] provide a taxonomy of coordination models that can be applied equally to many types of distributed systems. Slightly adapting their terminology, we make a distinction between models along two diff...
I made some research to better understand the concept of functional cohesion. Myers in his book "Composite structured design" has written about functional cohesion: A functional-strength module is defined as a module that performs a single specific function. He also wrote in "Reliable software through composite desig...
In my class I have a processor manager that contains a switch case. I have just changed the real name values to Ant, Parrot and Snake. switch (name) { case "ant": return new AntProcessor(); case "parrot": return new ParrotProcessor(); case "snake": return new SnakeProcessor(); de...
I have an invariant, something like if I raise one event, then I cannot raise the same event for the same user again for an hour. So the invariant depends on the past and eventual consistency does not work for it. I could keep the past in memory, but that would not work if I want to scale out horizontally. I am curious...
I'm building a rest API using typescript and typeorm as orm. Each route of my API point's to a specific method located in a controller class. My question is about the content of this controller method. Currently, all my business logic is located right there. For example, the login method for my authentification looks ...
I'm trying to figure out what's the proper way of storing and filtering spatial data inside a running program. I have a 2D map of theoretically infinite size. Users generate objects which are placed on the map, so infinite objects, theoretically. I'm storing all this data inside an SQL database. Whenever a user opens t...
When defining software requirements, should automated testing (unit and integration) be specified? I have not seen any guidance on this, and "testing" is not a functional requirement for the software. But, from a CI/CD perspective, it's pretty much a "must do". Perspectives/opinions are appreciated, but direction to ar...
Although I believe my question is language and DB agnostic, I will provide the specifics technologies in this case study because it might help understanding my question (sorry for my English). It's a Java-Spring application to be hosted by several Tomcats with one central postgresql DB whose schema is versioned by mi...
I'm thinking of how would I go about creating my own logging centralization and centralized aggregation system. Imagined system has 10 - 100 nodes. Each node runs a LAMP(Linux, Apache, MySql, PHP) stack. For the sake of the example only Apache error.log and access.log will be gathered. Then there will be 1 designated n...
I have a requirement to get input from a web app UI, send this input to the server who will run an algorithm on it. The web server will send back the output of the algorithm the the UI. Is an HTTP POST method appropriate for this type of interaction since I'm not technically creating any data?
In Clean Code, we're advised to reduce, wherever possible, the number of arguments in a method's signature. This can often be achieved by using class attributes in lieu of parameters. Now in a code review I pointed out this exact thing, because a particular method had a parameter but really this parameter was only used...
Pretty straight forward question. QMap uses this term: QMap is one of Qt's generic container classes. It stores (key, value) pairs and provides fast lookup of the value associated with a key. https://doc.qt.io/qt-5/qmap.html xattr in its documentation uses the term: Extended attributes are name:value pairs associa...
So I want to be processing my security protocols server-side, mainly token checks and then role authorisations for certain actions. I'm using c# .net core connecting to an MS SQL database and publishing to azure. I really want to write stored procedures to handle the role-based authorisations and leave the c# code clea...
I am designing an application using C# and Windows Presentation Foundation (WPF). I would like to follow (at least) the very basic rules of software architecture, like dependicies only going in one direction. Also I would like the UI layer to be without any sort of business logic (i.e. the application should work even ...
I am looking for the best practice to do authentication (login) and signup using microservices, given that microservices are not supposed to share the same data. At the moment I am thinking: Two services: Signup and Auth Signup registers users, calls email service to verify, then informs Auth of user creation All logi...
I am creating a browser automation library that is capable of using Puppeteer(automates chromium) and Selenium(automates all major browsers), but the goal is to also be able to add more libraries in the future. I have an Enum that defines a couple of possible browsers to use public enum ExternalBrowserType { Chrome...
I am implementing a entity that has multiple mutually-exclusive states. In each state, there are different set of actions (let's say, transitions) that may take the entity to a different state. However (as expected), the set of actions depend on the state. As a result, I faced the following question: Should I expose t...
Take the following statement for example: 'Get results for ALL Active students of a Course'. Naturally, this query has 2 parts, Get all active students of the course. Get results of those active students. The end result can be achieved with a single query using JOIN. Now, in some situations, some students may hav...
GitHub There need to be a software design supporting gradual migration from one payment system (E-xact) to another (Stripe). Credit cards data are stored outside, so I would like to use both systems in parallel for a while to do not make all users to re-enter credit card data. Here is what I have at the moment in the d...
Context I am a strong proponent of clear, illustrative diagrams in documentation. When they are properly done, they improve a lot two aspects: the understanding of the documentation and the time a developer spends reading the documentation when he needs to recall something he already have read. The only tool I found wh...
I have a microservice I am designing for getting "Book" information, and one of the capabilities is to query Solr and fuse it with some DB results that I queried. I am looking for, what I am calling a "query maker pattern" something that will generate dynamic solr queries. The idea in my head was a class like public ...
Hi i asked this question on SO but no one seems to be bothered to answer the question with actual information. Firstly just to say, i fully know computers are imprecise for floating numbers and doubles etc etc. But what i would like to understand is why the imprecision fails for just a select few numbers in this code:...
This is a very small-scale project that I am coding myself, so I am able to build all of the resources however I like. I've done research on this site for help on this issue and can't find anything that seems to answer it completely. Please be gentle with me, as I'm still a bit of a novice in learning how to write "goo...
While researching this question, I've found a lot of sources like this: Basically, it should be deemed a criminal offense to use "throw ex". The experts I'm seeing this from seem to be working from the assumption that exceptions should provide as much information as possible. But is that really true? If a library tha...
The entire explanation of the client ID from RFC 6749: The authorization server issues the registered client a client identifier -- a unique string representing the registration information provided by the client. The client identifier is not a secret; it is exposed to the resource owner and MUST NOT be used alone fo...
Design Data Intensive Applications compares RPC and REST. It says The RPC model tries to make a request to a remote network service look the same as calling a function or method in your programming language, within the same process (this abstraction is called location transparency). and Part of the appeal ...