instruction stringlengths 34 36.1k |
|---|
I want to write some invoicing logic, and I start coding it, using TDD.
The following example is silly, but I'm confident it represents well the everyday dilemma I'm facing
function createTestInvoice(client) {
return Invoice.new(
{
client: client, rows: [
{item: 'apple', quantity: 1, unit_price_ 1}
... |
I am working in an GUI application that would work as follows:
It will retrieve and save data from any of the following sources:
A "Cloud Library": This library would get and save data to a cloud.
JSON file: Some initial data are gotten from a large JSON file.
Text file: Data retrieved from "cloud library" can be save... |
While going through learning hadoop and spark, I came across "distributed data processing" and "distributed computing".
Could you let me know if they both are same or referring to different concepts?
|
So bascially we have a library that contains a series of bifunctions passed in the metadata and datum looking like:
Transform1:
package transformation1;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.function.BiFunction;
public class Transform1 ... |
I'm working with Web (react) and Mobile (IOS, Android) teams. And I find that even with a microservices architecture we end up always doing duplicated work at the front end/client level. How to implement a microfrontends architecture that reduces duplication of frontend work but still provides a high quality experience... |
Starting to explore using DI more in my project design and I find myself asking the same question:
"If I pass this object to that constructor, does that new object now have a dependency?"
For example, if I had the following:
class App:
ROOT_DIR = Path('some_dir')
SOME_CFG = Path(ROOT_DIR, 'some_cfg.cfg')
... |
I'm reading the "Guide to software engineering body of knowledge" but I am very confused.
Does a typical process consist of: implementation and change, definition, assessment, process and product measurement?
Or does it consist of Software requirements, design, construction, testing and maintenance? I thought this was... |
I am doing a report for Uni on an application developed by the team I am in. We have to deliver-among other things- a Technical Solution Document along with the application. One of the sections of this document is called "Product Architecture and Software Stack".
I have googled the phrase "product architecture" but w... |
I have a bounded context Profiles that manages n profiles in a graph-like fashion. Based on profiles' information it calculates a score for each edge in the graph (i.e. for each pair of profiles), making it n*n scores. When a profile p is updated (event ProfileUpdate) it re-calculates the scores of p with all other pro... |
Let's say I have a astonishingly big table (300 columns) with lot's of records (in the millions).
This table is overly complicated to use. I'd like to refactor this table and split it in multiple more meaningful tables.
I have only surface knowledge of database: I'm more a user than an database developer. What are the ... |
I've learned the UML recently and I am trying to build a MonsterDuel system. However, there are a lot of classes in this project, and I am confused about the abstract class and its usage. Now, I have created:
Abstract class Players, and its inherited class Player.
Abstract class Field, and its subclasses: Monster, Spe... |
I'm very new to DDD and sometimes confused by it because many people inside the DDD community tend to
have very different approaches when it comes to implementation. I tried to summarize all what I've read
so far in a diagram representing control flow of an ASP.NET request. I think I got at least the basics right but t... |
This question maybe borderline with the workplace. Also I apologize if it sounds more like a rant than anything.
We have a legacy code base (million of line of code). No evolution is ever possible, there is always an excuse.
Other teams depend of our interface so we don't change them to avoid breaking anything
Any cha... |
I'm trying to design a new microservice architecture that will eventually replace our current two monolithic APIs (we develop a desktop payroll software that uses our API to send payroll documents to employees or have them sign contracts, and more features and front-ends to come).
There is a lot of complexity regarding... |
I have seen around the Internet several rest web services with the following behaviour. In case there are any errors, they return a Error object, otherwise they return, say, MyClass.
See the following example...
/*
* Data transfer objects
*/
@Data
public class Error {
private Integer id;
private String descripti... |
Say I am creating an app which contains selectable components and a toolbar/action bar. Some tools work on selected components only, some work on all components together. Pretty standard stuff.
I can think of 3 approaches to go about the architecture of the relations between the toolbar and the components:
Toolbar is ... |
Is it true that we never enable foreign key constraints in the dimensional model of a data warehouse? If yes, then what is the rationale behind that?
As per my research:
Some experts told me in a dimensional model, FK will never be enabled, and it is the responsibility of the ETL process to ensure consistency and integ... |
I am currently developing an application with Qt/C++ which needs to access a Shopify store using the Admin API. In order to access the API, my application needs to know the following information:
API Token
Shared Secret
API Password
These values are stored as strings in a header using a simple #define, for example:
#... |
Hi I need to develop a new web application for my company and I must use DDD as per my senior-dev requirement.
In addition I'm maintaining (adding new features and fixing bugs) a large brownfield web app (FinTech app) that was developed by senior developers 5 years ago before I got in this company, as I only spent 1 ye... |
]1
I am new to MVC. Most of my career I have used Web Forms in Asp.net. Reading about MVC has been really confusing because from what I have learnt is that in Traditional MVC, models were supposed to be the business logic as well as house domain models/objects. But when it comes to Microsoft's MVC, model means View Mod... |
A coworker has started advocating for a style for our user-facing APIs where every function takes a single struct parameter containing all the real parameters. That is, instead of:
void fn(int foo, bool bar);
we should do:
typedef struct {
int foo;
bool bar;
} fn_args_t;
void fn(fn_args_t args);
I've never e... |
In a large iOS application, I have a database module which is dedicated to handle application databases with read/write public APIs for other module. UI module has a feature to share the database, in which a copy of the database can be sent to another person. Now to attach my database for share feature UI module requir... |
In Java, C, and C++ we have the following jump statements: break, continue, goto, and return. In C#, there is also throw.
I'm not really familiar with either of these languages. This is simply what I have read on the web.
All these jump statements are unconditional. I tried to find mention about conditional jump statem... |
I’m a Solution Architect trying to understand and use the TOGAF artefacts that could benefit us.
Now I’m stuck on Application/Data Matrix and none of my Googling ninja skills have helped: I want to visualize how each data element (with classification) is used by each application in a way that you get a good overview.
... |
I have a Message class that represent some data sent by a smartwatch. A Message has a header (sender, length...) and a type; it can be a location update, an alarm message... There are about thirty different types of messages.
Based on the type, the message should have a specific payload attached to it. For example, a m... |
Something that has really be getting under my skin recently is that Salesforce uses the term "Declarative Development" to mean "Low Code" or "visual code".
For example, this article explains the difference between imperative and declarative programming, while making claims that their "low code" solution is declarative ... |
When using routing in a SPA web app (angular, react, etc), the user doesn't have to start at the entry point of the application. They can use a URL in the browser to drill down into any part of the application.
When implementing HATEOAS in a RESTful backend API, we assume that the front-end only knows the URL to the en... |
I'm working with a system that is very similar to a BI dashboard. Basically let's say the dashboard will show a couple of company's business metrics, for example, revenue, refunds, number of orders, average order value, etc.
On the front end, it will show one year's data, right now daily value will be shown on a line g... |
I'm trying to get a review for my lists of pros/cons about how to structure commits that came out of a discussion at my work.
Here's the scenario:
I have to add feature X to a legacy code base
The current code base has something I can't mock making unit testing feature X impossible
I can refactor to make unit testing ... |
What are the design defects that can be spotted by using a class diagram, and how?
I am not concerned about syntactical/ representational defects, but in things like the following:
Do the classes/objects have data elements or getter/setters and no actual business methods. If yes, immediate red flag, design is probabl... |
Scenario:-
The load balancer distributes traffic to backends with a simple round-robin mechanism.
With default config, each backend is assigned weight "1" so all backends are given equal chance of receiving requests.
If some backend is given weight 2, then that backend is given twice the number of connections.
Henc... |
I have three resource types - character, word, and write (these are three separate database tables, with word and write having a foreign key dependency on character).
When character is created (upon a user save process), word and write also must be created. Character has a few values, but one of the most important is "... |
When I call a function, I want to receive updates when the function reaches some milestones:
def do_something():
start_with_something()
# update
for x in iterate_something():
# update each iteration
do_something_expensive()
# update again
finish_with_something_else()
# final update
... |
Given a class diagram , how can we find design issues in it. I am not talking about the relationships it should be representing as they exist in the real world but i am talking about design issues that make show up in it like cycle among classes.
|
I was reading the Urbit docs and stopped at this paragraph (emphasis mine):
The main thing to understand about our ‘overlay OS’, as we call it, is that the foundation is a single, simple function. This function is the Urbit OS virtual machine. We call it ‘Nock’. The entire Urbit OS system compiles down to Nock, and No... |
In my project I'm using the observer pattern in several places, i.e. the subject notifies the observers about something, and expect them to act. The subject does not know anything about the details of these observers.
With Spring I autowired/injected the observers as follows (constructor injection):
@Autowired public S... |
In my company, we're using Spring Boot to implement backend API and React to implement frontend including Web interface and Android/iOS apps.
Since our product is an Enterprise software, customers actually have to pay to get the latest backend API to deploy on their own servers. However, our mobile apps are regularly u... |
I am writing an application in c++ and Qt5.
It would be very convenient for me to create a virtual file system so I can unit test code working on files.
I have found that in Qt4 there was a QAbstractFileEngine class which would perfectly match my needs, but it was removed (from public interface) in Qt5.
The only thing ... |
These would be the base classes like Npc and NpcTask.
public abstract class NpcTask
{
public Npc Npc { get; private set; }
public NpcTask(Npc npc)
{
Npc = npc;
}
public abstract void Update();
}
public abstract class Npc : MonoBehaviour
{
[HideInInspector]
public NavMeshAgent NavM... |
I am working on building a generic api that should ideally work with any data (Bring Your Own Data) but the overall functionality remains quite similar at the top level.
For example lets say we are building a generic recommendation system. Some clients might want to provide recommendation on books, some might want to ... |
So I'm trying to make a quiz app where the answers should be typed rather than multiple choice. However, even though there is always one right answer, in english, we have many ways of writing the same thing.
E.g. Q: What is the definition of obesity. A: When a person weighs over 20% more than the recommended weight fo... |
Understood that for all these ways of measuring the time and space is dependant on the users hardware, I was wondering is there is a similar way to calculate the battery usage of a program over n amount of time? Or is it completely dependant on the hardware?
|
I'm trying to rapidly develop my frontend, but every time I change my code I find myself refreshing my browser and running some macro to test whether the changes in my code solved the problem.
I tried changing the process to headless PySelenium, but it takes so long for the driver to launch every time I change my code.... |
I guess it would be too complex for Node.js / JavaScript to leverage, but I've been working with clusters in node to break big tasks down so all cores can work at once but the inter-process messaging provided by Node seems to stringify the data to JSON and re-parse, causing a high overhead on sharing calculated results... |
Dear all the programmers and overflow friend,
First, I want to say thank you to stack overflow users for helping me finish 20% of my PhD project since last year (using python to draw some technical graph). Now i am waiting for the Viva section of my university. I am python user since one and a half years ago. I keep se... |
I have a string variable named status in my code that can take on three values "Starting", "In-progress", and "Complete". A friend of mine said it was good practice to enforce that status has one of those three values by using an enum. What is the best practice way to do this? (And for what it's worth, is an enum the r... |
I built my API service and now I want to consume the information from a WPF application.
So far I created the class ApiHelper which initializes and provides the HttpClient used to call the API endpoints and the class MemberService which exposes the methods to get the data that it retrieves from the API.
public class Ap... |
I'm trying to make a sports stats app in Java/Android + Realm.
I have the following classes:
Season
Player
Matches
I would like the Season to contain a "list" of all the players that played that season and Players to have a "list" of matches.
I currently have actual lists as attributes to each class. For example the ... |
I have a scenario where a service needs to update back and forth information from different channels (and each channel should have the same information, e.g inventory of products).
It all works fine if the process is sequential. Problem is that by adding more and by adding more channels, or with more information, the ... |
I am leading a team of developers creating a Java library. We are following the standard Semantic Versioning model. The code is versioned with Git. Artifacts are built and pushed to an artifact server using Gradle.
As is the standard, the artifact version, when published, is determined in build.gradle with the line ... |
If I try to rewrite specific regex functionalities (e.g. substituting a string) in Python, a solution using the regex module is always faster.
Is regex written in C?
|
I'm finding the use of IoC containers to be quite the shift in my application design, and its for the better. I'm using a framework called injector that aims to mimic (albeit not entirely) the Guice framework.
With that in mind, I have 4 classes that I'd like to outline that show where my mixing of container use and "... |
I have read many tutorials on Polymorphism and all of them show examples of Polymorphism used in arrays, for example you would have an Animal (parent class) array, and its elements are Cat and Dog and Rabbit (child classes), and then you would loop through the array and call Animal.speak() on each element.
Are there ot... |
I have an application that's mostly one large data pipeline. That pipeline runs daily and stores processed data in the database (it takes the execution date as its argument). Occasionally the client finds some bug in the data processing algorithm or just simply requests a change in it. Then I write the bug fix or modif... |
I am looking for any general guidelines to allocate table space quota to different layers/schemas in ETL flow of a data warehouse (% of total space in each layer).
As per my research, ETL flow can consists of 4 layers for a data warehouse:
Staging -truncate and load data from source files.
ODS- Type 1 persistent tabl... |
Multi Threaded application with n threads implemented using ExecutorService.
There are x (tens of millions) tasks submitted to the ExecutorService.
Each task needs to generate millions (number of items is not constant) of items, where each item must have a numeric unique id (has max length).
How Can I generate such i... |
So, most software depends upon third-party libraries, to some extent or another. Specifications of such libraries' behaviour usually takes the form of human-readable documentation.
We write integration tests to ensure that interactions between our software and these libraries yield the expected behaviour.
But suppose ... |
What would be the best practice of handling input validation in microservice? Especially for the duplicated data?
To give context, say I have 3 services:
User
Typical user service with User object with a lot of details (~40 fields in the object)
Asset
Has Asset object like
{
id,
name,
companyId,
descripton
}
... |
It seems common practice to not positively indicate during a password reset attempt whether the email requested is actually registered or not. This makes sense because knowing that an email is registered will give an attacker a potential vector for exploit.
However - how does one do this during the new account registr... |
Given the following architecture and frameworks:
Spring Boot Application with Spring Data JPA (Hibernate is used as OR mapper); layered architecture as followed.
REST layer
Service layer
Persistence layer (JPA)
DTOs are used to transfer the data between frontend and backend. Mapping for DTOs -> entity objects, entity... |
Problem Description
I'm working in Python and I've been having a problem designing something to handle the following (abstracted) system:
I have some objects (lets call them Nodes) that can be in states. These corresponds to physical objects in real life. One node can be in multiple states. Additionally, each state can... |
Let's say a developer is tasked to implement a certain feature in the codebase. That developer tries to implement the feature using Design A (e.g. a certain design pattern). The developer finds out halfway through implementation that while using Design A appears to be an appealing solution at first, it actually introdu... |
I'm working on this containerized API where in two steps (one asynchronous and one synchronous) the user can interact with the output generated by the first step trough a front-end service.
I wasn't entirely sure if I should post it here or on SO but since the question is more so about the design rather than the imple... |
If python dictionaries are essentially hash tables and the length of hashes used in the python dictionary implementation is 32 bits, that would mean that regardless of the number of key-value pairs that actually exist in any given dictionary the size of the dictionary is static and fixed with a length of 232.
Such an i... |
In a MVC scenario, is it OK to pass arguments to functions from the View to satisfy different formatting needs?
For example: let's say that the model has a DateTime object and the view must show this date in various format (sometimes as "01-Jan-2020", sometimes as "Monday, 01-Jan-2020 08:00" sometimes in some other way... |
So I want to find out how to get a list of all modifications made by installing a piece of software.
For example. If I install Word, I want to see all directories created, classes registered, dlls,
Modification to drivers. Etc.
Is there a way to do it?
In short I want to know what my OS was before installation, and af... |
My job regularly involves writing and reviewing (in the form of pull requests) English prose in the documentation for our internal system, which solely faces other developers, in a strongly American firm spread around the world.
That writing falls into two categories - a documentation website, and documentation snippet... |
What would be the proper way to describe a system whose sole purpose it is to give users access to large amounts of data in a structured way according to their own criteria?
Like say for example someone, for whatever reason, wanted to build a system that gave the user access to every permutation of the integers 0-9. B... |
New to Python and all things database related. Wondering when I should consider using a database and why?
I have what is essentially a list of objects that is around 30000 lines long. I'm developing a web app which will need to search this list for the correct object depending on user input.
For more context, the list... |
I am creating a microservice based application which has to interact with Github through its API. Some of the microservices are Projects, Tasks, etc.
My question is: should I have a microservice dedicated only to communication with github? so when I need to create a project in the project microservices, I register it ... |
I am trying to conceive a wine cellar application for my father and for fun on my free time.
I've decided to make a simple MVC with Pixi.js / JQuery and Bootstrap served by Express for the front and a REST API with JAX-RS Jersey for the back (so in Java).
The software is supposed to be use on a local level, so hosted b... |
I have an existing .net server infrastructure that resides in a company's intranet. Now for a new feature I'd like normal users (employees) to receive notifications on their machines when specific events occur on the server.
What's the best way to accomplish this?
Polling periodically is a no-go for security reasons. B... |
I'm working in a Scrum team, We have Sprint Planning 2 to breakdown backlog into technical tasks.
The team is pretty big around 12 developers, We can't split cause it's not under our control.
We already have architecture designed, But may not cover everything since the code base continues to evolve.
And when it's come ... |
I am doing a project for a client where I am getting my first real heavy, hands-on exposure with Javascript.
Since I have learned about adding .bind(this to callback functions, I find I am doing it everywhere, and I wonder whether it is excessive and whether it's good practice, or whether I am structuring my code badly... |
I just had an argument with my professor about surrogate key usage in my project's database design. My professor insisted that a primary key (natural or surrogate) should not ever be exposed, even in the URL, and using an auto-increment as primary key is a bad practice because something like german-tank problem.
I argu... |
We currently have a monolithic code base which we are in the process of extracting some micro-services where it's obvious to do so.
One thing that stands out is our email delivery. We have numerous points in the code base where emails are created and are sent out via a number of different templates. What I want to do i... |
+-------------+ +--------+ +----------+
| repository +-------->+service +------->+controller|
+-------------+ +-^------+ +------------+
+-------------+ | +^ ++------>+controller2 |
| repository2 +-----------+ | | +------------+
+-------------+ | +----... |
Based on many tutorials that I have read, the following is the definition of Polymorphism:
Polymorphism is the ability of an object to take on many forms
Now let's assume that we have an Animal parent class, and a Dog and a Cat child classes.
Is the above Polymorphism definition means that an Animal variable can have... |
I have a system in which some data is inserted into database. Whenever that data is inserted subscribers should be notified about that (it doesn't have to happen just after inserting, but there is a time limit so I can wait like 10 s and then notify about X number of data inserted).
Problem is that each subscriber may ... |
This my first UML diagram for user registration flow.
After double checking the diagram I feel that I have a crowded diagram compared to what I can found in Google search.
My questions:
Are my alt and else branches usage correct?
Is it valid to include error responses in the sequence diagrams?
Is it valid to include th... |
I am having trouble trying to represent some multithread process and I would appreciate some advice.
Please let me explain this with code. (in C++'ish because that is what I am familiar but consider it just pseudo code- it is easy to understand)
Say I have two classes MainClass.cpp and ElementClass.cpp
the MainClass ... |
I have an open source API server project on Github and I am trying to put it into continous integration. The project uses SQL Alchemy and I use ELAlchemy to manually generate a png database relationship graph (in png format) and put it into my documentation (in .rst format and uploaded to Read the Docs).
Now I am usin... |
As a creator of a software library, how can I verify backward compatibility with earlier versions?
When using a dependency management (here: Maven), multiple versions of my dependency could be (transitively) used:
com.example:some-project:jar:1.0.0
+- com.example:my-library:jar:1.1.0:compile
+- org.example:another-libr... |
I'm building my project with Visual Paradigm and I have some use cases that implements the CRUD pattern.
As specified in the book Use Cases: Patterns and Blueprints, Övergaard and Palmkvist suggest to implement a single use case as one of the best ways to handle this type of use cases. There is a different flow for eac... |
I have no experience with C (only C++ and higher level languages). Right now I have tried and failed to find general guidelines on how to write good C code in a way that allows to separate the programm logic clearly into replacable parts that can be combined with other parts or reused in other projects.
To give some co... |
What the different types of SDLC models and in which systems are they most suitable for?
|
I am working on a problem where I need to extract data from text. I first considered using regular expressions, but some of the data is not in a format I am sure how to handle or even if regex is the best way to handle it. So, some lines are simple [fieldname]: value \newline. Unfortunately, others have nested data, ... |
I am traditionally a desktop app developer, but circumstance has thrust me into the role of doing web client and corresponding REST api logic for a project I am involved in. Unfortunately, I'm a one-man-show, so my opportunities to learn new patterns or techniques from co-workers is somewhat limited. When I was rampi... |
we have a legacy project, on Windows. It goes on from 1990-s.
Until very recently it was not backed by any version control, today it is moved into Git.
The question is all the prior snapshots. As of now, they are spread on network shared folders, with folder names usually suggesting the part of the project, the date or... |
We have an application that has served us and our clients well from some 20 years now. Pretty good track record but it's obviously showing it's age in some areas.
We are looking for advise and suggestions for bringing the product to the next level. The idea is to address some issues without throwing away or rewriting ... |
My question
I built an inverted pendulum on an Arduino using C (ie. everything was done procedurally). I'm trying to self study application design and would like to refactor my code into a more OO approach with SOLID, loose coupling, and testability in mind.
How can I improve this design to achieve a more loosely coupl... |
I am a scala developer new to swift. In scala we can share implementation across a variety of classes by "extending" a trait that has default implementations for the methods. I would like to see how to do that in swift. Here is my shot at it.
Let's consider an Alerting mechanism to be added to many application classe... |
I am working on a web application as a hobby and trying to learn some concepts related to cloud development and distributed applications. I am currently targeting an AWS EC2 instance as a deployment environment, and while I don't currently have plans to deploy the same instance of my API application to many servers, I ... |
Lately, I've been working on a project which basically is a huge rewrite in .NET Core F# + Event Sourcing + PostgreSQL of an old sub-ledger legacy app written in .NET 4.6 C# + SQL Server.
Since the whole rework thing cannot happen overnight and the legacy process needs to run till every single piece is tested replaced,... |
As my first job, I joined a startup with a small number of developers.
I mainly work with this one other person -- let's call him Paul for now. We are the only two devs on our team.
He joined the company a year before I did, pretty much at its inception, and built a considerable part of our company's core and gets a lo... |
I am developing a webservice, which offers different services, but currently under different ports. Existing services like GitHub or GitLab also several services, but I am wondering how they can expose them under a single port. Are they looking at the header of request and decide if it is a git client or web browser re... |
I'm trying to learn about MODBUS as a free-time project. It is a long standing desire to write my own driver in Golang. That being said, I'm now trying to design the concurrency model for device connections.
I'm using the MODBUS specifications from modbus.org as guidance. Specifically, my question arises after reading ... |
I am watching this talk by Sean Parent. He notes that:
Choosing the same syntax for the same semantics enables code reuse and avoids combinatoric interfaces
What does "combinatoric interface" mean?
Could you explain with an example?
P.S. Thinking more about this my guess is that if we have n types and m operations wi... |
Please, consider the below merge sort algorithm. Here we start with a divide portion which splits the array into halves and we do recursive operation on each half separately. I have ignored the merge portion of the algorithm to reduce complexity.
function mergeSort(unsortedArray)
{
let midpoint = Math.floor(unsorted... |
I have an architectural question. I have an application which is subscribed to a log compacted Kafka topic. I have to process each event and store into a persistent datastore. I am planning to run the app in 4 instances with the same group-id so that the partitions are distributed with all the nodes.
During the lifetim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.