instruction stringlengths 34 36.1k |
|---|
So I know a little bit about parsing Json data but not too much so pardon if I am not describing everything as I should. Lets use this Json file as an example:
{
"firstname": "John",
"lastname": "Smith",
"age": 25,
"address": {
"street address": "21 2nd Street",
"city": "New York",
"st... |
We have multiple pages searching for users, each site having different search parameters. Sometimes, we have 2 parameters, sometimes 4 and most of these parameters overlap. So we have kind of (simplified) this code:
SearchUser()
{
// Get values from somewhere
Service.SearchActiveUser(firstname, lastname);
}
Sea... |
I'm currently designing a database query language and I came to wonder what should be the best syntax for the comparison operator.
Most modern languages use ==, but amongst the database languages based on SQL the = is also often used.
I acknowledge that the = should have been the comparison operator whereas affectation... |
I'm currently looking into NestJS to use as the framework for a new e-commerce project. The goal is to build multiple loosely-coupled services, which can communicate with each other using the pub/sub messaging pattern. NestJS offers some great integrations out-of-the-box with tools like Redis, NATS and RabbitMQ. I've r... |
I've just learnt about the Null Object design pattern, which recommends that the service either return a default null object or throw an null related exception itself so that the client need not worry about checking for null or throwing a null exception.
The thing is, as far as I understand a client/service relationshi... |
In the git flow workflow, it is recommended to create branches for releases, and when the release-specific work is done, merge the result into the master and development branch.
I understand why we would merge a release branch into the master branch, rather than rebase master on the tip of the release branch: We don't ... |
I have included OpenCV libraries in the enterprise software written in c++. I know that OpenCV is a BSD 3-Clause license, which means most of its libraries are free to use, modified, and redistribute. And all the libraries I used in the enterprise software are free (did not useSIFT or SURF). What are the actual texts a... |
The third and fourth items of the Manifesto for Agile Software Development
Customer collaboration over contract negotiation
Responding to change over following a plan
What's the difference between these two?
If the fourth means "incremental delivery with some willingness to pivot, instead of big design up front", t... |
So we decided to redo UI of our web application in React. Six months down the lane and we have a complete mess of components and reducers and thunks and actions and god knows what not.
We have multiple files named reducer.ts and each file is 3000-5000 lines long with thousands of reducer functions in each.
Same is the ... |
Suppose there is a microservice that has an restful HTTP API for CRUD operations on a database - nothing fancy, but there is a journal table of all changes recorded for audit purposes.
Suppose also there is an event bus (in my case Kafka, but could be anything) to which data change events must be published.
The journal... |
I'm wondering if I'm using the correct architecture in my application.
After calling an endpoint in my API, I'm currently going through the following flow:
Api.EmployeeController.Update(Api.EmployeeUpdateDto) => Services.EmployeeService.Update(Service.EmployeeUpdateDto) => Data.EmployeeRepository.Update(Entities.Employ... |
Let's say I have an object A with a public method bool Foo(arg). Foo is potentially a complex algorithm with nested rules (if's). I don't want Foo to have all the code, I want several intermediate functions to make my code more expressive but I face a dilemma.
Here is a simple example:
Let's say Foo could be written:
p... |
In this github, https://github.com/johnph/simple-transaction, under the Transaction.Framework project, there are entities (located at Data/Entities)
AccountSummaryEntity.cs
AccountTransactionEntity
and in the domain folder, there are domain model:
AccountSummary.cs
AccountTransaction.cs
TransactionResult.cs
From wh... |
I’m working on a problem which I will try my best to describe:
You have a stack of 5 blocks: labelled A, B, C, D and E.
You also have a set of rules giving points if certain conditions are met, for example: B is above D (1 point), D is above A (0.75 points), A is above D (0.25 points) etc.
The goal is to stack the blo... |
Made system update to temporarily disable HTTPS in our Tomcat server.
Previous users are still using Https:// URL to access system and receive error
message because it's disabled.
Would like to redirect users from HTTPS to basic HTTP version of website.
Have tried multiple different Connectors in server.xml file, but ... |
We sell a fleet management solution: it includes a mobile application, a web application and a set of APIs.
Technically the APIs and the web application are developed in C # .net (asp.net mvc and asp.net webapi). We are using as source control.
Our standard solution is implemented for a certain number of customers. The... |
I made the following diagram to show a typical separation of concerns as typically taught -
Here ClassA indirectly uses ClassB via the ISomeInterface, of course ensuring it doesn't know ClassB exists, only the methods within the interface, which ClassB implements. All the information I can find on this separation of c... |
I'm working on a system that implements multiple microservices which communicate via a RabbitMQ messaging bus.
These microservices are created using python with the pika library (to publish messages as well as consume a RabbitMQ queue)
One of these microservices (let's call it 'orders') has a connected database to sto... |
I'm working on breaking down a monolith application in smaller applications or microservices. Like always, sometimes it's easy and sometimes it's harder to identify domains and split those into smaller applications and databases.
I've found a number of domains (I'll show you two as an example) which all share
the use... |
I'm working in microservices environment, where each service authenticates using OpenID Connect to an authentication service (local IdP), based on Users I keep locally on my Database.
Now, I want these services to be able to authenticate using Azure, Google, etc.
Can (and should) I modify my authentication service to a... |
This is kind of similar to the Two Generals' Problem, but not quite. I think there is a name for it, but I just can't remember it right now.
I am working on my website's payment flow.
Scenario
Alice wants to pay Bob for a service. Bob has quoted her US$10.
Alice clicks pay.
Whilst Alice's request is flying through th... |
Is it possible for a queue to have multiple consumers?
I am working on a system where a single queue needs to be accessed by multiple consumers for different micro-services. Is it possible for the queue to retain data until after a consumer has consumed it or are there other possible methods for multiple consumers to ... |
I have a function that converts args given by argparse to a filename:
def args2filename(args, prefix):
filename = prefix
kwargs = vars(args)
for key, value in sorted(kwargs.items()):
filename += f'_{key}={value}'
return filename
What is the Python convention for such functions? I'd guess it wou... |
I need to move a single-tenant web application to a multi-tenant (about 100 tenants) web application. Tenants are going to share the same application but each tenant is going to have its own database (database for tenants) I have already planned to move my in-process application cache to a shared distribuited cache ide... |
I completely understand, I think, how injecting a dependency of a class allows that dependency to be mocked and the class to be tested with the mocked version.
What I am not sure about is if you use @autowired to do this DI and write a junit test, will newing up the class be okay? That is, will the annotation simply be... |
When writing a library, designing a class or extending some existing API, we often need to express actions or relations involving noun entities:
"Place the ball in the bin"
"Obtain the coat for the client"
(I'm trying to use concrete examples without too many programming connotations here.)
at times, only the nouns a... |
Suppose I have a function CalculateOutput(n) which creates an array of size n and repeatedly modifies this array by iterating through every element from 0 to n - 1 (say this is done in linear time). When the array is in a particular order then the number of times the CalculateOutput has walked the array is returned. Th... |
I recently found out that I have probably been using ball/socket notation in a wrong way all the time. Now I am confused by the different ways of drawing interface relationships in two regards (I think the answers to these are closely related):
1)
Given this small diagram:
I can create three components in a higher abs... |
I have the following common pattern that I need to use in an application:
Given a list of keys, call a function with a parameter to find values for the keys. The function may return null for a given key where no value can be found.
For those keys missing a value, go to step 1 supplying only the keys missing values and... |
Had an interesting discussion with our architect. It was related to replacing a plain DLL reference with a NuGet package. His worry was "If it is possible for single NuGet package to add multiple DLL references, then NuGet package authors can decide to add a new DLL to the package. So when we update the NuGet package a... |
I have a website developed for my client, and he's currently on an annual maintenance billing for the same post development pushed to production, that he'd paid me for the development charges separately, and then the maintenance billing, which i generate every month.
Now he comes up with new change request, which was n... |
I was not sure how to title this question, but bear with me.
My company is building a new product and for it we will use a third-party service (let's call it ENB for short) to be responsible for many operations on our data that are not our core business. It's in .NET Core if it matters.
To illustrate I will use the ent... |
I'm writing a number of Selenium test classes that use Helper classes which contain processes that are often reused (ie. accessing a particular page, entering something into a specific field, etc.)
Currently these Helper classes are instantiated in a BasicTest class which every test class extends.
I was thinking about... |
Earlier, we serve with web service but we decide to use dll methods. Because served products are on same machine with common database. So we start to create a library with .net core. This library will be used by seperate .net applications/projects. Should we use/need dependency injection? Application itself will be hav... |
I am studying a book about software design called: Nonfunctional Requirements in Systems Analysis and Design which talks about the Axiomatic Design Methodology.
This methodology has two axioms. One of them is the Independence axiom.
There is something however I did not manage to understand. It says about this methodo... |
I'm designing a platform that will run robots developed by others.
Basically anyone could implement a IAutonomousAgent and register the implementation on the platform. At runtime, the platform will identify the available implementations, load the code, instantiate and run the robots.
One thing that I have to be able ... |
I am building an app to register and update children information, this information is to be provided by their tutors. Every child can have multiple tutors, and a tutor can be a tutor for multiple children. This has been solved specifying a Table where I relate a student with each of their tutors by a unique registry, a... |
I was given a solution with many projects. Multiple projects call multiple REST APIs. These calls are scattered around the spaghetti code. Trying to figure out what calls are done in what sequence and what dependencies they have is daunting. Do you know of a way, maybe a design pattern, or a pre-existing tool, that... |
I am in a predicament. I am working in a repository that makes a lot of database changes within its functions.
The function I am dealing with returns responseIds (but from a transformation, not from any database action). However, as a side effect, it adds an object containing those responseIds to the database.
So shoul... |
I have this method:
private void ModerateTravel()
{
var vm = new ModerateTravelViewModel();
moderate.ShowModerateTravel(vm);
Observable.FromEventPattern<string>(h => vm.Error += h, h => vm.Error -= h)
.Subscribe(DoSomthingOnError);
Observable.FromEventPattern<string>(h => vm.Close += h, h => v... |
Imagine that I have a system to manage sports teams. Let's not make it specific to a particular sport, but consider that each team consists of a number of players.
Therefore, I might have an operation like this to add a player to a team.
POST http://.../teams/myteam/players/
And something like this to update a player... |
I have a question regarding CI/CD procedure. I do have 2 Jenkins jobs, the 1st one will build a binary file who is a dependency to the 2nd job build successfully.
Should I push this binary from 1st job to the 2nd one or should I pull this binary from 1st job to the 2nd one?
I'm NOT talking about Git here...
Basically:
... |
I'm experimenting with event sourcing for an application we haven't build yet. No, I won't implement this without any thought, I'm just experimenting.
My domain model looks somewhat like this. The whole model is created at once via a REST service call by external parties. Please note that the status history entities ar... |
I'm obsessed with organization - it's probably the real reason why I enjoy coding. So I namespace everything. But I'm just curious if I'm doing it wrong by being redundant.
Consider this, which I think is correct
namespace System {
class File {};
class Monitor {};
class Logger {};
}
Now consider this, which ... |
We've got an aggregate root that has a position value so it can be ordered among the other aggregate roots; relative position is something that can change over time. We'd like to have a method that's "Move X before Y". Where should that method live?
I see a few places that could have that method:
Aggregate Root: X.M... |
In any programming task, my preference is to write fail-fast code. That doesn't seem to be too controversial. However, I've also seen many developers say that constructors should do as little as possible. I'm finding that these two goals are often at odds, and conversations over fail-fast design vs. constructor simplic... |
I'm a .Net and Angular developer who's been working with OO languages throughout my education and work history. Lately I've been thinking about spending some time with one of the functional programming languages, namely Haskell, to try and get a feel for what functional programming is all about.
My main reservations ar... |
Over the years, I have seen quite a few questions on this site along the lines of "can I invent my own HTTP response codes"? Generally asked by those who are developing both the server and client. The responses tend to go towards sticking with standard codes.
If I stick with standard HTTP status code numbers, is there ... |
I have a FOSS library made public through GitHub. It's not a big library, it doesn't have a community around it or anything like that - but it does get a few dozen unique clones a week.
Now, I'm considering a design change in this library. It's not merely internal, it's a significant change to the API. It's "my" librar... |
Would it be feasible to provide (or further) multi-core threading ability for programs that weren't originally designed for such?
And doing so by creating a "virtual" CPU core (or for i7's with hyperthreading, virtual "virtual cores") which, to a program, the program sees it as a single core/thread, but on the other si... |
I've been going over some tutorials on machine learning using Python and libraries including SciKit Learn and Tensor Flow. (Basic tutorials like creating an algorithm to predict a price given input values).
I've found that these tools are extremely powerful, but they also appear to be quite slow, and require a lot of ... |
This is probably a design/architectural question.
My app uses RSA initiated SSO using SAML for authentication and from there on my app uses its own session to manage the request. There is a flaw in this design - if the user signed out of the RSA, my app session is still active.
How to check the RSA session is active in... |
I'm using MSTest. I have some async functions I'm unit testing that rely upon a lot of different methods where the result needs to be awaited upon. Sometimes the unit tests stall in a "running" stage for a very long time and I'm attempting to pinpoint which blocking operations are taking the longest.
The solutions I ca... |
So i want to make a sequence diagram for login .. the first step is user access my website then the system redirect to login Form, then he insert username and password than the system validate it , if success it will direct him to homepage
my question is : how to put UI like login form into the sequence diagram? i use ... |
I am trying to understand the concept of dependency inversion and I think I finally got the concept. However now I am struggling with another issue, which is the selection of framework, when implementing it in .NET, at least.
Say I have a business logic assembly which has the need for a data access class. For that I ad... |
Most binaries have jump and control flow instructions that are relative to other locations in the binary. For example: if I modify an instruction around 0x12341232, and there is an instruction somewhere in the code that would do jmp 0x12341234, that 0x12341234 location will not be the same.
So,
# Original
0x12341232: ... |
I had to increment my integer twice in a loop, so I thought I would try and be clever:
for (int i = 0; !sl.isEmpty(); ++i++) { ... }
++i++ however is not an assignable expression, at least in GCC.
Is there a technical reason why this is the case, that logically, it would be impossible to implement such a syntax rule?... |
When evaluating whether to use webhooks or polling for an architectural decision I've been reading some articles. Most highlight the obvious drawbacks with using polling such as:
wasted resources (most polls don't return an update)
added latency (due to polling timeout)
So most recommendations burn down to "use webho... |
So I am in the process of finishing an app (android for now), and I have a doubt about if I should have papers that proof that I made that app.
Its the first time for me to publish an app, and I am concerned about how to prove that I made the app and it belongs to me.
In other words
If I came and asked the instagram ap... |
Well, I've been hammering away on this for about a week now with no practical progress because I can't find mental fluidity with the concepts I'm trying to wrangle. I'm Officially Stumped, and would humbly appreciate any insight.
Some minimal background: for several years I've used my own small PHP (CLI-only) introspec... |
My app is using this kind of layered architecture:
Controller > Service > Repository > Data Mapper > Persistence
Often I notice that my service methods are just directly calling repository methods without "doing anything else" to them. E.g.,
Class UserRepo
{
// ...
public function getUser($id)
{
re... |
As far as I know Data Oriented Design differs a lot with OOP. It encourages reusability of data, discourages polymorphism, etc. And because SOLID uses OOP a lot (especially Interface Segregation because of obvious reasons), how do you do it with DOD? Using functional paradigm, maybe? But how? Or if you don’t / can’t us... |
This is quite theoretical, and I hope it's the right SE site.
A couple of years ago I worked at a company using Maya 2014 (I think that was the version) with a couple of other 3D Artists.
Eventually I figured out that there's a short, reproducible sequence of operations that I can do that will lead to the crash of the ... |
I am wondering about how to make lower-level code reusable when the Dependency Inversion Principle (DIP) is used.
In the book Clean Architecture by Robert C. Martin, the DIP is described such that the higher-level components define the interfaces they need, and then the lower-level components implement these interfaces... |
I'm a C# developer & never worked before on either unit tests or Selenium browser test automation.
For a current assignment, there is an existing Visual Studio solution that has a project that does test automation. This solution has no unit tests.
For e.g, there is a form on the live site that captures customer data. T... |
Please consider the following code:
class baseclass {
public $hideme;
public function getit() { return $this->hideme; }
public function setit($value) { $this->hideme = $value; }
}
class derived extends baseclass {
private $hideme; //can't do this
private function getit() { //can't do this
... |
I want to use Dependecy injection in my new .net core project, but my manager thinks it is an anti-pattern usage. I already know benefits of dependency injection. But my manager cares architecture more than everything. Anyway, when search about it, i have read enough reviews. There are different opinions about it and i... |
I've just finished my studies in Computer Science and now I'm working.
The problem is I'm the only computer scientist in my company and I'm probably taking a lot of bad habits. I would like to correct it if one day I have to work in a team.
I hope this question belongs in this community:
In a C++ Git project, where do ... |
It's my first post here as I understand that SO is a platform to find fixes and this is where to ask questions about more general questions. Correct me if I'm wrong
I'm working on project in Laravel and I started wondering where to put my code.
It feels like this would perfectly fit in my Item model, but I'v always put... |
Premise:
- Two services A and B
- Resource X has owner U, and is managed by service B
Now, I need to handle these auth scenarios:
1- End-user needs to directly use service B's API to access X
2- Service A needs access to X, because end-user made a call to A (i.e. delegation)
3- As part of a async comms (e.g. a job or... |
One of the primary job responsibilities of the Scrum Master is to remove impediments. Working at several different places, I have yet to grasp what kind of impediments they are supposed to be removing. Here are the typical impediments I see most developers having:
Technical (I can't figure out how to write this, thi... |
Context: I'm an embedded dev with only 2 years of solid experience. I'm the sole technical employee of a startup of 4 people. We have an MVP of our product out and are getting ready to develop the next iteration of it. The original MVP was developed by a partnered contractor team, with one older embedded dev doing ever... |
I recently joined a team who is trying to use "microservice" pattern for their new application. They've already started to implement API's. In the end it should be an API for both mobile and web UI. I have some issues about their implementation.
Things that doesn't make sense to me:
Every "microservice" is inside one ... |
I've have an n-tier .NET 4.6 internal business application. It has a business logic layer class library project that references a data access layer class library project. It's designed to decouple the two so that, in theory, a different data access assembly could be swapped out without modifying the BLL.
But a new idea... |
I am looking to better understand best practices for handling large quantity of parameters. I am particularly interested in the types of parameters involved in machine learning code bases and considering the patterns in which they're manipulated. These machine learning parameters typically possess the following chara... |
Similarly to a rest api, I want a server to listen for an email to an address I have created, and in response to mail being received, run code that I have created. Is this possible already? I understand how to call an api or create a micro service, but it seems like triggering code when someone sends an email is esoter... |
I'm facing some difficulty with designing a factory and/or strategy pattern for building out EmailTemplates. IMO this seems like the design pattern to go with, but I feel like the path I'm going down isn't very extensible and will be prone to spaghetti-like code in the future. The problem is this: an EmailService takes... |
Encapsulation
In object-oriented programming (OOP), encapsulation refers to the
bundling of data with the methods that operate on that data, or the
restricting of direct access to some of an object's components.1
Encapsulation is used to hide the values or state of a structured data
object inside a class, prev... |
We are automating the testing on an Web ERP solution (Dynamics) through a tool (RSAT, which uses selenium) provided by the developer of the ERP (Microsoft).
The RSAT has a list of instructions to do some actions on the pages and it takes the values to use from an excel file. The RSAT can be used with command lines.
So ... |
I have a configuration application in Nodejs. It has a Component with name and uuid. A Component can have many Schemas. A Schema has a uuid, name, componentId, json. A Schema can have many Configurations. A Configuration has name, schemaId, json and uuid. A Schema can contain reference of many other Schemas in it. Now ... |
Assuming the following scenario:
A python application that receives file and process that file trying to understand what the file format( any type of data/compressions/archives/packages/mounts/etc ), then it open(cuts) the file and sees which files are inside that file and tries to execute the same logic as before.
Al... |
I have a project that has a DD design, and also uses dependency injection. During development, we connect to a test database which contains a former snapshot of production. This works well 95% of the time. However, for some processes that we have to implement into our application, the underlying SQL statements, (of w... |
Consider I have a class which represents a tree element. An element can be changed, inspected children elements can be added to it (say trough the add() method). But also I have a class which contains root of the tree (State). And for convenience's sake I have added static overload of add() method which adds elements t... |
I'm working with an API that has many asynchronous calls and handlers. I'd like to extend these with a RESTful interface and endpoints in spring. I'm imagining the usual Controller and Service layers, where the Service probably wraps these async handlers. I've read several articles about CompletableFuture, @Async, and ... |
I am trying to create a thumbnail from a video that I'll be uploading to my Web App(React). And then I'll upload that video to AWS S3, and thumbnail(image) to S3 as well.
I wanted to know where should I create the thumbnail from a video frame, either client-side or in a Lambda service?
I asked someone and they said to ... |
In UML 2.0, there are two ways of representing an association between classes which I can't seem to distinguish between.
First of all, there is the qualified association, represented as such:
You also have an association class, represented as such:
I would say that in the case of a qualified association, it is assum... |
Where I work we follow a scaled agile process based on scrum which we've changed to suit our culture and needs.
One thing I feel we are missing are guilds to allow the free flow of information between members of a community of interest.
I'd like to setup a guild for Software Engineers however most information I've foun... |
I wanted to learn more about systems and so I was reading about x86 global descriptor tables for memory segments as one does, and I came across this table from here:
I think I understand why all the information is needed, but I don't understand why values are broken up in this way.
In particular, why did the designers... |
I've been using python for several years as a non-developer writing scripts to help business processes. I'm in a new position (still non-developer) and would like to adopt more rigorous coding standards (especially since the projects I will be working on will be bigger). Specifically, this means, in part, creating dist... |
I'm not registered with Facebook and I've never logged in to Facebook inside the browser I use, Today I enter the site facebook.com and see my actual phone number on the sign in page with this message:
Facebook requests and receives your phone number from your mobile network
So how does a website, in this case Facebo... |
Stripe API uses a key called Idempotency-Key for achieving idempotency: https://stripe.com/docs/api/idempotent_requests. Is this similar to a nonce?
|
Q: Do we need project managers in the agile organisation when doing software development or are the project governance replaced by product governance?
There are several questions asked and answered here about the role of project managers in Scrum. These questions come to some help but what I'm asking here is that the o... |
I have some doubts about practical ways to violate the Liskov Substitution Principle regarding pre and post conditions.
I created examples in which I believe the first child respects LSP and the second violates it. But the Liskov article is very mathematical and now I am not so sure.
The first example is about pre cond... |
I'm wondering whether it is bad practice to keep a user's ID in a JWT.
I'm planning on using the email in the sub, since it's already available to them, and I can use it to identify them, all the same. I can let the DB index it so it's easier to retrieve their information using the email rather than the ID.
Isn't it be... |
I like to invert dependencies whenever possible by depending mostly on abstraction and allowing the concrete implementations to be passed into the object by clients, or a factory. I've found this to be pretty conducive to testability and extensibility. Here's a simple example:
public class Feature {
private final I... |
Under the context of dependency injection - that is, an interface has mostly one implementation - I took the habit of exposing via the Interface a bunch of fields which are never called by the consumer classes. These fields reflect a high-level implementation strategy; I decided to expose them via my interfaces because... |
We have a case scenario in our project where we are provided with a set of XSDs. These XSDs we converted to Java Pojos with the help of JAXB. After this we were suppose to update few values in the Pojo and converted back into the corresponding XML file.
The number of XSD provided to us is large, they are similar - but ... |
In HTML/CSS, inline elements, such as <span>, do not support explicitly setting their width via the width CSS property.
This is confusing to many developers, as questions like "Setting the width of inline elements" show.
When learning technologies, I always find it helpful to understand the "why?", the motivation behin... |
Is there anything that can calculate the Big-O notation of a function?
While learning about Big-O, it is implied that it is pretty trivial to do in your head once you know the basic rules, however if that were true, I would expect this functionality to be embedded in various IDEs. I have not seen any tool like this.
Is... |
In Go we can choose to make something a pointer or not. We can also support multiple return types. A common signature on functions or methods is:
type MyType struct{}
// Value Return Type
func (m MyType) FindOne(key string)(MyType, error) {...}
// Pointer Return Type
func (m MyType) FindOne(key string)(*MyType, error... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.