instruction stringlengths 34 36.1k |
|---|
I'm tasked with the redevelopment of an existing application and ran into the following problem.
The application includes batch processing, e.g. scheduled processes that run on data without user input. Now I have to write the requirements for said processes in an Excel table. As these processes are quite long the requ... |
I am writing a method in C# (SharePoint Services) which is supposed to return a SharePoint list name based on three conditions (Client, Country, and Location). There are multiple clients, countries and location, and the number is going to increase in the future.
Th method I wrote uses a series of "if" statements, nest... |
I come from a desktop (Winforms/WPF) background were I was the sole developer in the company, and have recently changed jobs to become a part of a team doing web development. I am very much in learning mode as I've only been here a month. We use C#, Entity Framework, ASP MVC, Razor Views.
I've noticed that the code i... |
I currently have a file processing task that runs on an on-prem VM, it's a .NET executable that also calls other services such as ffmpeg (for videos). As is, the task runs fine, but it's really only possible to process one file at a time due to computational resources.
I'm looking to change the architecture in such a w... |
I'm designing a C API which will have about a dozen getter functions for various values. Something like:
bool getSomeBool();
bool getSomeOtherBool();
...
int getSomeNumber();
int getSomeOtherNumber();
...
This seems to me like a straightforward way to do it, easy to implement, easy to document, hard to use incorrectly... |
As an exercise, I am trying to design a simple calendar booking system for multiple meeting rooms. I kind of got my head around some requirements such as find available rooms for a given time range, room booking look up. However, I seem to stuck a bit on a booking scenario, say in a particular racing situation, 2 users... |
I have two synchronous web APIs that perform the same work but one needs to be prioritized over the other (the former is called from a client, whereas the latter is a caching optimization for before a client calls)
Constraints:
Both APIs have access to the same resources (such as VMs and storage) and I can't add more ... |
If a change compiled/built but the semantics were different would it be considered a major change?
For example, suppose a time string returned was the same format but now was CET rather than, say, IST and that interpreting it as IST now produced erroneous results would it be classified as MAJOR?
Note that I assume th... |
Imagine you have a system where a program is running and somehow an abnormality occurs. (it can be a crash, or an abnormal screen or any other thing)
Imagine reproducing the problem is next to impossible but you have some logs files that record what has happened till that point.
Usually you debug by reproducing the pr... |
My app uses Cosmos DB to store data. I have a requirement to support full-text search, which Cosmos does not provide out of the box. One of the recommendations was to use Elasticsearch, and I have been trying that out. The more I try it out, the more I feel like I am duplicating data. I literally push the same document... |
I am working in an iOS project which have two schemes enabled from configurations,
Release
Debug
As you know Debug scheme is used for developers while developing features and testing etc. However, Release scheme is used for generating official final artefact to upload in App Store. Currently my application quality is... |
I have recently started diving deeper into Angular 7 (with Ionic 3) and I have written a lot of code so far, and I have child & parent component relationships - but never like this before. I am trying to write "good" Angular code.
The problem I am now facing is, the Providers...
My Child Component needs access to the S... |
I have an array of ranges with start and end timestamps. I want to display those ranges on a graph.
Right now, my naive algorithm gets an array of ranges sorted by their start timestamp and
iterate over each range in the sorted array
find the first bucket where the last range of the bucket has an end timestamp lower... |
There's a debate going on in our team at the moment as to whether modifying code design to allow unit testing is a code smell, or to what extent it can be done without being a code smell. This has come about because we're only just starting to put practices in place that are present in just about every other software d... |
I stumbled upon a question in Codereview, and in one answer the feedback was to avoid std::endl because it flushes the stream. The full quote is:
I'd advise avoiding std::endl in general. Along with writing a new-line to the stream, it flushes the stream. You want the new-line, but almost never want to flush the strea... |
I am getting into SonarQube and everything looks quite and simple so far, but I am not sure what is the final purpose of CCQ overall.
Yes it gives you a lot of tips about whats going on inside your code, and no - it seems to not be perfect everytime.
Are CCQ tools expected to deny a branch merge if there is on example ... |
I'm designing a solution in which users perform tasks based on task queue. The point is to create system, where user goes on specific URL and server serves him listing with for example: items to asses and put into specific predefined category - like StackExchange's queues (First Posts, Late Answers and Triage).
What I'... |
I'm aware of the general distinction between data and content, namely context, but here I have a case that is clearly causing a lot of confusion and debate within the company I work for.
There is a front-end team which manage an application which calls our data API. The confusion is that they want the content structure... |
I've recently started my first job as a software developer at a small startup company.
I do not have a degree in a software engineering related field, although, I have very recently completed an A-Level in Computer Science.
There are 2 developers (myself and one other) and the other developer has worked here for some t... |
I was thinking why are there (in all programming languages I have learned, such as C++, Java, Python) standard libraries like stdlib, instead of having similar "functions" being a primitive of the language itself.
|
Assume we have two files
a.cc
#include <iostream>
int timesTwo(int in);
int main(){
std::cout << timesTwo(5) << std::endl;
return 0;
}
b.cc
int timesTwo(int in){
return in*2;
}
is it better to use the linker and include b.cc in a.cc by #include "b.cc" or is it better to leave it as is and compile them like g++ a... |
Quoting the definition of interface injection from Wikipedia :
The advantage of interface injection is that dependencies can be completely ignorant of their clients yet can still receive a reference to a new client and, using it, send a reference-to-self back to the client. In this way, the dependencies become inject... |
My team and I had a discussion about our future architecture, since we've always just written the code that was needed in each separate project, which have now led to extremely redundant code across multiple systems. Therefore, we wish to create a local NuGet feed to share functionality across our new systems.
Some of ... |
In my code I have 2 separate login types. I have a factory that decides which one to create based on an enum.
Each login type has a different type of credential.
Currently my factory method takes just 1 type of credential.
How can I generalise my method to accept both an enum for login type with different credential ty... |
Let's say we have a code base covered with big enough amount of unit tests. We make small change to the code and want to check if tests are still passing. Wouldn't it be great to be able to rerun just tests affected by the change? It seems like every bit of data required to build the list of affected tests is in place:... |
We have a REST API that returns user generated content from a database. Before inserting the data into the database the data is sanitized.
But when returning the data we do not escape / decode the data, so in theory it would be possible to insert some user content that will execute an attack, once it is consumed from t... |
I regularily come across code that stores some custom properties in JS Objects from external libraries, for example:
/**@param OpenLayers.Feature feature */
function doSomething(feature) {
feature.customProperty = "anything";
}
I disapprove of that, but I am not sure about the ideal solution to bypass this short... |
I have trouble understanding if I should pass an argument to a method as a primitive value or as an already-obtained object.
Consider this simple example
interface Channel{
String getId();
String getName();
}
interface ChannelRepository{
Channel findBy( String id);
}
public class DummyChannelRepository ... |
We have a 3-tier architecture: Web, Business, Models using the MVC pattern. Models are Code-First using EF6. Currently we access the dbContext directly in our Controllers to query and save changes. We define all the relationship constraints on the Models. However, we have many additional constraints on the models that ... |
Is it a good practice at all?
E.g. we have an API layer which has to call some service when it receives a request, and the work which that service has to do must not be done concurrently. If there would be no API layer one would just use a queue and dispatch tasks there and the service would consume and process those o... |
In my organisation for one of the project we follow Agile Scrum methodology and following is distribution of the man power for the project:
Scrum Team:
SM
ProxyDev1(Internal): 50% in the project
ProxyDev2(Internal): 50% in the project
Dev3(Internal): 100% in the project
Dev4(Internal): 100% in the project
Dev5(Externa... |
Developing Big Data processing pipelines and storage, you probably come across software which is more or less a part of the Hadoop ecosystem. Be it Hadoop itself, Spark/Flink, HBase, Kafka, Accumulo, etc.
Now all of these have been very well implemented, offering fast and high-quality solutions to the developers needs.... |
I was reading on SO and SESE about exceptions and control flow, but I can't seem to determine or figure out if using exceptions to validate parameters is a violation of that guideline.
Suppose I had a method that wrote a message, obviously, I don't want the recipient of the message to be blank. For this example, recipi... |
I'm really looking for one good example how to PUT operations should be implemented correctly.
What I understood until now:
The operation must be idempotent
When the resource doesn't exists it will be created new one, API returns status code 201 - Created
When the resource exists and has changed, resource will be upda... |
I need to design a system that will take jobs (basically calling some web api) and run them at a future time (15 - 45 minutes depending on the job).
The first idea I had was to store the job and the timestamp of when it needs to run in some db and then have workers running each minute looking for jobs to run (select wh... |
I'm quite new in the DDD-World and I'm just trying to figure out all the basics so please bear with me!
I have the following Entities:
- Datamodel
- Object Types
- Object Fields
A datamodel can contain 1..* object types and each object type has a unique name and can contain 1..* object fields.
A field has a certain ... |
I have a site where user logs in. I need to calculate the log-in activity score based on the age when he logged in. For example :-
If user logins today he will have high score than the user who logged in yesterday or sometime in past.
Similarly user who logged in this week will have high score than the user who logg... |
I'll take out the ellipsis to make this easier/quicker to read:
Large group project in school, stakeholders gave a fuzzy explanation as to what they want. I suggested that we:
sketch the GUIs so we all understand what is requested, find problems, ask eachother questions, to clarify in general so we all think of the s... |
I've worked with a lot of off-the-shelf systems and generally speaking they all, at a database level and above, have metadata such as CreatedBy/On, ModifiedBy/On etc against records/entities to give at least some visibility to who did what and when.
Obviously though these fields are fairly shallow, you'll never know wh... |
Scenario
I'm a new developer, using MSTest and I've encountered the following issue:
SomeClassTest // Uses a Fake Widget Controller.
Test Initialize
{
Many lines of code to initialize Fake Widget Controller
}
Test Method
{
Uses fake widget controller
}
AnotherClassTest // Uses same Fake Widget Controller.
... |
I was reading here about OOP and methods, and the accepted answer states that method names should be verbs. However, that doesn't really answer my question.
Suppose if I had a Character class with a private List inventory.
public class Character {
private List<GameItems> inventory;
// constructor and other... |
I have 3 software components of a Web Application:
1. JS-client application 1 (JSApp1)
2. Java Spring (REST and Websockets) server app (SRV)
3. JS-client application 2 (JSApp2)
My current task is to send some data from JSApp1, save them in the SRV DB and respond to JSApp1 telling whether the operation was successful or... |
Would you consider
WHERE SomeDate <= '2018-01-01 23:59:59'
instead of
WHERE SomeDate < '2018-01-02'
When the intention is that SomeDate goes no further then 2018-01-01
a code smell and if yes then why
|
I am wondering about the Gherkin syntax for some scenarios. Suppose I have following events A, B{1}, B{2}, C, D1, D2, G.
Where uppercase{number} events like B1, D2 are parallel events(simultaneous).
Where uppercase events like A, G are normal events. The symbol || means OR but && means AND.
Now how I could write Unit... |
I am looking into improving my overall application architecture and (I think) I understand the issues my Anemic Models are causing.
Here is my current architecture:
Controller with injected Service and Controller Action accepting a DTO
Service with injected repository. Service function takes DTO, calls repository, do... |
I need some guidance in designing an API wrapper for my backend APIs. I have tried to keep it as specific as possible.
Context: We have a project which supports certain file operations like edit, create, merge etc.
All the services are exposed as rest APIs. Now I have to create an API wrapper over this (client library)... |
We have an already running MQTT setup for communication between smart home devices and remote server, for remotely controlling the devices. Now we want to integrate our devices with Google Home and Alexa. These two use HTTP for communication with third party device clouds.
I have implemented this for Google Home and af... |
I'm refactoring the framework of our company, trying to fix the issues we had in the past.
We're a team of 6 developers, and we have various needs and issues in regards to tidying up our framework.
Right now, we want it to be the solution we import in all our projects, because it has all the code we reuse every time. T... |
which approach should be taken when adding entities to an aggregate?
I could add an constructed entity to the aggregate
$book = new Book($title, $releaseDate, ...);
$library->addBook($book)
or I could pass the parameters to the addBook method and let the method to construct the instance:
$library->addBook($title, $rel... |
I am trying to understand the difference between an event log and event store in the context of event sourcing.
A really nice explanation I found is that an event store is the single source of truth for the write model and an event log is the single source of truth for the read model.
Therefore say I wanted to use CQRS... |
It's been a long time since I was first introduced to Event Storming in a DDD workshop. More recently we decided to apply it in practice and we have planned our first sessions with a facilitator (someone from the company who has experience).
The only thing i'm wondering now is how the process AFTER event storming take... |
I am building a CLI tool which will potentially support many commands. Ideally, I want to abstract out each command to implement an interface that demands a "run" method. From there on, it would be a simple regex match that delegates to the appropriate command class.
The issue is, not all of these commands are stateles... |
motivation and context
I am designing and implementing the web interface of my bismon server program (a research prototype; in a few words: an orthogonally persistent, reflexive, homoiconic, dynamically-typed, multi-threaded, domain-specific language for static source code analysis; it runs on Linux only). It is free s... |
Suppose the client wants to build an online shopping system. If we think of use case scenario, a database or a bank would be a secondary actors to this system.
Is it valid to have a user story like
As a customer I want to be able to access the database so that I can view catalog items
Or
As a customer, I want to a... |
Suppose I have a use case, like this example.
Normal Flow:
The user will indicate that she wants to order the items that have already
been selected.
The system will present the billing and shipping information that the user
previously stored.
The user will confirm that the existing billing and shipping information
... |
I have a website with basic crud operations that involve data and photos.
I also need to extract the metadata for the photos that are being uploaded.
My original implementation did not have var puts = new List<Action>(); so the following code
puts.Add(async () => await _s3Client.PutObjectAsync(BucketName, key, file.Op... |
I recently came across a demand to create a web system (which will be done in PHP, but is for any language), to have the same functionalities of a mobile application already ready. This app has a complete and well written API in NodeJS.
With this situation, I had a question about the possibility of using the API in th... |
I'm looking for some sort of standardisation, in a similar vein as POSIX for compatibility and familiarity between different commandline-interfaces, but for error reporting. Notably, I'm looking for:
formatting rules
standardisation of logging practices
rules for error code choice
good habits on how much, and what to ... |
Consider a "large-ish" data set (~2-5M rows) that goes through multiple stages of cleaning/processing:
library(dplyr)
largedat %>%
mutate(
# overwrite v1 based on others
v1 = somefunc(v1,v2,v3,v4),
errv2 = anotherfunc(v2,v5)
) %>%
group_by(v5) %>%
mutate(
v6 = otherfunc(v7,v8,v9),
errv7 ... |
I'm working on a library that lets me write operation on an input "stream" of data (I don't call them that, but it's a potentially unbounded input regardless, think data coming from a socket).
I might have one operation that eg: applies a frequency shift to the incoming data, and then another that applies a frequency-s... |
I have created the above picture to illustrate my question.
Is there a section within memory (lets say from address 0x1 to 0x15) that all processes use to place their text segment in (left figure), or each process gets a random location in memory to use for it's combination of heap, stack , text and data(right figure)... |
Assume a Parent -> Child relationship in RDBMS.
questionnaire table and question table.
question table has a foreign key questionnaire_id to store which questionnaire it belongs to.
Questionaire can have n number of Questions, say max 500.
When a user creates/updates a questionnaire API call sends the big json docum... |
I am writing a test in pytest for a software. This test relies a lot on console output generated by the software.
The flow is something like:
* start the program
* send some commands to the program
* wait for some output from the program
* send some other commands, wait for further output
I also need to write the ent... |
A software company develops software packages for commercial animal
farming. A special function in C calculates the daily amount of feed
for different kind of animals dependent on their bodyweight. This
function already run flawlessly for years in a software package for
farms. And now it's integrated into a pa... |
I am working on a multi contributor project, having ~2500 Commits. It has multiple components, i.e. Frontend, Backend and Data Processor/DB Ingestion.
Now that we are expecting more contributors, a Versioning System should be implemented, and should be displayed on footer of Frontend, as vA.B.C, where A = Big Change, B... |
Here's a class with a method that calls different functions based on a parameter set in the constructor:
functions = {
"arg1": f1,
"arg2": f2,
"arg3": f3
}
class C:
def __init__(self, arg):
self.arg = arg
def _util_method(self, v):
return functions[self.arg](v)
def method1(self... |
Why should someone use a stream processing engine like Apache Spark, Flink, Hadoop instead of just a normal backend worker which works on something and returns the results as soon as it's done?
Credit card fraud checking example is given when we talk about these solution so what is the problem by just write a program a... |
I guess the goal of separating UI and business logic goes way back. I found a Martin Fowler article, from nearly 20 years ago, which is pretty clear about the benefits of the separation: https://www.martinfowler.com/ieeeSoftware/separation.pdf
I'm undertaking a development where I believe the domain layer I develop wil... |
Onion architecture has a core which is composed by domain model, domain services and application services:
I'm in doubt about those two service layers, domain services and application services.
I've been reading that they're related to DDD but I'm not familiar with DDD myself.
I'm not asking for the relationship, just... |
In Javascript, there seems to be or have been an idea that undefined represents a missing primitive OR object value, while null represents just a missing object value.
See, for example, this section in Speaking JS.
The use of null in JSON, however, does not seem to obey this principle. If the value of my key is missing... |
I was doing some reading here and one of the suggested answers states:
In short: Don't try to decide how an object might react to some action
from the outside, tell it what happened, and let it deal with it.
This other answer suggests:
But in general, I recommend trying to achieve orthogonality, your code
stays... |
So I was discussing coding with an associate of mine at work, and was mentioning how I was working on a project where I'd need to transform the data that was provided into a standardized format before processing it (applying business rules, validation, etc). He suggested that the standardization of data should be a com... |
I've heard the phrase being thrown arround and to me the arguments sound completely insane (sorry if I'm strawmaning here, Its not my intention), generally it goes something along the lines of:
You don't want to create an abstraction before you know what the general case is, otherwise (1) you might be putting things i... |
I'd like to highlight that this questions is about a System Sequence Diagram (SSD) and not a simple Sequence Diagram and of course any help would be appreciated!
I'm reading Graig Larman's book Applying UML and Patterns and I was wondering if it's possible to represent an if statement in a SSD to exit the system. For ... |
I need to create requirements model for my software(first step of software engineering), But I don't know which icon of UML can help me to implement requirements model.
|
Currently we are integrating with a 3rd party system. This includes data sent to this 3rd party where the customer is able to see it. My current task is to provide visual documentation (PDF) about which values from our tool land where in the target system.
What I am struggling with is the fact that screenshots of both ... |
Some years ago I wrote and released some software under the MIT license.
Recently I noticed that one (or some?) of the forks have altered the leading copyright notice at the top of the license, i.e.
Copyright (c) 2014 <my name>
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy o... |
In our domain we have a concept of billable activities that get logged by a user. The modeling is pretty straightforward -- the User is an aggregate root, with the Activities being a collection under the user (an activity doesn't make any sense outside a user, and we have rules to enforce at that level).
We're in the p... |
I have 1 long running process wrapped inside a method and it is for 2 different types like below:
Type1
Type2
Code:
public interface IBaseType
{
MyResult LongRunningProcess(int jobId,int noOfTimes); //doenst save long running process data in database.just returns the results to consumer
void Lon... |
I have a method that creates a data file after talking to a digital board:
CreateDataFile(IFileAccess boardFileAccess, IMeasurer boardMeasurer)
Here boardFileAccess and boardMeasurer are the same instance of a Board object that implements both IFileAccess and IMeasurer. IMeasurer is used in this case for a single meth... |
Tag dispatching
is used to:
dispatch based on properties of a type
Is there any reason to make tag values constexpr or even
const?
There are code samples demonstrated both constexpr and
non-const tag values. For example,
the selector tag value in wiki
is not declared a constexpr. OTOH, in the c++
standard,
section ... |
class DataFrameAnnotation:
def __init__(self, df: pd.DataFrame):
self.df = df
def transformation_1(self):
self.df + 1
def transformation_2(self):
self.df + 1
def main(self):
self.transformation_1()
self.transformation_2()
....
return self.df
My question is if there are any iss... |
I understand that there are major technical differences between how a strongly typed language is compiled and how a type annotated language is compiled/transpiled.
But as a developer writing in a strongly typed language and a weakly typed language with type annotations feels pretty similar to me. I can't really articul... |
I'm struggling with logic that is duplicated in the front end code and the database. Right now, I just put a comment.
Here is a small example (the current system has a lot of much more complicated formulas).
In the front end, I have a single property that everything use to see the result.
Class CartItem
' The same... |
I am learning for an exam and I have a question which I am struggling to give and answer for.
Why does no iterator base class exist all other iterators inherit from?
My guess my teacher is referring to the hierarchical structure from the cpp reference "http://prntscr.com/mgj542" and we have to provide a other reason t... |
I have a method login() which essentially sends a login request to a remote server. As I do not want to waste server resources on processing invalid data, I decided to consider sanity checking the input before I send it.
The code looks something this:
//Method to log user in
public void login(String username, String pa... |
From what I have learned, in Perspective based reading, the document/code/etc., is inspected from different perspectives. We consider roles like software designer, tester or user.
Each role follows the scenario assigned to them, and reads the code/document, etc. Each role also creates an artifact; for example the pers... |
Background: I'm working on a project with a self-driving machine with a tank-like control, somehting like:
forward()
left()
right()
stop()
The code is running on a raspberry pi. The GPIO outputs are inside my class Machine. Currently the development process is very simple, we're programming, put on raspberry, test it... |
No code to show (and not really a code issue) but I have an iot-ish application running that is using PI Zeroes as clients and they are slow. A single POST takes about 10 seconds round trip, the delay seems to be almost entirely within the client side Python script, possibly related to slow connections but I would like... |
What are the best practices to organize your unit tests in classes?
I see different possibilities:
1) One would be to write one "container" class for each function you want test and then subclass that to group in each subclass all tests that are similar in some way - e.g. one subclass contains all tests where... |
We have a requirement for a security audit that our password policy must disallow the re-use of a previous password from the last 4 used passwords.
We can accomplish this fairly easily by making a call to the server to allow it to compare the password candidate against the database's previous password hashes, but that ... |
In computer science courses at University, assignments written in OO languages such as Java had file systems similar to this:
TreeNode.java
BinaryTree.java
Assignment1.java
etc. ...
In writing some of my own projects, it seems like splitting up each class into a file is very trivial, especially when classes are very ... |
I am trying to design a geometric intersection API. Below is the code to represent geometric elements.
#include <iostream>
#include <memory>
// Since I did not write the Shape class I cannot edit or change the geometric elements class.
class Shape {
//
public:
virtual ~Shape() {}
};
class Segment : public Shap... |
Various analytics tools will track the number of handled and unhandled exceptions (crashes) that happen in an app. This obviously helps us find problems we didn't know existed and will fix it.
Quite often, exceptions happen in try-catch blocks and are handled, but in many cases they still are situations that should not... |
I have an app that uses JWT tokens for user authorization. Now, I need to be capable of deactivating users (users won't be allowed to use the system but still exist in the database), but as a requirement for that, I need to know if the user is not logged in. Is there some kind of best practice for handling this kind of... |
Question: Given that two services operate on a common complex object, what are possible design patterns and supporting technologies of exchanging the object and (possibly) sharing the implementation?
How about aspects like
deployment (independent release cycles on the two services)
testing (using different implementat... |
I have been programming my classes in the following mode. I create a public function that has a call to a private function that has all the logic and functionality. Something like:
public class MyClass
{
public string DoStuff()
{
return ActuallyDoStuff();
}
private string ActuallyDoStuff()
... |
In a hypothetical system that handles adding users, there are several business rules. Some of the rules can easily be checked in the model. For example a user registration can only be saved if they entered a 10 digit phone number.
But what if we want this phone number to be unique?
In most databases it's fairly easy ... |
I am required to analyze and make an architecture of an application. While analyzing the requirements I find, in my system user personally identifiable information (PII) confidentiality is a very sensitive quality requirement and it must be taken to the NFR (non functional requirement) section. NFR requires that all th... |
Backstory (You can skip)
I am building an API for managing Files and Directories in a consistent manner across a project. This is for deduplication and consistency when performing a task, and in this particular case, I want to ensure that a file is closed and the mutex is unlocked. Now this is a straight-forward task t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.