instruction stringlengths 34 36.1k |
|---|
Are there cases where more verbose code (as in more logical statements) is more clean than more concise code?
|
We use a branching git workflow, but we have real issues with merge conflicts. None of us are git gurus so we always end up manually resolving the conflicts in an IDE which is error prone.
There has to be a better way? We have 4 teams, all with 5+ devs working in the same (very large) codebase.
We branch off master... |
We have multiple projects that are using common binary assets (e.g. images, sounds, 3D models etc.) stored in a folder on a server. Right now, each project adds these assets to their git repository. The result is that we have multiple copies of the same asset across different repositories, and if the asset changes, eac... |
Right now I construct all objects of my application in the root class manually. Since it is getting ugly now, I want to switch to an IoC-Container like Autofac. Now I have to register each interface with its corresponding implementation manually. Looks great, works great, but:
Say I have to modify one of my classes' co... |
I am making a watchlist type application that will get all items being watched and then poll an api every ten minutes or so to check on its status.
I am trying to design the database portion of this project and wanted some advice on the best technology to use. I am very experienced in relational databases but have used... |
I have a very specific use case. We are working on a Project where user can buy the tickets to an event. In this, we are asking the user to enter an Email id where he can receive the email from where he can receive the ticket onto our App. This email has the link using which user will receive the ticket inside an App. ... |
Minimum-documentation is one of the basic features of agile development (intuitive GUI, visually rich documentation, automated tests replaces it). But usually software development goes hand in hand with the development/reengineering of business processes and (in opposite to agile software development) the introduction ... |
I am planning to set up a new Web-application that contains the following things:
I want to use JavaEE with JSF for the Frontend & Backend combined with git-hooks to deploy them onto my server. Also it seems to be useful to integrate the Spring-Framework whenever you use JEE. Now additionally, I need some database inte... |
So one thing you do not hear much about is inheritance with DDD. Currently I have an Account aggregate that handles details regarding a financial account and its subaccounts. Then a Transaction aggregate is used that maintains the invariants related to a financial transaction. The transaction is not a split transaction... |
Let's say I have users, groups (or "roles") and resources, and I want to manage various permissions on those resources. As far as I can see, there are two main "philosophies" when it comes to permissions.
For lack of a better word, I'll call the first one "precedence-based", and it's used, for example, by NTFS or SQL... |
I am working creating api for activity feed of user. Feed contains different type of entities.
Before that let me give you bit overview about the app. Its a video app where Users can ask questions then we show results of matched solution. If user watches any of video from matched solution. we show that in feed (all use... |
I need to check for the existence of a record in an SQL database. If it exists, create a printer stream and send it to a label printer.
My issue is that I have as many as 20 of these services running at a time. It seems like a bad practice to continually monitor the tables for data, but I cannot come up with a better... |
So my client asked me to provide a rough estimate of a number of CPU cores and the needed memory for a specific project I'm working on. But the project is complex, is different from anything I've been working on and different from anything they have running, is not completely defined yet and not much has been done.
I ... |
A short introduction to the problem: I'm working with a small database where I have a table of strings (web URLs, to be precise) as pairs: hash|string. Another table references these strings by hash so I'm saving a lot of space and some CPU cycles by using hashes (a compact identifier of a string). I knew collisions we... |
I'm building a PHP app which should somehow receive emails that are to be imported into user records. None of the solutions I've come up with will work (listed and explained below). I'm hoping someone out there has a possible solution.
Our organization's email is hosted by Google, and so I can use the Google API to a... |
I wrote an app with the MVP Passive View pattern.
My solution has four different projects. A MyApp.Core containing all kind of business logic, a MyApp.Forms containing stuff related to WinForms (UI), a MyApp.Tests contain all unit and integration tests and a MyA0p.Xamarin containing stuff related to XamarinForms (UI).
... |
Non-mainstream OSes (Genode, BSD, Haiku, etc.) tend to have problems with drivers availability/support. Why don't they reuse Linux drivers? I would imagine they could provide some ABI compatibility layer, which would make reusing Linux drivers possible. Why don't they? If "it's too much work" — can you give an example?... |
WhatsApp has the "Delete For Everyone" feature that makes it easy to delete messages you did not intend to send to the other user.
For text messages, this recall is easy, but what about Video, Photo or other message resources? In Android, whatsapp messages and resources get saved on the device. Is that deleted too us... |
so I'm working on a website project with the goal of writing my own blog posts with markdown syntax. I made some thoughts regarding the handling of the markdown and the conversion to HTML, storage solutions, performance and flexibility. I'd like to get your thoughts and experiences regarding this, trying to find the op... |
This question is an extension to this question.
I am also brainstorming on this problem statement wherein a 1-dimensional parking lot having N slots will be having varying size parkings to do.
A two-wheeler occupies 1 slot, a car occupies 2 slots and a bus occupies 4 slots.
We have to design a system that efficientl... |
I'm making a rental app which has many categories with unique properties
Example:
Category 1
Car which has
Fuel, model, color, speed
Category 2
Apartment which has
Rooms, lift, generator, floors
I've been thinking of a db architecture for this type of project, but I couldn't find any which could man... |
Computer-science wisdom says that a lock-free FIFO (queue) is the right way to synchronize shared data between two threads in a lock-free manner. I know what a queue is and how the lock-free property is accomplished, however: how a FIFO queue solves the problem? How to practically use it? What data should go into it? ... |
Say that I have a repository that is used as READ-ONLY data provides (never for the writes/updates) - the query part of the CQS, NO event sourcing, hitting relational DB.
One of the essential rules - application logic is dictating the interface and the models to be restored from the repositories, no exposure of the und... |
I'm working on a project with others and we have a discussion about information hiding and static type safety. Our scenario is described below.
Language: C++11
Scenario: We want to create a tree-like structure. Each tree nodes has its own class, which all are sub-types of base class NodeType. Each sub-type has its own ... |
So for example if I have a producer that sends a message
{id: 1}
to a consumer that expects that json object. And there's a ton of messages sitting in the queue waiting to be processed. I'm also writing some code in the producer & consumer so that it accepts {project_id: 1} instead of {id: 1} now. This will cause al... |
I am confused , Why Software that are developed using the evolutionary approach are harder to be maintained ?
|
I am developing a virtual machine for personal use (open source of course!)
In researching and looking at the source code of other virtual machines, especially those of scripting languages; I noted that all the VM archs I perused used a load/store architecture but I've never seen a VM arch use register/memory architect... |
Is this requirement:
The system is required to have an easier GUI to make it more usable by
any kind of user (normal or disabled user)
a functional or non-functional requirement ? And Why ?
|
I want to expose APIs in python for my workload automation software. I have a Job class as defined/outlined below. Instance of this job class represents a particular Job run. Job can have multiple checkpoints and each checkpoint can have multiple commands.
Job
- JobName
- [JobCheckpoint]
- StartTime
- EndTime
- S... |
Calling out the tech: C#, Newtonsoft.Json.
We have a class which contains a property named SchemaVersion that we use to inform of the Json document version once that object is ultimately serialized in to our CosmosDb.
Currently this property is set in the object class constructor, and for simplicity assume it's "1.0"
S... |
I am arguing with co worker that a bounded context can be made of other bounded contexts.
My example is:
I am having a tour context made out of
flight bounded context
hotel bounded context
visa bounded context
and he argued that tour is a domain or subdomain, but I think we can interchangeable use domain and bounded... |
I'm diving into the concepts to Domain-Driven Design (DDD) and found some principles strange, especially regarding the isolation of domain and persistence model. Here is my basic understanding:
A service on the application layer (providing a feature set) requests domain objects from a repository it needs to carry out ... |
I'm no software engineer.
I'm a phd student in the field of geoscience.
Almost two years ago I started programming a scientific software. I never used continuous integration (CI), mainly because at first I didn't know it exists and I was the only person working on this software.
Now since the base of the software is... |
I was reading this page and came across this sentence in the accepted answer:
I don't like A directly knowing about B. But that's a DIP thing
not a POJO thing.
What if you can't abstract out B so that A isn't aware of it?
Suppose if I have the following Book class:
public final class Book {
private final Autho... |
In Git, I have a master branch (release) and a dev branch (development) for a C project.
In the master branch, I want gcc to only be passed the compiler flag -Os (optimize for speed) and not -ftest-coverage -fprofile-arcs (when compiled, a .gcno file is created, when run, a .gcda file is created and when gcov executabl... |
As the title implies , what is the difference between these both concepts? According to my understanding , Agile software process uses increments , where some requirements are first implemented and checked. The same for incremental development.
|
I'm starting a new project and there is some internal debate on the right approach to writing objects to a database.
CRUD operations require 3 parameters: DB Handle, DB Name, Collection Name.
All objects are derived from a BaseEntity object (which has the standard Id, Creation Time, Update Time, etc).
The first approa... |
Background
I'm writing C++ firmware with freertos to penplottingrobot. It's a makeblock XYplotter and the firmware is connecting to mDraw software for command instructions thru USB drivers. MDraw program sends Gcode commands. If you must know, there is a pencil which is controlled by pulsewidth modulation servo, and th... |
I am in a situation where I can use an open source JavaScript plugin to fulfill a task. But when I tried to use it,I found myself I have to redesign lot of things of what I already have done,and it adds a certain complexity, in my humble opinion, to the project. Whereas I can achieve the same task with a clean code I c... |
I have a public project that I'm the single developer. I love updating packages to new versions regularly and keep the project up to date with the updated environment. This is probably not always a good approach as discussed in this question and this question , but I do it currently, because as I said , I love upgradi... |
It's a sort of simple compression where you use one numeric variable to store many boolean / binary states, using doubling and the fact that every doubling number is 1 + the sum of all the previous ones.
I'm sure it must be an old, well-known technique, I'd like to know what it's called to refer to it properly. I've d... |
Currently I have implemented a method in to a model to take a screen shot like so E.G.
Interface
public interface ICapture {
void CaptureMethod();
}
This is the model that implements that interface
public class CaptureModel : ICapture {
void CaptureMethod(){ //implement the code to take screen shot }
}
Now I wan... |
Here's an example:
GET /posts
POST /posts
GET /posts/{post_id}
PUT /posts/{post_id}
This api is being used by SUPER_ADMIN as well as CONTENT_WRITERS. Its working great. If user is logged in as a SuperAdmin, he sees all the post, and if user is logged in as ContentWriter he sees only his post.
But, now the requirement ... |
I wanted to check commits to a branch, and I saw that there were commits that appear in 2 branches.
Why?
What does it mean?
|
I'm working on a software product that entails users opening up a case and taking actions to process the case, changing the status, creating tasks, etc. I'd like to provide a history of the actions taken to process the case in the form of chronology entries. I'm trying to avoid having my controllers get too fat and wa... |
The behavior of Java is explained in this topic.
But, is Infinity useful for something?
Float:
public class DivisionByZeroFloat{
public static void main(String[] args) {
System.out.println(1.0 / 0);
}
}
Console: Infinity
Integer
public class DivisionByZeroInteger {
public static void main(String[... |
I've been going through all the design patterns in context of game programming form this book, before starting my next big project. Apart from that I've been reading about them in more general context. The one I have trouble undertanding is the command pattern, specifically the part about using it for game AI.
The auth... |
I have a Spring based java webservice which is returning JSON response. The problem is that the JSON response takes long time because the SQL involved is querying huge chunk of data and it takes 4-5 minutes. I am wondering if it's possible to store the data in a flat file somewhere using Javascript so that next time if... |
I have an Asp.net MVC application and sometimes I want to give a descriptive error message to the user, but the condition of it is discovered at the Data Access Layer (DAL). So for example, I have a conditional search functionality based off form field input from the user. The DAL will fetch the results, and store and ... |
I have a legacy service that is running on-prem and have built a new service that runs on cloud which provides the same functionality. I have another java (spring) service which consumes the on-prem service. There are number of apis exposed by this on-prem service which is being called in multiple places within the con... |
I'm making a medium sized application to be distributed privately to several Churches. It connects to an Azure database but it does not have any server managing the information (apart from the SQL server). The application is highly dependent on the information stored in the databases as very little data is saved client... |
I need to work on android mobile push notification. I have recently gone through some of the tutorial on google. I would like to summarize
the my understanding first
Developer registers the app with play store and get some unique code called Application_Id
Once the end user downloads the application from store and log... |
I found a function in c# like this:
private Dictionary<string, Func<string>> ObtenerExtraCfgCampo(MsgDefCamp camp)
{
var extra = new Dictionary<string, Func<string>>();
extra.Add("Oddity", () => camp.Order % 2 == 0 ? "Even" : "Odd");
extra.Add("Odd", () => camp.Order % 2 == 0 ? "Odd" : str... |
I am making a shopping cart. A shopping cart will have a total amount of money you've got to pay for the products you've selected.
I'd like to approach the problem using both OOP (encapsulating it) and more anaemically or functionally (without encapsulation).
I'm using the simplest Product model:
public class Product
{... |
I get to review code that often looks like this:
class MyClass1 {
constructor MyClass(initialiseParam1: Object) {
// do something with initialiseParam1
}
initialiseStep2() {
// do some more initialisation
}
}
To use MyClass1 you need to do two steps, first to create an object and seco... |
I have an Android application (E-commerce) in English, Now I want to change language to Arabic and RTL(Right to Left)
I am new in that, where and how much efforts it take?
What specific problems should I look out for?
|
I work in a small company and we are about to delve into the Microservices world. As expected, we are hitting a few bumps.
Let us focus on a small bounded context: work order.
This bounded context is composed of a technician, a team and the actual work order. A team is composed of a group of technicians and a team mana... |
I'm trying to use RabbitMQ for two-way one-to-one communication between clients and servers. So, Client 1 should be able to communicate only with Server 1, and vice versa:
The servers stay always connected to RabbitMQ, whereas the clients are started up and shut down on demand. This is because a server should receive ... |
Functional programming strongly suggests to separate data from behaviours (functions). However, I can't see the benefit of this for an algorithm's implementation intrinsically tied with particular settings data.
For example, suppose there's a trait LagrangeAlgorithmOOP with immutable data being the algorithmic setti... |
ABOUT:
My business partner and I have been building websites for small businesses since we began our company. Out of the blue, we were approached by an HR company to provide a quote for a software project they are looking to have built. Most of our work to date has been front-end work, however, this is the kind of proj... |
How can a factory also save the object in the database?
I want to create an object that consists of other objects.
Pseudocode:
firstObject = db.get....;
secondObject = db.get....;
expectedObject = new ExpectedObject(firstObject, secondObject, userId, datetime);
This is the task for the factory pattern. But I would al... |
I have an API written in SOAP 1.2 that I am trying to give to a developer whose website is written in Javascript and said they can not request the file because they do not know PHP. From my understanding the API is already written and we just need to fill out the place holders (username,password). Since they do not k... |
I've recently learned that setTimeout is not part of Ecma 262 standard but takes part of WhatWG one.
I have one misunderstanding concerning these two standards and I can't get how they converge.
For now, setTimeout or setInterval, two ways of making Javascript asynchronous are part of the WhatWG spec.
Then and Ecma(scr... |
I recently got into discussion about how the method signature should look like for an API method which doesn't expose internal objects used by application to caller. Here is how situation looks:
Our API should expose one method say,
public int updateSummary(String summaryMessage) {
update_in_DB(summaryMessage)... |
I've made a website which is going into production soon. The website doesn't store any information about the user unless they create an account, in which case I save username, email and a password to a database, and a token in local-storage.
Do I need any sort of notification when the user navigates to the site?
|
So if I have a class called Object, a class, bench, that derives from Object, and finally a class called Park that derives from Object that has-a bench - is this bad "practice", to have two objects that technically both is-a Object but still the one uses the other? The reason I ask is because I can seem funny to have t... |
As far as I have been able to find, the first language to use ^ for exponentiation was BASIC, in 1964. Earlier languages, such as Fortran, used other symbols such as ** for exponentiation (although in Fortran's case this was likely influenced by its limited character set compared with later languages).
My question is, ... |
I see a lot of guidance in the DDD community around how to retrieve and use information from a remote bounded context (using an anticorruption layer, open host service, etc.), but hardly anything about how to handle storage of attributes that matter in the local bounded context for an entity that has its home in a remo... |
So I have .eslint and .settings (VSCode) files that I would like to be consistent across projects. How would I do this?
Currently, I am thinking that I should put them into a repository, which then I would instantiate as a submodule in new projects, which then I can symlink to.
|
Most of my redux actions are 'fetch some data from the database, here's the authentication token', and they for the most part look the same, like this:
action creator
export const fetchDashboard = jwt => async dispatch => {
dispatch(fetchDashboardRequest());
try {
const response = await axios.get(
DASHB... |
I have been working with a software strongly relying on the event sourcing and CQRS patterns for a few time and I'm trying to figure out how to properly model the domain events in relation to the needs of the read models.
Let's try to describe the question I'm asking myself in a more formal way. In an event sourcing a... |
I've the following project structure (simplified):
domain
dto
view
In domain model is kept. dto classes are used to pass data from domain to view. And in view I've a controller and a handful of *req, *res classes to pass the data via HTTP. So there are 3 classes (in model, dto and view) to express the same thing.
Th... |
In our project there are deep and lengthy if-else structures which can be significantly shortened by a simple rearrangement. To me the shorter version would be easier to understand also.
As an example, this:
if(a) {
if(b) {
doSomething1;
}
else {
doSomething2;
}
}
else {
if(b) {
... |
I've been out of C++ for years, last time I used it was back in gamedesign before C++11. I see all these new pointer types which seem great. But I'm unsure when and how to use them. In the old days I would create a buffer like this:
uint bufferSize = 1024;
unsigned char *buffer = (unsigned char*)malloc(bufferSize, si... |
I am the senior developer at a company I work for and we have rapidly added many other developers and contractors. Our company is growing and that is great! Recently however, I have been tasked with code review (which is fine) but also with giving my opinion on how long certain projects most likely took for a particu... |
If class is declared like this
class Foo : IFoo
From IFoo point of view, Foo is called implementation.
If class is declared like this
class Foo : Bar
Then Foo derives from Bar.
How do you call a Foo from Bar class point of view?
Inheritor?
Derivative?
|
We are floating around with the idea of breaking our monolithic application into microservices. The problem we are facing is there are parts of the application the business is not willing to accept the idea of eventual consistency. Our thought is to have a shared database, but each microservice would get its own schema... |
I am building a CQRS-based application with Kafka Streams. For most entities in my application this entails event sourcing: capturing state mutations as events and transforming them into state which can be queried. The events are stored forever so they can be re-processed into state.
However, one of my entities is freq... |
We've built a custom CRM for one of our clients.
Stack: asp.net MVC, SQL Server, Azure
Some of the logic / features were hardcoded specifically for this one client.
Now, more clients want to use our software but hosted separately because each client has their vision of the product and features that they want to impleme... |
I have a system that is generating internal events for objects. I am extending their debugger to display a human-readable version of the events sent to the debugger.
For instance, the system will generate "OnClick" for the "Blue Button" control, on a "a-guid-value-for-the-view" view. If the readable version of "a-guid-... |
Modulizing software from my empirical experience seems to decrease performance, most of the overhead can be communication of modules, redundancy in computation, storage and depending on the application can be at a less or greater extend or can be optimized by a compiler.
So I have been thinking of the benefits of e.g. ... |
The equivalent of
static {
// Code here
}
does not exist in Python by default. The closest thing, while being "Pythonic", seems to be to create a decorator and do the initialization there such as:
def static_initialization_decorator_for_myclass(cls):
cls.initialize_static_stuff()
return cls
@static_initia... |
I'm modeling a database, where I have a table called "appointments" (citas in spanish, but I would translate the tables's names for better understanding) where the user can create an appointment to visit a medic (taking values from the medic's table) or to visit an establishment (taking values from "establecimeintos" t... |
We current have a very simple Multi Tenant monolith, with a SQL SERVER backend (Self hosted on EC2 on AWS), and multiple application services talking to one DB behind an Classic AWS ELB. Our database has grown to a point now that we are considering splitting it by tenants per region, due to growth in different regions... |
I am designing a database system + application that deals with pipe objects who are part of a larger grid network. There are about 1000-5000 pipes for each network. Let's assume each pipe can have 2 states (clean, dirty).
The application is able to change the pipe status after a maintenance job has been done at that pi... |
Are there significant differences between, say, JDK 7 and JDK 11 (which latter I believe is the newest version of the JDK), where significance is defined by a change which might make someone who has learned an older version have Java lack knowledge or be only familiar with the old implementation of a feature? (Context:... |
Is correct to represent setting options using use cases?
For example the user can:
- enable background updates
- change map color
- change interval updates
From https://www.uml-diagrams.org/use-case.html
A use case is a kind of behaviored classifier that specifies a
[complete] unit of [useful] functionality perfor... |
Say I have the following ER diagram:
To implement the above ER diagram as a normalized database, I would create a School table, and a Student table, and a School_has_Student table (that only contains the school_id column and the student_id column):
But let's say that I want to denormalize my database, this means that... |
In his book 'Clean Architecture', Uncle Bob says that the Presenter should put the data that it receives into something he calls the 'View Model'.
Is this the same thing as the 'ViewModel' from the Model-View-ViewModel (MVVM) design pattern or is it a simple Data Transfer Object (DTO)?
If it is not a simple DTO, how d... |
I'm quite newcomer to the programming. I've currently faced issue described in the title. When there's already app running on default port 8080, after my app installation ends I have to change this port in the app configuration file manually so I can access it. The whole app doesn't contain any GUI installer, and ther... |
In the following database, School_has_Student is a denormalized table :
Now if I decided to change the "paul" student name to "john" in the Student table, then the "paul" student name that exist twice in the School_has_Student table must be automatically changed to "john" to maintain data integrity.
Likewise, if the "... |
This is a concept related question.
I'm writing a program polling for alerts on various devices, there are two different type of alerts i need to poll, reds and oranges.
My approach is to create two threads, each polling their type of alerts independently.
I thought about using threads because both polling functions ha... |
I'm having a discussion in my company on how to structure a student enrollment application we are doing.
We have an SOAP-Service for sending Emails. This Service is in charge of sending, and logging emails send from our different applications.(lets call it EmailService)
Then we have a SOAP- service that handles all nee... |
Assuming the following scenario:
A web application that receives inputs from the user and process the inputs through an algorithm which takes between 5 to 25 minutes (depending on the inputs) and provide a differed result. By the differed results I mean, the user won't wait for the result behind the UI and he will be ... |
I am learning ASP.NET MVC & Web API and trying to implement Onion Architecture with Repository Pattern for one of my Test projects as part of my learning.
I have developed single MVC Projects before, but not using layered and onion.
My idea is to give data to different clients (Web- MVC 5, Xamarin - Android)
using a si... |
Let's say an Entity is composed of multiple ValueObjects. For instance, a wanderer might leave a few footprints behind.
Imagine I load Wanderer from a repository and delete all footsteps north of the Canadian border. Since Footstep is a value object without identity (ID), how would the repository know which ones need ... |
I am modelling UserAggregate using DDD concepts. I know that two separate users should be independent, but when creating a new user, I need to validate, that there is no other user with the same username. How do I approach such a situation?
One potential solution to this is for UserAggregate to depend on IUserRepositor... |
I have a couple of functions, each function verifies a set of rules and updates a common object. The common object is just a container that holds a list of rules that passed or failed. I would like to implement this as async. Is there any downside to this approach?
Are there any recommendations? The sample code I inte... |
I'm often tasked with relatively complex flows that my employers will want to experiment with in regards to the amount of steps and their order. I'm a contractor and when my work is handed over to another developer, I'd like to ship something that is easy to understand quickly - and a flow with 10+ steps is quite the m... |
Context:
I am currently working on a small project in Python. I commonly structure my classes with some public methods that are documented but mainly deal with the high level concepts (what a user of the class should know and use), and a bunch of hidden (starting with underscore) methods which are in charge of the comp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.