instruction stringlengths 34 36.1k |
|---|
See "Note" on second page:
This convenience gave rise to serious inconsistencies and was removed several years ago
The book was authored in 2003.
What exactly does it mean by "Serious inconsistencies"?
Was a compiler flag for backwards compatibility created?
Did this behaviour also exist in C?
|
Context ( You can skip )
I will be doing a presentation on Python, and will be touching upon V3's decision to be intentionally backwards incompatible, and how that has affected Python long term. I will be examining in particular their decision to remove the print keyword, because it was a decision that was not strictly... |
I'm trying to understand why anyone would prefer Floyd-Warshal over Dijkstra:
Dijkstra gives a correct result, using an understandable system, combined with backtracking.
Floyd-Warshal makes an entire list and filters in there.
The only thing I can imagine, is the case of enormous graphs, where Dijkstra only gives a ... |
I'm refactoring some old code, I have a lot of istanceOf in the business part:
if (record instanceof RecordA) {
RecordA recordA = (RecordA) record;
//mapping to recA and other stuff...
recA_dao.create(recA); //save a copy of the record to the d... |
I am building a consumer application that reads messages from a queue and runs basic sanitization and deduplication and persists them to an RDBMS.
The functional requirements are
messages must not be lost
Validate and sanitize the arriving messages before persisting them.
Invalid messages go to the database in an erro... |
I am working on a simple library that will help me work with prescription drugs. For instance, DrugBank contains a list of FDA approved drugs, and, importantly, how these drugs interact with one another. So, for instance, we might have drug A, which might then interact with drugs B and C in some way.
In a previous proj... |
At deployment time, I register my microservices in the following way:
They register themselves in Keycloak to have an identity as a confidential client;
Then they call an endpoint on a dedicated internal microservice "AUTH-SRV" that grants them the appropriate permissions/roles;
They also register themselves with the ... |
I'm learning about Big O notation and how it relates to computer science and I understand the sentiment behind Big O, however I'm struggling at understanding how we define a "step".
In the book I'm reading as well as a lot of different articles they use something like below to express an O(N) example since, as N increa... |
.NET Boolean type usually makes if else pair all over the code.
Functional Boolean should be more like Either type. Ideally represented as Either<Unit, Unit>.
However, my issues with Either type are the following:
Either<Unit, Unit> verbose, ideally it should not be generic type
It is not communicating clearly that Ei... |
Suppose you are given a python API:
def onArgumentReceived(x):
doWhatever(x) # expects a unicode string
I am not a security expert by any stretch of the imagination, however on the face of this, without explicit checking, this just instinctively feels like an obvious place to find a vulnerability laid bare.
Wherea... |
I've read that you should pass in an interface instead of a concrete implementation so that the consumer doesn't need to know anything about implementation details.
I don't understand how injecting a concrete class exposes implementation details?
class ServiceA() {
private something
public method1(){
res = ... |
I have an app written in java and using mysql as DB. I need to create a coupon distributed system where I have 100 coupons stored in DB and the first 100 customers who login should get those coupons. With a single server its pretty straight forward I think, but how do I implement this where my application server has mu... |
As part of an university project I am currently working on an eeg-biosignal classifier. While the project itself doesn't really focus on design ("anything that works") I am trying to learn and apply some best practices.
Some Background
The experimental setup is essentially as follows: A subject sits in front of a scree... |
I have read several discussions about storing BLOBs in the database vs in an object storage. What I need in addition though is a functionality for querying these BLOBs. The BLOBs will be immutable compressed multi-dimensional arrays that will be 10s of MBs. I mention that, since they are not files that will be served, ... |
I have an application that employs "zero knowledge" data security, where even with full backend access to our application, customer data cannot be read without knowing their individual passwords. I use what I believe to be a fairly standard method for this: password, after hashing, protects a data key; password change ... |
Is inheritance in use case diagrams between actors limited to one specific diagram or is it applies to other diagrams too? e.g. I got 2 actors let's say Actor A, Actor B. I got also two use case diagrams lets say Foo and Bar that show some use cases (Foo got 3 different use cases than Bar, Bar got 3 different use case... |
I'm looking at creating my first packages to clean up my codebase.
Below is a very simplified version of my current project structure:
my_project/
|-database.py
|-app_1.py
|-app_2.py
|-constants.py
To explain each one a little bit:
database.py - all the sqlalchemy orm table classes used by app_1.py and app_2.py
app_1... |
I have a complex object that has several fields can be updated until it is locked.
Is it proper to save this locked entity as another entity which has no object child, only string data.
complex object
{
Student student;
Teacher teacher;
Address address;
//...
}
after it is locked. this information will never chang... |
Due to the previous supply chain issues, I currently have multiple variations of a particular sensor that performs a function in my design. Each of these variations have their own library associated with them, however, they all use the same functions names so that it's easy for me to swap between variations when sensor... |
Advice on unit testing is often focused on publicly exposed classes. What about cases where the only public class is simply there to instantiate internal classes? Should the internal classes be unit tested, even if they are not exposed to the outside world?
My intuition tells me that the internal classes are doing the ... |
From what I understand of DDD, my entities and value objects should be able to enforce its own invariants, meaning that its constructors will check for nulls, must contains numbers and letters, whatever else. In this way an instance of a domain object will always be valid.
And from what I heard, if my domain throws an ... |
In Software Engineering by Pressman:
The steps in continuous integration are:
Check out the mainline system from the version management system into the developer's private workspace.
Build the system and run automated tests to ensure that the built system passes all tests. If not, the build is broken and you should
i... |
I'm struggling to understand how to improve the performance for an HTTP Request that comes with a huge body.
Now, let me explain better what I mean with performance!
Imagine I have a DB with the table "User" that contains 100k elements: if the client wants to visualize all of them, we can:
Send 100k elements all toget... |
I'm trying to build a simple compiler for a subset of the C language in C. To achieve this, I needed to figure out a way to represent the grammar symbols. Basically, each symbol can either be a "terminal" or a "non-terminal". Each "terminal" must be associated with a string that can be recognized by the lexer as a lexe... |
I am trying to design a schema for pairing styling data with text. However, I need it to pair styling metadata to only one part of a larger string.
For example:
"This is a test string"
I want to style This as italic, and test as bold.
The question is, how do I efficiently designate subsections of this string as being s... |
I have the code but I want to be pseudo as possible so I learn from other ways as much as possible.
So what I am building is web based tool and in one section we have a table.
This table renders lines of data given it matches conditions.
So the way it works is user enters a number and based on that we out specific line... |
I was thinking how to design a simple cards game, like poker, in a DDD way, but I am not sure about some points.
Basically what I want is this, but I will try to simplify the problems that I have.
I have a match in which I can add players.
A match is played in 10 rounds.
Each player play in the round in its turn (for ... |
Say I have a ReactNode post:
const Post = (props:{content:string}) => {
return(
<div>
{textProcessor(props.content)}
</div>
)
}
the role of textProcessor is to 1. to sanitize the text, and 2. to identify links and inject html to highlight them.
const textProcessor = (content:string) : React.ReactNode... |
I'm a software engineer by trade, yet I am shocked and fascinated by something I learned just recently. For example, I found out Facebook has businesses and sites share information about my activity on their sites with Facebook. Many sites do this including ones I would not expect. Sidestepping all other types of moral... |
I am developing an API responsible for returning the distinct searches made on a service given a date prefix.
Example data:
2015-08-01 00:00:18 %22http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DeYbdd2ChagY%22
2015-08-01 00:00:19 %22http%3A%2F%2Fwww.dnb.com%2Flc%2Fcredit-education%2Fbest-in-class-risk-management-strategy.ht... |
I have an endpoint that teachers can use to invite students to a virtual classroom by providing their emails in a list format. Let's call it POST invite-students. I have these four resources:
api/v1/virtual-school - includes endpoints for inviting teachers and editing their permissions
api/v1/virtual-classroom - inclu... |
I have a batch endpoint of the form
POST /entities
["id1", "id2", ...]
Where the endpoint takes an array of ids and returns a batch response.
Now I want to set a maximum value to number of the entities to prevent service from processing huge requests. But I am not sure if this belongs to the controller or service lay... |
I coudn't find a better phrasing for my question and hope it is not too confusing.
my question mainly targets the open/closed principle and extensibility of my program.
I tried to condense everything as good as possible.
Brief Overview
I have a program that acts like a test bench. For a given system, I have several Ite... |
I'm designing the architecture of a platform to introduce a message broker in an existing data collection web application.
This web application is currently used to upload data from excel files that are then validated, processed and inserted into a database. Every time a new set of data is inserted we should run one or... |
I am facing a bit of a conundrum with how I can structure my application, as I try to balance speed, cost, and efficiency.
I currently have a website, algfinder.com, which solves states of rubik's cubes. The computation runs purely on the client, and can sometimes crash on mobile devices due to too large of memory dema... |
First question here, so preemptive apologies if I've committed some faux-pas. Additionally, I am aware that this question is about possibly the micro-est of micro-optimizations ever, and "micro-optimization is the root of all evil" and all, but this question has been stuck in my mind for the past 3 weeks, and at this p... |
I am creating the backend of a microservice that will serve as a tool to see in real time how the company's employees are distributed by projects and what days they have assigned to each one. The database I have raised looks like this:
ModelType = TypeVar("ModelType", bound=Base)
CreateSchemaType = TypeVar("CreateSche... |
I'm designing a small platform based on a series of event-based micro-services. The persistence storage I'm targeting is (the managed) Amazon PostgreSQL (Amazon RDS for PostgreSQL) — although I can go with Amazon Aurora as well.
Basically I'm trying to avoid sending events programmatically within the system. Previously... |
I am currently looking for a way to encode a list of random numbers most efficently (as in length).
To be specific, I have an array of 11 numbers containing each number from 0 to 10. The order will be randomized, and I need to get the smallest possible representation of these orderings.
I am currently trying with the f... |
As shown in the following image, I have two different branches with their corresponding PRs (PR1 and PR2). The top arrow is the develop branch.
PR2 is build on top of PR1. PR1 is build on top of develop. Keep in mind that I also compared PR2 to PR1 in the Github UI.
Now, at some point in time as shown below, I needed s... |
I have a legacy project with many classes with high coupling, and I have a necessity to test some of them. So, I decided to introduce dependency injection principle but stumbled upon where to create dependencies.
class Context
{
ICallManager* m_pCallManager;
public:
Context(ICallManager* pCallManager);
...
};
... |
I am having trouble naming and thus searching for the right keywords for a pattern I am seeing in my web applications and their associated difficulties. Here are some examples of the pattern I mean:
CMS: A page layout can have various regions in which editable elements can be added. Some of these elements might need to... |
I'm looking for some guidance on a design proposition I have to accomplish the following use case:
We have several small microservices that each generate a unique set of "analytics" or attributes about a customer
We want a consolidated interface for partners to request each set of analytics, e.g. via a REST call POST ... |
I work with other Software Engineers on a web app product. Also, the source code is hosted on GitHub.
Recently, there was an introduction of a Continuous Integration procedure enabled by a script written as a yml file and GitHub Actions.
After every Pull Request on GitHub, the CI script checks if the new code is breaki... |
First of all, I am serious :)
You have array of N elements and we can compare them (e.g. operator > works).
Let's try to (unstable) sort it using following brand new sorting algorithm.
First, consider "smart" optimized bozosort - you choose 2 array elements at random, you compare them and only if first is great than se... |
We are planning on building a desktop application with a few web components. I want to know how resilient is this architecture.
Essentially the design looks like
Mixing web components with desktop applications is possible, but the backend server is running on localhost. Is this a good idea?
ZeroMQ is a distributed q... |
I work with other Software Engineers on a web app product. Also, the source code is hosted on GitHub.
There is a behavior pattern that I do not understand. Some co-workers push branches (adding features or fixing bugs) as standalone branches, without an associated Pull Request.
I do not understand this behavior. I can ... |
I'm working on an implementation of the "log transform" operator on an image for C++, and we currently have it formulated as follows (python code). Note we use log10 instead of the natural log.
def log_transform(mat: np.ndarray, dB: int = 40):
mat= 255 * (20/dB * np.log10(mat/ mat.max()) + 1)
mat[mat< 1] = 0
... |
I've seen similar questions but in this case the code deployed to all stages (local, dev, staging, prod) will be the same.
The idea is to have a special field on one particular request, something like isTest that would allow a certain endpoint (consumed by a web client) to perform a DELETE action that otherwise would f... |
What's the cleanest and most coherent way to assign a new value to an object field when the calculation of that value is outsourced to another method?
The most obvious way would just be to update the field value when it's calculated in the method, as so: [examples in Python]
class MyClass:
def __init__(self, arg):
... |
I have a C++ component that contains important data that needed from various other components in my program.
The component might contain its own task or not. But in either case it will also hold the data in structs or classes.
The other components that will include the component in question might not need all the data ... |
Having a poor knowledge of the extended features of the available message brokers, I was wondering how to approach this.
We have some environments where only RabbitMQ is available, others where RabbitMQ and SQS are available.
For scalability reasons, we would like to be able to use SQS on environments where it is avail... |
I have consumer pools that consume only events matching a specific attribute (e.g. origin=WINDOWS, the other origin=LINUX).
Since ordering is important (ordering is based on instanceId, so this is the partition key) and the throughput is very high, I'm using one Kinesis Stream for each pool (SQS High Throughput might a... |
I am looking for a solution to load a Java Keystore dynamically from memory instead of from a file on disk. Can you suggest any libraries or best practices for this scenario in the context of Java, SpringBoot, and Docker?
|
Context: I'm not employed as a software developer. But I do hobby projects pretty regularly, and I was curious if application dependencies can be super varied during compilation and testing (if all developers are compiling their code locally) between 2 or 3 developers. Unless there is a cloud-hosted solution that has a... |
I currently have a nodejs(nestjs) app, and a postgres database. The database has a maximum connections available as 1700, and I'm trying to spike a 1000 request in a single instance of a second. The test takes about 4m to complete in which the app/database resources aren't consumed very much (CPU/memory), and I analyz... |
KAOS is a goal-modeling strategy that is widely taught in the academia.
I have seen that almost no known diagramming software supports it except objectiver, which was developed by the same group that invented KAOS.
Is it used in the industry? Are any FAANG/Fortune 500 companies using it?
|
I need to generate grid shells for a given level. For example, the 2d grid "shell" at level 0 is just the cell (0,0).
The level 1 shell would be every cell surrounding (0,0), the level 2 shell surrounds that one, etc.
The formula for the number of shells at each level is 8*level for each level above 0, and 1 cell for l... |
From official documentation:
A "middleware" is a function that works with every request before it is processed by any specific path operation. And also with every response before returning it.
But I would like to ask what is the point of a middleware in FASTapi? What problems does it solve? Can you please provide me a ... |
Consider the following Typescript code:
function exampleAction(target: Target, options: ExampleActionOptions) {
// ...
}
export function getExampleAction(options: ExampleActionOptions) {
return (target: Target) => exampleAction(target, options);
}
Here we have two functions. One that has the actual implementatio... |
I'm here for some advice about how to manage the situation where I have a legacy application running locally on an onpremise server with it's own database and I'm about to add an online shop app to it.
I have created a new domain model for the context and added an anti corruption layer (ACL) to convert the data. This A... |
With Java record being immutable, I don't know how to use them properly in the context of something like a CRUD application.
If we take a very simple example of a "Organization" record:
public record Organization(String id, String name){}
This looks good, its immutable and has all the good stuff built into it.
Now, le... |
apologies, if my question is to trivial. But i after doing some research i couldn't find an appropriate answer to this seemingly simple question. As a developer with some experience, i know that i just could "code it down". But i'd like to create REST sharp library, that is easy to understand, maintainable and testable... |
I'm currently working on an ERP Blazor WebAssembly app that works alongside its base Razor Class libraries. The app could have some custom pages that aren't the same for all the customers and are independent (that means that the core app remains the same while the custom pages could get modified).
I've tried putting a ... |
In my python codebase I have several open source dependencies, eg. pandas, plotly, etc. Some of these are missing some functions that I'd rather they have.
I sometimes add functions to these libraries after importing them because it seems better to me to keep some tightly coupled functions in the same namespace.
To giv... |
I have a (php) program, which must change yearly. This program calculates tax for every year and there are sometime changes in requirements.
First, the user fills their incomes, expenses, etc.
Then clicks the download button, which creates an xml file for him.
The Download class use Calculator classes to calculate the ... |
I am creating a UML state diagram to help me plan the card game simulator I'm working on. At the moment I'm stuck on an issue where actions that can be performed from the "Main" state, the state where the game is simply waiting on the player to choose the next move, or as a result of the effect of a card.
For example:
... |
I'm developing an app that will work as a troubleshooter. In this, I want to ask the customers only relevant questions instead of giving them an exhaustive list.
Every option they choose will have to be linked to a new question with only a few answers, so I can distill the issue they are having effectively and without ... |
I'm thinking about a rewrite of a existing application. This legacy application does not separate frontend and backend. It's a single application with server side rendering.
I want to rewrite it to a separate backend that provides a restful API and a frontend. Right now I plan to use Node.js with Express and tsoa as ba... |
If all data is essentially just a bit string, then all data can be represented as a number. Because a compression algorithm, c(x), must reduce or keep the same length of the input, then the compressed file must be smaller or equal to the input (and greater or equal to 0). This can be stated as 0 <= c(x) <= x. For compr... |
We are developing Word Addins that interact with elements in Word documents.
To make it testable, my approach has been to use interfaces and wrappers for UI elements, and then provide mock alternative implementations to the wrappers. For example, IDocument wraps a COM Document object and provides accessors to the relev... |
We have a very messy data repository component, with dozens of methods to interface a DbContext (entire database) in Entity Framework.
It was (and is) coded in a way that adds a new repo method for each table combination a query needs to run on/return.
For example:
GetEmployees(), returning something like DbContext.Em... |
Is it code smell to make an abstract child class implement a method, which overrides a parent method, whose only purpose is to call another abstract method? I want to make sure that anyone who implements my abstract class is aware that there needs to be special handling to override the functionality of a parent method.... |
I've been a heavy user of "batch jobs" to perform different kinds of logic in systems. Over the last couple of weeks, I've been thinking and reading about other approaches and I wanted to bounce some of my ideas and get some feedback and trips.
So to set the stage, let's look at a use case:
We're creating a chat applic... |
Our organization is into Health Care RCM business. In that, we use to receive medical records (called as accounts, which is a business phrase) and our staff (Medical coders) use to do medical coding, based on the accounts received.
On daily basis, accounts will be receiving in a high volume from multiple clients and th... |
I would like to know more about the Specification Pattern, as it is described in Eric Evan's book "Domain Driven Design".
One of the key points Evans makes is that the domain model contains all important business rules (logic and behavior).
The DDD tactical patterns in the book describe how domain knowledge can be enca... |
Assume you have to figure out a dynamic way where the user can provide an API call to hit in the backend
for example, user to provide a webhook to call on his end server
So, An idea for users to provide a CURL command in UI would be an ideal way to cover all cases such as request method types, authorization, params... ... |
I'm pretty new to Github and I have one question I couldn't really find a clear answer for it.
Let's say I have a project called "Practice". In this project I would like to create different web components and practice my skills. Should I group all the components inside a single repo called "practice-components" (github... |
During the course of my load testing journey, I'm doing mostly spike test on the SUT(System Under Test). We gradually dial up the number of users hitting the server, from 10, 100, 1000. And we log the process execution time separately from the response time, and these are the kind of results we obtain say for a spike o... |
In the case of kotlin, rust and many other programming languages...
There are variables with direct implicit type declarations...
Where you can see the type of a variable at the same line where it's defined and initialized.
val a = 1
if you change this code to this...
val a = 1.5f
the change can be easily addressed d... |
I have the following problem, I am implementing a delivery management service and a single order can be competed between N deliveryboys, this service is being executed on Kubernetes with 5 PODs of this application.
When a deliveryboy clicks on the APP to accept the order for delivery, this flow must be synchronous to r... |
For compliance reasons, we want admins of a web app to work on it from devices (phones or computers) approved by IT. Or rather, they can work from other devices, but should get logged out quickly, so they won't forget an open session someone else can use.
We want to minimize both false positives (sessions on untrusted ... |
I am thinking how to develop an application in a DDD way, and now I am thinking about the concurrency part.
In some examples I have seen that in the domain classes are injected with dependency injection an implementation of the repository, and also in the root aggregate is added a field version, to control the concurre... |
When I am using the classical style of unit testing, how do I keep the number of test cases for an object that has many collaborators from growing too large? And how do I keep the setup of each test case from growing too large?
In Unit Testing Principles, Practises, and Patterns, Vladimir Khorikov recommends I use the ... |
I’m currently tackling a programming challenge to schedule a series of “performances” (a set of dancers together on a stage for a period of time, concretely) that each involve a set of “participants” (the set of dancers who form the group for a performance). Each performance involves some subset of all the participants... |
There are two schools of thought on how unit tests should be written. The first is the Classical/Chicago school, which focuses on the isolation of unit tests, describes a unit as a class or set of classes, and allows test doubles for shared dependencies. This school lends to the Inside-Out style of development, where t... |
I've studied how data transfer with secondary storage(HDD or SSD) works.
Would you mind to check that my understanding is correct?
File system
block is basic read/write logical unit which is used in file system
OS page for memory management is different from block
OS page size might be equal to block size or not, but ... |
Suppose I have some Java code such as the following (in this case, the use of the name "interaction" is referring to interacting with an object in a video game):
public abstract class Interaction
{
private Interaction()
{
// ...
}
// base class stuff here, some public some private
public s... |
Another name for this question could be: How to TDD the main function?
My situation: I'm writing a program from scratch that runs a sort of simulation, and I want to apply TDD to the whole development process. It seems straightforward to me when I think about the small detailed features, but at some point the program n... |
I have a similar situation to the user here How to design a database wherein multiple tags(string) are to be associated with an id?
However I'm designing a system where each association (between article and tag) is per user:
User
Article
Tag
Robin
<URL 1>
tag1
Robin
<URL 1>
tag2
Robin
<URL 2>
tag2
Alex
<U... |
Hello StackExchange community, I'm in a bit of an impasse for my current project.
The software in question is a collaborative program designed to let employees work together on the platform and assign tasks to each other, that can be further split down into subtasks, as far down as the company would like to divide the ... |
I am wondering if serialization and deserialization of classes should always be treated as an "atomic transaction?"
What I mean is, if an error were to occur during the process of serializing or deserializing a member of an object, should the whole serialization/deserialization of the object be considered to have faile... |
I am working on an API that has a User resource to represent the current user and a User service that handles business logic for representations of this user.
I need to introduce an Organization resource that has Members, which are effectively Users within an organization.
I need to build a resource that is represented... |
We have a system with a few microservices and multiple clients (Web, mobile). Currently, only one microservice (let's call it "Master MS") exposes a public API, which is used by all clients. This worked well until now: Master MS did occasionally ask for data from other microservices, aggregated it, and sent to clients.... |
I was reading a post about testing in SwiftUI and the author said that don't write unit tests for your View Models that tests the UI of your view. The example he gave was a simple counter app.
class CounterViewModel: ObservableObject {
@Published var count: Int = 0
func increment() {
count ... |
We plan our sprint capacity in story points - so for example we have 20 points available when planning a sprint.
When we have stories which were not completed in the previous sprint, we generally roll them over. But what was originally a 5 point story might be almost complete. If we simply move it across then it takes ... |
The idea is that if an app I like periodically has noticeable bugs or issues, and it’s commercial, not open source (in this case, AirBNB, but I feel this way often towards many apps), I would like to actually help them fix the bugs so the tool I rely on gets better and I don’t have to face malfunctions.
I could observe... |
If you solve a bug in a poor way, it might result in even more bugs in the future, so I need a way to validate if the fix was actually good. Time between the bug assignment and issue closed doesn't seem right, so I'm not really sure what metric to use (if there's even one). Measure code complexity after the bug was fix... |
In UML sequence diagrams, there is the possibility to specify a synchronous call with a reply message.
Example (taken from https://en.wikipedia.org/wiki/Sequence_diagram)
When modelling that in mermaid-js, it renders "OKish":
However, the syntax is "strange" (because, for the reply, it uses is the notation for asynch... |
Github Copilot got update yesterday (2023 St. Valentine) https://github.blog/2023-02-14-github-copilot-now-has-a-better-ai-model-and-new-capabilities/ but still no information for its use in the business software evolution.
AFAK Copilot is good for generating code snippets for the general problems. https://www.reddit.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.