instruction stringlengths 34 36.1k |
|---|
I am trying to architect a stand-alone WPF desktop app, but the question could be applied to any programming framework.
This app has an UI where user interacts to send commands and receive/view output.
On the other hand this app also talks to some hardware devices. Now, this hardware devices also have a UI which user c... |
Say I am a QA person so I have no control over the complexity of the code in the following example.
I have a datatable widget with many different filtering and searching options. All the columns on my data table are also sortable.
There are many issues with components not working together. For example, if someone uses ... |
I am trying to create a library where I need to validate and parse a file in a CSV-like format and then use this data to generate a Tree data structure.
At the moment I split the process into two steps:
Validate the file and store its lines in a list (in the parsing package)
Read the list plus a string array containi... |
I'm just learning about dependency injection. Unfortunately, I don't have the luxury and time to learn a DI framework right now so I am attempting to do DI through some simple means.
Say I have an object A, that requires a class B, and class B requires class C. When I go to create Object A, is it best practice to creat... |
We are building a small social media platform for collaboration among a group of similar (but disparate) organizations. Each organization will have a small group of users who will be able to post content on this platform.
What would be the recommended ways for these users to create accounts on our social media platform... |
I really need some advice as I've recently come into a conflict over a difference of opinion on the SOLID principles and writing clean code.
One of our, relatively new developers but senior, does not agree with me that it is not a good idea to inject the Database context directly in the controller and then have all the... |
Overall situations:
The plan was to build a large system (Management Information System or MIS type) to be used throughout the country, by say 100,000 users daily. The team decided to split that into small MISes (something around 15), each of which with perfectly divided business specifications and roles. Each MIS work... |
I am implementing a library that:
Takes some input data (I put data structures and classes in the parsing package)
Stores the data in a structure (I put data structures and classes in the storage package)
Present the data in some meaningful way (chart package)
I divided my code this way because if I want to add anot... |
Context
I'm currently developing an application following the Clean Architecture principles (at least I'm trying really hard to follow these).
All my Dependency Injections are done manually, without any Framework.
One of my Use Case consists of the user being able to answer to a question he was asked.
If he/she is wro... |
I'm often finding that my classes end up with many (10-15) dependencies being injected. I realise there is no hard and fast rule, but someone once told me that more than 4 or 5 can be a code smell. The classes themselves typically aren't that large, at least in my opinion (1000-1500 lines).
Such classes aren't your ty... |
I would like to model the following entities:
"Person", "Company" and the aggregate that ties the two together "Membership". I have identified that Person and Company are aggregate roots. Thus, "Membership" would hold a reference (id) of both those aggregate roots, plus other value objects/entities that a membership ho... |
At a conceptual level, what ways can a subscriber catch up with events it has potentially missed but needs to know about at a later time.
For example, a service is running and subscribes to events on an event bus. When the events arrive that it's interested in, it updates its persisted data to keep up-to-date. However,... |
This is a question for people who are familiar with how HTML typically is built and behaves on webpages.
Backstory and requirements
I am building an HTML tracker with a C++/Qt backend. I am trying to track when Elements are destroyed and created simply by interpreting the html string, to which I will send signals off w... |
I'm trying to build an web API that closely represents a library of books. I currently have the following routes.
GET /api/books
GET /api/books/:bookID
GET /api/libraries
POST /api/libraries
This route currently accepts a books parameter in the body (with the body represented as an object), that should be an array o... |
I know it's a broad question so I'll try to be as specific as possible. This question is probably as much an "organisational" question as a technical one.
Our company is selling our software/platform to let's say 10 customers (also companies). These customers are all running their own installation of our platform, and ... |
I have a requirement of developing a service that must generate each day few millions of random and unique alphanumeric String of length 10 (I can't increase this length, this is a customer prerequisite). Having a ID, the next ID must not be guessable.
I want to be sure that all IDs will be unique because thoses IDs wi... |
I am trying to gain better understanding on SRP and when I was checking out a Pluralsight video by Scott Allen, I saw code like this:
https://github.com/OdeToCode/cs-fundamentals/blob/master/src/GradeBook/Book.cs
https://github.com/OdeToCode/cs-fundamentals/blob/master/src/GradeBook/Statistics.cs
public class DiskBook... |
Let's assume that I am working on a small project that uses feature branches to organize tasks. For example, feature/login would be for working on the login functionality and feature/create-new-post would be for adding functionality to allow users to create new posts. When a feature branch comes to a relatively stable ... |
I'm currently building a facade that's supposed to be in front of a system we are currently using. This system has its own API, but we have decided to simplfy things, and therefore the facade.
However, this system requires the consumer to log in using Forms authentication. Once the consumer has signed in, the system s... |
If you have two positive numbers that can be represented exactly by the finite arithmetic of your computer, that is, two machine numbers, if you perform their sum or subtraction with perfect arithmetic, is the result a machine number aswell?
I suppose that in the case of multiplication the answer is not necessarily, bu... |
I've always know Unit Tests to be something you do in code. You write functions to test other functions. Our team has been working with the same project manager for a while now and he's always referring to system tests as unit tests. By system tests I mean the kinds of tests where a user follows a test plan and perform... |
I am reading through this bit of the Jenkins Docker README and there seems to be a section that contradicts itself from my current understanding.
https://github.com/jenkinsci/docker/blob/master/README.md
It seems to me that is says to NOT use a bind mount, and then says that using a bind mount is highly recommended? I'... |
I have a Spark Streaming Job which processes messages coming from Kafka.
My incoming json that I process sort of looks like
{"sv" : 1.0, "field1" : "some data"}
The only thing I do is put these in a MYSQL database.
However, I need to process these messages differently based on the schema version number!
For instance,... |
I've recently started applying the Clean Architecture while developing an Android application. And so I divided my application in 4 different parts.
Data layer
Contains the implementation of repositories.
Device layer
Contains implementation of android related stuff like AlarmManager, not related to storage of entitie... |
There are a number of CSS frameworks that have a one-to-one correspondence between many of the classes and a single style. For example, in basscss ".inline-block" is defined as "display: inline-block;".
What benefit is there for making a class that matches one specific style?
Usage of such classes could be replaced wi... |
I am trying to switch to semantic commit messages for project. While the idea is good, sometimes I find it is difficult to properly categorize changes like a configuration value change.
If I commit a change in a database password or raise the size of a worker pool, what is the appropriate type for it? Is it a chore, fi... |
I need users to be able to create an organization which will have some preset fields such as Name, Address, and Type. But depending on the type, the organization can have type-specific fields such as as President, Manager, or something that I can define at a later date that the user can also fill out about their organi... |
I'm having struggles how dealing with inherited roles. Here is an example :
As an admin, I want to do something 1
As an admin, I want to do something 2
As a super admin, I want to do something 3
So basically the super admin has the same privileges as the admin with some extra features. My problem is, how can I express... |
I have a frontend application, that only knows about and communicates with a single backend service. This backend service serves only this frontend app and no-one else. Backend is completely stateless, no user session or response caching.
Backend exposes a few operations, mostly commands that go to external SOA service... |
I just read documentation and tutorial about dependency injection (DI) and the singleton pattern (SP). Everybody seems to says DP is bad and DI is the way to do it. Tutorials about dependency injection use some framework like Autofac or Ninject. They also all explain DI don't need a framework, container. I understand.
... |
The project is using C++ and the code takes around half an hour to build on a 32 core box. That time can be longer, e.g. 1 hour+ on a developer's local machine.
I notice the efficiency is low when one is doing the build. Just sit and watch it is waste of time.
A typical case is: modify some code, then build, if build f... |
In a particular program I had written, I noticed I had a few classes with this pattern:
class IdObject:
'''Objects with generated id properties'''
def __init__(self, id_generator):
self.id_generator = id_generator
self.id = id_generator()
class Node(IdObject):
'''Represents a node in the gr... |
Suppose I have a function (or object or module) that is imported by 100 files, and that making a change in the function will affect all these 100 things that depends on it, possibly breaking them. What is the word for this situation?
|
Say for a given positive integer number n, you have to find a level k so that
1 + 2 + 3 + ... + k = S is below or equals n
but S + k + 1 is above n.
For example in python:
def find_level(n):
level = 1
while n > 0:
n -= level
level += 1
return level - 1
What is the O magnitude of this func... |
I am in the process of building an API in Laravel and my server is currently stored in the UK. Now I have read some of the posts relating to this topic on Stack but I am still a little unsure as to the best approach.
I am wondering whether to make single or multiple calls to the API when loading screen data for the app... |
What is the difference between buffer overflows and out-of-bounds writes? Are buffer overflows a kind of out-of-bounds writes?
|
tl;dr
Which is the best server response for an endpoint to get a user's age?
30 or {"age":30} or {"metadata":{"time":1561919615,"status":200},"age":30} or something else?
I am writing a server using Firebase Functions. I am trying to determine the best way to send my responses. My server-side experience is minimal.
... |
I am currently building a microservice-based system to learn CQRS/ES, Docker, AMQP and all the other goodies that goes with it.
I have never asked a question online before as I am usually pretty good at finding answers to my queries by reading what that others have asked.
This time, I am stumped by what seems to be ver... |
I am working on the project where currently we have following three fixed branches
Develop - The code is deployed to development environment. It's a base branch for anyone who want to add new feature.
Release - Deployed in QA environment, and QA can start testing on.
Master - Deployed to Production environment an... |
There are plenty of examples of both associative table and one foreign key designs out there, but I can't find clear any explanation of when should each of them be preferred.
For example let's assume my database needs to store the following information about people: first name, last name, address. I have 2 options of i... |
I believe, for PHP, that I've found the worst culprit when it comes to bad code: not being able to declare (return) implementation details through interfaces. This makes it unpredictable to see what you're working with if you go beyond the basic interface that (in 5.6) doesn't even support return types at all.
An argum... |
I'm working on a software in which the client wants the admin to have all the rights to view and update the info of other employees. The admin is an employee itself so this is what I've come up with but I wanted to confirm whether this is the right way to do it or not? What could be the potential issues with it if any?... |
In a testability perspective, would this logic be appropriate?
public class Foo {
public List<SomeClass> Elements {get; set;}
public Foo(IServiceInterface service) {
this.Elements = service.GetElements();
}
}
or this would be the right way:
public class Foo {
public List<SomeClass> Elemen... |
I would like to be sure I understand the concept of dependency injection (DI). Well, I actually understand the concept, DI is not complicated: you create an interface then you pass the implementation of my interface to the class that use it. The common way to pass it is by constructor but you can also pass it by setter... |
Context
I am building an application for searching places 'Nearby' akin to Yelp/Google.
Objective for this question
Recommend a strategy to do paginated searches based on location and ask for advice on the same. Further, ask for frameworks and tooling that support the design.
Please note: I do not want to complicate th... |
For the discussion, I will provide my example. But I am interested in the broad guidelines.
I save in my postgres DB legislation (law texts) composed of a single header (H), paragraphs (P), sub-paragraphs (SP) and sub-sub-paragraphs (SSP).
Every level owns some content, rules, applications, etc.
Every block has the ... |
This is the case:
We have one Scrum team of 7 members (developers and QA's) plus PO and SM
We have content team of 3 members that are responsible for portal ''look'' (banners, pictures, copywrite etc.)
This is the problem:
We have situations where development team is working in the sprint and we only use lorem ipsu... |
I am a student working on a personal project which is essentially a location finder that will be on a website. I have a data set of over a million addresses and I want to display the closest N locations to a given address or current location.
I would greatly appreciate some examples of the technologies/stack that an e... |
I'm modeling a system while improving my knowledge of software engineering. I am building a class diagram and a component diagram, but notice that when I tweak one, I have to alter the other. Also, I feel like I can represent the classes in a component diagram. How do you do this? Do you make them both or only one? If ... |
I have different equations to compute the same quantity. For example, val = my_func(a, b, c) but also val = my_func(x, y), where my_func represents the quantity I would like to compute: it could be Velocity or Momentum or something completely different. I have dozens of quantities to code, each with multiple equations.... |
I am not asking whether to do server-side validation or not.
My question is whether any solution or better practice exist in the software world to address this repetition of code.
|
This is quite basic question that started puzzling me recently while studying Lisp (and derivatives). I have read some Lisp books and web sites and this subject is somewhat obscured by other Lisp properties that seem to be having more meaning to the authors so they give them more attention. So I cannot find this subjec... |
We developed a generic .NET library for our line-of business applications. This is what our namespace/class structure looked like 5 years ago:
...
AcmeCorp.Tools.ExcelWriter
AcmeCorp.Tools.Code128Barcode
...
5 years later, the number of classes in the generic Tools namespace has grown (e.g. there's now a CSVWriter in ... |
We have started using a "micro service" architecture and we have multiple services. Each service owns the data and the business logic for a domain and only entity ids are shared across services.
Everything was perfect until 1 requirement came in...
On the UI, when a user is about to delete an entity, a warning listin... |
In my case I inherited a poorly engineered code, on that piece of code I have been tasked to increase the code coverage in integration tests. But instead of the usual pattern:
Create/Populate a test database with specific test data
run the test
Delete the test data or Nuke the db
Repeat step 1 until no more tests.
Th... |
I am working in a purchasing system where we take calls:
public class Call
{
public List<CallItem> CallItems { get; set; }
}
The calls can be turned into quotes, where call items become quote lines:
public class Quote
{
public List<QuoteSegment> QuoteSegments { get; set; }
}
public class QuoteSegment
{
p... |
I have a system where a user uploads a file to import some users but it's necessary to do some validations and this take some time. I would like to create a work queue with RabbitMQ and the user will upload de file and I'll send to the queue and then process it.
What is the best design to use in this case for my prod... |
I've struggled to find any discussion on this.
If you have a simple MVC page for updating a User, and you put a dropdown list on it of Country, you need to populate the dropdown list in the viewmodel. Let's call it List<Country> countries {get; set;}
If the page is posted, and there's an error like they forgot to put a... |
What are the pros/cons of having a serialization function accept a sink:
class Foo:
def toString(self, stringIOSink):
pass
def toBytes(self, byteSink):
pass
versus having the serialisation function return the result:
class Foo:
def toString(self):
# ..
return s
def toBytes(self):
# ..
... |
Continuous integration with testing is useful for making sure that you have "shippable" code checked in all the time.
However, it is really difficult to keep up a comprehensive suite of tests and often, it feels like the build is going to be buggy anyways.
How much tests should you have to feel confident in your CI pi... |
So let's say I have a view model, representing a student. The view model is corresponding to a student model, from which the data comes. What I am struggling with, is how to populate the fields in the view model. Do I simply forward reference the fields from the model (where possible) or do I have actual fields in the ... |
I entered yesterday to my new job and while browsing their repositories, I noticed they have a project for every resource of a REST API. For example, if they need to add a REST resource called "people", they proceed to create a whole new repository that contains only the endpoints of the resource "people".
Honestly I'v... |
public class LDLTrackViewModel : RailwayViewModel {
private LDLTrack _ldlTrack;
public LDLTrack LDLTrack {
get => _ldlTrack;
set { _ldlTrack = value;
OnPropertyChanged("LDLTrack");
}
}
public LDLTrackViewModel(LDLTrack ldlTrack) {
LDLTrack = ldlTrack;
... |
Assuming we have following message that will be used to update data and it just got updated to version 2.
message HelloRequest {
string name = 1; // version 1
bool is_valid = 2; // version 2
}
Now assuming we updated our apps like so:
server : version 2
client A : version 2
client B : version 1
We don't have any... |
I have a web app that connects to a MYSQL database which has some encrypted data in it. The encrypted data is encrypted using the the mysql AES_ENCRYPT function and a key.
Now, this key has been static for a while, and we're looking at methods to change the key (and ideally change the key periodically). My problem is t... |
If I write this code in a function:
void func(void)
{
int x = 0;
int y = 3724832+x;
}
It would (probably) optimize the variable y out because it isn't being used. Even if I'm wrong about this specific case, the point I'm making is that the compiler has the ability to optimize out variables.
My question is does... |
I have a small library where I am performing 1 long running operation and based on that operation,I am saving some data inside database tables.Now this is small library which does not include alot of database tables operation hence I have used Ado.net to manage data access layer.
I have created base class where I have ... |
I don't use SSL on my website currently. It's a small hobby site with no online store or anything of that nature that would need it. I've read that Google Chrome will stop loading such sites sometime in the near future. Are there going to be additional future consequences if I don't purchase a signed SSL certificate?
|
I have a question about Fluent Interface Builder.
I have a simple object like this:
public class Person
{
public string Name { get; set; }
public string Surname { get; set; }
public int Age { get; set; }
... other properties
}
and I have a simple UserBuilder class:
public class UserBuilder
{
priv... |
I am implementing a Binary Search Tree and cannot decide if it would be good practice to constrain the generic type of the tree to a comparable item, i.e. IComparable<T>. Or, to just use the default comparer, i.e. Comparer<T>.Default. To me they are functionally the same and they both provide a method to sort with.
Can... |
Here's a snippet of code:
An inlined function:
inline void rayStep(const glm::vec3 &ray, float &rayLength, const glm::vec3 &distanceFactor, glm::ivec3 ¤tVoxelCoordinates, const glm::ivec3 &raySign, const glm::ivec3 &rayPositive, glm::vec3 &positionInVoxel, const int smallestIndex) {
rayLength += distanceFacto... |
I have decided to try to create my own board game implementation. Probably going to use a REST-api to expose the contract. I'll figure out what database, communication, ... tools I'm going to use once I've got my business logic set.
Now, to achieve not being dependent on tools/frameworks in my business layer, I need to... |
Let's say a user goes to the log in page of my website and creates an account. Instead of entering their real name, they decide to write some sql code and try to gain access to my database.
I have prepared statements to prevent any harmful code from altering my database at the signup process, however if the user goe... |
Do I need unit testing for everything? I know that Unit testing is not necessary for really small tasks, but what about for bigger stuff? How do I know I need a unit test?
|
I generally try to adhere to the 80 character limit for each line of code to satisfy my colleagues, to satisfy the linting tools, and to maintain an image of professionalism when random people look at my code.
However, sometimes I have URLs that I wish to embed in the comments, and some of these URLs are very long (exc... |
Hello I am building a demo project to teach myself about clean architecture and unit testing. My setup is very similar to this github repo https://github.com/mmacneil/CleanAspNetCoreWebApi
The important parts for this question are the following 2
The Core project which should contain the business logic
The Api projec... |
Throughout the course of programming, you will end up with some comments that explain code and some comments that are removing code:
// A concise description
const a = Boolean(obj);
//b = false;
Is there a good method to quickly parse which is which?
I've played around with using 3 /'s and /** */ for descriptive com... |
I am currently building an Entity Component System (ECS) in cython in order to speed up operating on large numbers of game objects in python. In the process of building this system, I ran into the following architectural issues that I would appreciate shedding some light upon. I have read through lots of online blog po... |
In our current project we are versioning software using gitflow as process and git/gitlab.
We had some trouble managing multiple release at the same time, but nothing we couldn't survive.
Until now we had only client A and the project is very oriented to it.
But client B will join soon. Also, we want to start to build ... |
tl;dr: I work at a small company with a development team of 5-10 people, lately we have been asked to present "scope documents" for effectively all of our work before we carry out the actual work, with seemingly no regard given for the magnitude of work required.
I worry that I am often spending more time writing scop... |
I'm new to Core Data, and am not sure how to reconcile the need to inherit from NSManagedObject with the fact that my model is a Swift struct composed of structs. I chose to make my a model value type so that it would be simple to push and pop it onto an undo stack. But since a value type can't inherit, I'm unsure as t... |
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, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.