instruction
stringlengths
34
36.1k
There're multiple topics about bootstrapping a compiled language, languages that are compiled into machine code directly; However, I can't find good explanation about bootstrapping a transpiled language. First, The difference between a transpiler and a compiler is that the former converts a language into another, unlik...
I'm looking for ideas on how to design a "generic" bug-tracker integration architecture for Kiwi TCMS (opensource test case management system). Background: at the moment we support integration with several systems: Bugzilla, JIRA, GitHub and GitLab. Behaviours are: - link existing bugs to test cases/test executions - a...
I’ve built a small little library that I think really aids in PHP development. It makes secure by default database transactions, makes cURL requesting anything easy (including files), and it has a bunch of methods for handling and sanitizing different data (phone numbers, emails, etc...) it’s this last part that I have...
I am working on a product that will not be able to be updated once released. Furthermore, if the product malfunctions, the results may include death, serious bodily harm, or major financial setbacks. Therefore, my code must be correct the first time, as I will not get a second chance. What techniques are available fo...
In the following function IsDoubleString(),if res is true then it shouldn't call IsDoubleString(), I debugged the code but I am unable to understand that once it hit the line returns res; why does the control go inside the if(!res) condition? Shouldn't it be directly returning the res value to the main function? bool I...
I saw in many sites that compare REST with GraphQL. after investigating this concern (actually my concern) that, "is it a correct comparison?", I being more confused. Since the REST has a different definition against GraphQL, this question busies my mind that, why we'll be able to compare two different concepts togethe...
In the Django documentation it's mentioned that Django managers are accessible only via model classes rather than model instances to enforce table and record level operations. What are table and record level operations and does they get affected if we use a model instance?I have gone through https://stackoverflow.com/q...
We have multiple microservices communicating over MQ. As MQ messages are the interface/contract between the services, whenever we make changes to the MQ message published by a service we need to make the same adjustments on the services which consume the message. As of now, the number of services is small enough so tha...
We have an application which on every resource update(resource update, create, delete)creates a message and puts it on a queue. This message is picked up by a worker process, converted to a format that the receiving application (lets call it a hub) understands and sends it. The hub implements a policy of last writer wi...
I'm not sure the best way of phrasing the question, but let me explain! Say I have a bounded context of Customer. I then want to create another bounded context around subscriptions. Normally I would use subscription as the aggregate root and have a property of customerId. However, I have some business logic that says a...
We practice Scrum (SAFe) and use Azure DevOps to track features and PBIs. The team is unsure of how to handle features which have been started but not finished at the end of a program increment. Half the team wants to move the feature back to the program backlog, but we then lose the ability to report on effort already...
I need to write specifications for permissions levels on a system. There are two types of user (Viewer and Editor). Everything a Viewer can do, an Editor can also do. An Editor’s permissions build on those of a viewers. I now need to present these specifications. Ideally another developer can come along, quickly read, ...
I am writing a library that can be used with some GUI and would like to be able to build an interface where user can see and/or change most of the object's parameters, and also write some of these parameters into the separate tables of SQL database. Instead of hard-coding GUI representations for each object, I want to...
I have tried to design a class diagram for my first game. But then I realized that there are some ugly parts. First, there is reference from StateSystem to State and from State to StateSystem. The StateSystem object contains references to State instances and one of them is always current. StateSystem calls it's upda...
My product is an API which charges an amount of USD every N requests. I would like to allow my users to top-up their internal balances through PayPal, then decrease their balances when they use the API. I'm using Kong (+Cassandra) as API gateway in a Kubernetes cluster, so the Kong instance reached by the same user may...
I'm working on building a simulator for HVAC units. The conceptual model I am working with is basically that an HVAC unit has inputs and outputs, and I need to be able to calculate the outputs for a particular input. An HVAC Unit is comprised of some base stats, but those could be altered by adding other components t...
We are currently looking into dividing our back-end in multiple services using a message queue (RabbitMQ). Having a message queue suddenly gives us the possibility to update the web-app freely, but do we need to/want to use the message queue itself for that? The web-client doesn't really send messages, but just regular...
I would like to get your code thought and views on using conditional vs logical testing. For example: To test the conditions of truthness of all of the following variables, their currect status is as follows: a= True b= True c= True d= True e= True One could use as test as follows to ensure that they all are true:...
I've written my first moderately large project in functional style (in F#) and can see the advantages. The main challenge was to achieve the "Onion" architecture i.e. large and "smart" pure core / thin and "dumb" impure shell. It took most of the time but also yielded largest benefits (better testability, correctness, ...
According to my professor, one of the following relationships cannot be modeled in an object instance diagram: Association Composition Generalization I made the argument that the association could not be modeled in an object instance diagram, since that is more abstracted and is typically for a class diagram, while t...
Over the last few years, we have been slowly making the switch over to progressively better written code, a few baby steps at a time. We are finally starting to make the switch over to something that at least resembles SOLID, but we're not quite there yet. Since making the switch, one of the biggest complaints from dev...
As a backend engineer at a small company, we're running into a question of whether we need a DBA or another backend engineer (SWE2). The reason why this is a question stems from a difficulty in defining roles. For us, we are thinking about the role of a DBA as someone who at least does the following: Manages the da...
I'm designing an application in a microservices architecture. The app has its own logic but also needs to collaborate with other services. For example, the app is A, and other apps are B and C. Whenever there's an event "X" happens in A, The B and C also need to do something like sth-B(), sth-C(). There are two ways th...
I am working on a little project which essentially allows me as the administrator to upload new products to the app (each product would be a video explaining product) which would have its own specific questionnaire (specific to product), and as admin input which users are allowed to see this product and answer the prod...
I was trying to follow the INVEST approach for our stories but frankly, the “Independent on each other” does not really makes sense. Quite often stories are building functionality upon what has been already done. For example, we have a story “As a user, I want to configure my access code” and another one “As a user, I ...
I wan't to decouple my exposed API service from their implementation. So I was planning to use KafKa as a mediation layer between my exposed API and the service implementation by going fully asynchronous and using a request/reply pattern with kafka. Here a schema of what I am planning to do : I think that with this a...
I built a .Net web application for a company and it is going to be hosted on their own web-server that don't have access to the internet. the solutions i have thought so far is to get the MAC address of the web-server and check it before the application runs, this will require to get every MAC address in the applicatio...
Take a hypothetical camera company providing an API to manage its users and cameras. Each user owns cameras, and every user of a camera has a role assigned (one of admin, operator, viewer - these are defined in a database, and we might add new roles later). If I have a GET request that fetches details of a camera using...
I have a question regarding what is supposed to be backend and frontend for desktop applications and in this special case, an Excel Addin VBA. My application contains lot of forms and modules. I assume the Excel UI and forms with events and basically the frontend, but what about the backend? The VBA code fetches data a...
I have several areas in a program where I am doing the following check on the same two booleans, but each spot has different text being written to a file via Stream Writer based on the value of the booleans. Example if (bool1 && bool2) { StreamWriter.WriteLine("Stuff to the file"); StreamWriter.WriteLine("Stuff 2...
I have a dataset in a key value store (similar to Cassandra). The data model is - Key - ServiceName / timestamp_in_milliseconds value - operation In the write side I get some operations for a service and I store them as the key value model above. These operations can come at any frequency, once a day, once an hour or ...
I'm adding new functionality to an existing application it was done using JHipster. I've notice that some endpoints follow this pattern: return ResponseUtil.wrapOrNotFound(updatedUser, HeaderUtil.createAlert("userManagement.updated", userDTO.getLogin())); The wrapOrNotFound method: public static <X> ResponseEn...
Naming things is hard but naming them properly is really hard. We are working on an app, that analyzes the data of multiple apps and creates some reports. And we are hitting our heads against walls with the infamous User class problem. We have used User class in different parts of the app to mean totally different peop...
I have N applications using ORM, SQL-statements and stored procedures to access M tables from an MSSQL Server 2017. There are some shared tables that are used by various apps. Let's say I am forced to alter an existing attribute in one of these shared tables. Now I do not want to miss updating any application that uses...
I've always considered long lived feature branches a symptom of some underlying problem, but I've recently moved jobs and the company I am working for now encourages long lived feature branches. They say it's fine as long as you merge master (well, the Dev branch, but whatever branch we all work off of) into the featur...
In our Ruby on Rails app, we have a set of conditions to define the status of a user. Currently, there is logic that checks if those conditions are true given a user. We are in the process of writing code that will fetch a set of users from the database based on these conditions. A couple of my colleagues believe that...
In the company in which I work, it is customary to model entities using Interfaces when developing with Typescript. To me, it seems much more effective to model entities with classes and then create instances wherever an object of that type is needed. When I talked about it with my colleagues including the CTO, I a...
I have a relational database similar to the one in the diagram where there is one table called app instance which is the foreign key in almost all other tables in the database. It is meant to represent instances of the same web app. Essentially if I need to run a test version of the app, I could create a new record in ...
I'm lately trying to implement a specific problem using an object-oriented approach. I get the main principles and its advantages, but I fail to apply it to a real world problem. Most examples one could find consist of Cats or Dogs being implementations of Animal. These however don't give me enough understanding how to...
I understand that having 3 or more parameters as dependency is a sign that the class may be doing too many things, however there are cases that the class really needs more than 3. My question is, is consolidating the dependencies in to just one parameter an acceptable practice? E.g., Instead of Foo needing to instantia...
I need an advice on securing interaction between an application App and a microservice RecordApp. App is the main application, where all users are registered and do some activity. RecordApp is a utility application where App users can store records that publicly visible in the App (like sub-twitter). RecordApp knows n...
Say I have an Delivery class which should have a Destination property (among many others). Destination can be an Address (country, city, address line, post code) or a Port (international code, name). As you see these two types do not have any overlapping attributes. The only thing they have in common is Destination str...
What considerations should I mind when designing methods or functions that take in a lot of parameters? A lot meaning over 4 but less than 10. Example, I am debating whether to pass in an array like so: function makeAssembly(array $params) { $pump = $factory->fromModelNumber($params['modelNumber'], $params['stages...
I am working on designing a brand new Data Ingestion Pipeline with the Key highlights of the new project are as follows: Download and Update data to/from SharePoint using SharePoint APIs Download and Update data to/from JIRA/incident management application using JIRA APIs Download and Update data to/from SQL sources u...
I have been using Gerrit in my work environment and I find it really amazing and powerful because of its elegant use of git's branching features to create virtual branches for code reviews (the "refs/changes/*" branches). However a common pain point in using Gerrit I have came across is its "single-change:single-commit...
Has there ever been a consensus on which convention is "better": User.GetById(int id); or User.Get(int id); i.e., is User.Get(int id); not descriptive enough? Or does is the parameter implication enough? Or is it just a matter of personal preference? (And obviously, consistency across a project is more important than a...
We have one scrum team (distributed Agile) working on one code base. Due to parts of the team being in different time zones we wanted to divide the one team into two scrum teams. Our model with one scrum team was: Create a user story (feature) branch from the develop branch. After testing, merge back the user story b...
This is a related question and the OP appeared to go with extreme levels of granularity. The answers gave a good overview but I gather it's still somewhat down to personal interpretations/situations as to where to draw the line. I want to know from the examples below which one best represents SRP. Example 1 Say you hav...
Need to understand the below definition, from the protobuf tutorial: mergeFrom(Message other): (builder only) merges the contents of other into this message, overwriting singular scalar fields, merging composite fields, and concatenating repeated fields. Based on the answers found here, I could assume that: Question...
Where is the implementation interface in Python documented that allows the async loop runners (from trio, asyncio, curio) to start the whole shebang? We know that sync functions cannot call async ones and yet the async implementations have a magic function that starts the whole event loop, e.g.: trio.run(some...async.....
DynamoDB is the database solution, I'm using to store my items. It's a NoSQL/Document database and I got a real problem on real-time updates of items. First, the saved format is like { expiredTime: 'Yesterday(this is a epoch or formatted string)', state: 'enum values EXPIRED and VALID' } The problem is I need accu...
I have a Java EE Application in which I have an Interceptor class like this @Interceptor @Logged public class LogInterceptor { @AroundInvoke public Object logMethod(InvocationContext context) throws Exception { ... } } Now when I want it to work I annotate the target method with @Logged. Please correct ...
Nowadays everybody wants to be agile. In every team I worked with, the shape of agile was different. Some things are common - like daily stand-ups or planning, but other parts vary significantly. In my current team there's one detail which I find disturbing. It's lack of functional requirements. Not only there's no wri...
Assume a client is making a request to an API endpoint that returns a JSON response where the structure and data change depending on whether the request was successful or not. Possible responses may look as follows: Scenario with a success response { "status": XXX, "data": [{ ... }] } Scenario with a failure...
This question is about designing unit tests, something I started learning short ago. I know the principle that if you are testing too much in a single unitary test it is a smell, either of code or design itself. Scenario I am computing a tax return form based on tax figures computed over the course of a year. Those fig...
I'm adding Immutable objects support to my Micro ORM called "Symbiotic" In the case of a create, I need to pass back a newly created version of the value passed in because the object is immutable and I need to update the newly created identity. For non-immutable values I just set the identity property, but obviously I ...
As a minimal example, consider the following (in Python): class Foo: def __init__(self, bar): # Assume bar is a valid at this point self.bar = bar def divide_by_bar(self, num): return num / self.bar If the attribute bar is public, my understanding is that it is valid for the client to ...
I'm currently designing a server with the following structure: A TCP thread pool that receives data from the network A queue that holds these requests A worker thread pool of a fixed size that takes requests from the queue and executes some work where a ConcurrentHashMap is read, and results analyzed. After the work i...
So earlier today I found about IronPython: IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. This was my first experience with using multiple programming languages in a single program. I thought it was really cool that I could effectiv...
In a microservice-based system, it exist some principles. Sam Newman often refers to them as these: You should always model your application around the domain A culture of automation. Automate whats possible to automate Hide your implementation details Decentralize everything Deploy indepentently Isolate your failures...
My company just went through a merger and as a result my small team has been expanded. From our side we have been using React for several years, and I firmly believe for us it is the superior choice in every way to Angular, which they use historically. We both have our own templates which have been developed over the l...
In short: Out of order commands end up with out of order events, so does the ordering of the events matter in such situations? Since we are uncertain about the order of commands when an asynchronous message queue like Rabbitmq is used for sending the commands,so we are uncertain about the order of the resulting events...
Im not sure if this is the right place to post this kind of question, but, I heard from a colleage that he creates all his views in a table view and for each item creates a separate cell. e.g. A title would be a different cell, image a different cell, etc. Is this a normal practice or is this something that should be ...
Quite often I have methods that do the following: Process some data (frequent, but optional) Save some state to database Publish a message to a queue / topic What options do I have to protect myself against transient errors (but not only transient) with #3? Implementing a retry / repeat mechanism is one approach, but...
There are thousands (or tens of thousands) of possible movie titles. New user enters my website and selects hundreds of titles that he likes. The only single goal of my website is to output the list of other users that liked exact same titles, but with only very minor differences - say, only 1-5 titles between users ar...
The aggregate root's state is the product of the commands it receives. So different order of receiving the commands produce different aggregate root states. How can I check domain rules based on the state when the order of commands are not guaranteed? How to check if a command can be executed based on the last state ...
For this question let's consider a system in which the users can match with each other (let's say for simplicity exactly like the dating apps). User1 matches User2 (and the other way around) only in one of the following cases 1. they both like each other 2. one of them special likes the other one and the other one ju...
I'm planning to construct a workflow/environment for training and serving NLP classifiers, that follows something like: The model training system takes in annotated documents from a subset of a variety of preconfigured sources, along with a set of user-defined parameters on how to run the model (e.g. which n-gram feat...
I am trying to design an object-oriented library to handle geometric calculations. However, I am trying to exaggerate on being "tightly" object-oriented and applying relevant "best practices". I know that there is no reason to be dogmatic about patterns, I am just trying to squeeze out every bit of possibility that I h...
C# extension methods have seen a rise in usage over recent years. The offical microsoft guidelines on usage state: "In general, we recommend that you implement extension methods sparingly and only when you have to" The extension method guidelines. On the other hand Microsoft are now using them heavily in dot net core (...
Is the sum of the cyclomatic complexity of all section in a file the total cyclomatic complexity for this file? If it is, is the sum of a set of related files the total cyclomatic complexity for this set? This is confusing for me because most of the examples of cyclomatic complexity I've seen are from fragments of code...
We've extracted our email sending into an EmailService - this is a microservice that provides resiliency and abstracts the email logic into an Infrastructure service. The question is how the interface to the EmailService should be defined, with respect to the information it requires about the [User] domain Approach 1:...
I have a NodeJs backend that interacts with MySQL database. Let us assume that I have a schema similar to this: Book id name Author id book_id name So, I have two tables named Book and Author having 1-M relationship between them such that 1 book can have multiple authors. Now, I have designed a GET request...
I know that in x86_64, there exists a 128 byte red zone above (or below, address-wise) the stack pointer that functions can use without subtracting from rsp. This sounds to me like the only things that need to be aware of the red-zone are situations in which code will get interrupted by other code running on the same s...
So I have a database class which has methods dedicated to specific actions. For example I have below method which accesses and writes to a table in the database: def trackUserPerformance(self, verbform, verbsolution, erroneousUserInput, isVerbCorrect, date): with self as db: cursor = db.connection.cursor()...
I'm curious about the terminology for compilers with JavaScript. When you're writing about or describing technologies like Webpack (bundles multiple files into one, and performs optimization) and Babel (converts ES6 to an older version of JavaScript), would compiler be the best word to describe these?
Background: I have seem some argument for using enumeration classes instead of enum in C#, in particular, this section from a book available at MSDN. On the references there is this "Enums are Evil" article which in turn makes quite a good point on the matter. One of the reasons quoted is particularly convincing: Imag...
Had this happened: A developer make a new feature, but not working, since last year, total code change is 100+files and 10k lines. Until recently, with help of another developer, get it to work. Now the code review is huge to include all changes. Seems there is a common sense that unfinished incomplete change shouldn't...
I'm working on an OpenID Connect Hybrid flow, basically the response type in my case is: code id_token Problem: I can't seem to persist the session of the user when logged in using the id_token. I built the app using .Net Core's built in OpenID Connect authentication handler and Cookies handler. However, the cookies ar...
I have created a web service which can also send emails (using Gmail SMTP). This is deployed using Kubernetes and a health check is run every 30 seconds. Since a team member changed the login credentials we use for sending emails, a check for the SMTP connection has been added as part of the health check. Now the healt...
How should sprint tasks be planned when you won't know the next task to be done until the current task is complete? For instance, consider the case of optimizing a program's performance. Until you fix the current bottleneck (which may take much less than a single sprint), it's difficult to figure out what the next bott...
Due to resource limitations (embedded), I want to make some functionality that a class provides optional. The decision to include this optional functionality should be made at compile time. For example, I have a simple pool-based memory allocator, which has optional statistics support. The statistics support should be ...
I want to represent an Edifact message in an OOP Language. An Edifact message has the following structure: message := [ ( segment | segmentgroup ) ] segmentgroup : = [ ( segment | segmentgroup ) ] In words: A message is a list of segments or segmentsgroups. Segments are the base element, segmentgroups have a rec...
I have a use case of scheduling a person to some work for some time range. Eg. A service for assigning a person A to work for time range X to Z in location C. The only constraint it has, is one person cannot work on 2 things at same time. Eg. if person A is assigned to work in time 2019-07-21 to 2010-07-25, then person...
The app is to communicate with a bluetooth device with assorted data (config, measurements, service logs, status telemetry) - and it should cache obtained data so the user flipping between activities doesn't need to re-download everything when coming back to a prior activity, or the data was obtained in a prior activit...
I have been asked to look at moving our current architecture to microservices. I am aware of the warning to always assume a request could fail. So I am aware we should always be prepared to retry the request. However, when designing this, I am also assuming that the retry can fail. So with that in mind we have been lo...
I am in the middle of starting up a new project and just wanted some reassurance as to which approach to DTO's returned by the read-side was easier to maintain in a real world application with reasonable complexity. I realize with a DTO per query, it would allow for a specific query's response to diverge from the other...
I am currently making architecture for one application in which we have different types of user and every user has different types of functionalities to perform. I am confuse in one point if i try to implement the business logic according to user types the architecture becomes tightly couple where as the code is more o...
Let' assume we have an IFiltersRepository repository that provides data about a list of "filters" that are used on the search screen of an app (filter by color, by price etc). The repository has the filters in-memory in a HashMap. The repository could now expose the data it provides via an interface: public interfac...
There is a base class Product having all the generic properties and methods which a product should have. abstract class Product { public abstract function process(); } Now, These are the few types of products which may or may not have similar logic. class Shirt extends Product { public function process() ...
Currently I have a .NET core application, which fires up a new thread to hold each customer account. Each thread instance: Is long running for many months or more Holds open SignalR Websockets and calls 3rd party APIs Needs to be super responsive Has 1 instance for every user account as it connects to unique web sock...
So I have the feeling that one can forget object oriented programming when reactive streams are in use, due to the lack of the async-await syntax (because with the call chaining, the state has to be explicitly passed between blocking and non blocking substeps), nonetheless I also think that dataflow programming alone i...
Our company has a legacy assembly-like language with some terrible design choices. I'm pretty sure the language is not going to change, since way too many legacy things might change their behavior which would be obviously unintended. I'd like to use/find any language which has at least C-like syntax ( or something simi...
Let's say we have a REST API application A consumed by other 30 applications. Application "A" uses a cross-cutting security implementation using a Security NuGet package 1.0. All minor/major changes are properly versioned and backwards compatible (e.g. not breaking existing consumers with new changes). The problem is,...
I have this requirement: Csv Upload (using opencsv) Should display if the record is inserted (if it doesn't exist in the db) or updated (if it exists). Eg.: 5 records inserted 2 records updated. Usually I use repo.saveAll(entityObjList) to save all the entries. Since I have to keep track of number of updates and in...
In my job I have a small disagreement on whether we should utilize helper functions for making datasets especially in laravel framework. A sample for the test is: namespace Tests\MyAppTests; use PHPUnit\Framework\TestCase; use Carbon\Carbon; class MyTest extends TestCase { private function makeATwoHourSpan(Carbon $...
I always like to overthink things, so here's my thought of the day: Should setters only set the values of class properties, and not perform any other logic? Suppose I have a class class User { private: int age; bool is_alive; public: int GetAge(); void SetAge(); bool GetIsAl...
In a web app I am building, I might finish two distinct minor features at the same time: Implementation of a new web page, and implementation of the notification bar. After merging both of these into master on GitHub, and resolving any existing conflicts, I will release it. My current release is v0.9.1 When I release ...
Let's say we have a typical service class method who does few things, input validation, db object retrieval, some business logic execution and then saving and returning record to user. This is irrespective of any language we are using. methodA(args1, args2, args3) { returnValue1 = validateArgs(args1, args2, args3)...
I was watching the following video by Vladimir Khorikov, which recommends to "Refactoring Away from Exceptions" pluralsight.com - Applying Functional Principles in C# - Refactoring Away from Exceptions and instead using a Result object. You can also find a blog about it here: enterprisecraftsmanship.com - Functional C#...