instruction stringlengths 34 36.1k |
|---|
How can I tell my software has too much abstraction and too many design patterns, or the other way round, how do I know if it should have more of them?
Developers I work with are programming differently concerning these points.
Some do abstract every little function, use design patterns wherever possible and avoid redu... |
I'm building an API that, among other things, will allow the consumer to create a record. That record can have an array of images (passed as URLs). Assume that the consumer passes an array of image URLs, but some return a 404, exceeds a file size limit, etc. -- what should the API do? I see two possible options:
Fail.... |
I am doing a microservice and I was trying to make a decision about how to handle Domain Model.
I am planning to have multiple microservices, as an example: A ClientsMS and a PaymentMS. They both need to have a client class. One way is to have client class in both MS and do a mapping between the two, Or have a Model(do... |
As long as I remember at least in older versions of Cassandra database, search was implemented in following way -
During startup several samples are collected from sorted table and
when data is needed the samples are considered.
Then the data is search sequentially relative to the location of the sample.
Note I... |
I'm studying up on clean and as a result am quite dramatically rethinking a great deal of how I design and write software.
I've thing I'm still wrestling with however, is for business rules like "on save updates to some item, first load All the list of items I have permission to view/edit etc, confirm that this item is... |
A React website I am building is going to have these sections: Hero, Projects, Courses, Skills and a few others. The Skill section will iterate though a list of skills and display a React component SkillCard for each item (as you can see in sketch). SkillCard will open up a SkillDetail component when clicked. The Skill... |
I'm currently developing an API (node/express js) for a blog website that uses a markdown parser (showdown) for rendering content and a html sanitizer (html-santize) for removing malicious html/js.
Currently I am at the point where I want to let a user edit a post, but I do not want to expose "raw" content to other use... |
I am starting to design the architecture of my family's small hotel business. But I'm a junior js developper and I miss the big picture when programming on the go. I am afraid that this might lead to confusion and/or bad practices.
I have therefore started with a basic activity diagrams in order to document my ideas o... |
I have a .net api backend for mobile apps and the question came up (in conversation with the iOS develper) if a JSON response for an empty GUID should return:
00000000-0000-0000-0000-000000000000
or null (by having the return type nullable Guid type (Guid?)
If the first one, the mobile developer needs to create a p... |
Suppose you have this:
namespace Project.Services
{
public class ClientService
{
public IEnumerable<Clients> Query(Project.Models.Builders.ClientQueryBuilder builder)
{
//...
}
}
}
AFK namespaces help you to organize your project in a miningful way. It provides a context of how t... |
It seems to me that Ruby hashes would be a good option to implement the Data Transfer Objects that the Application Services receive from the client code as commands and queries requests.
For Application Service responses, perhaps a response object with success/failure and a result property containing the data as hash.
... |
I am after advice regarding message queueing. We have requirements for "jobs" to be posted to a message queue.
The original suggestion was just to use a SQL Server instance and process messages from that. Everything I have read on the internet suggests that using a database for a Message Queue isn't a scalable solutio... |
Currently I have a class hierarchy for parsers with Parser as interface with CSVParser and XMLParser classes implementing it. The interface has following methods :
List<AType>parse(File file)
Now I want to add another parsing method that would take the same File type as the argument, but will return List<BType>. This m... |
I want to know how does a file system write to and read from a storage device.
I think this is how it works:
A file system doesn't access the storage device directly, but rather the storage device is presented (by the device driver of the storage device) to the file system as a (very large) byte array.
For example, if ... |
I tried to give it a chance without thinking much and this is what I came up with:
Room
----
| ID | No. | Type | Price | Beds | Hotel| Size | Minibar | Images | Booked |
| ---|------|---------|---------|----- | --- | ---- | ----- | ----- | ----- |
| 1 | 101 | Deluxe | 5000.00 | 2 | A | 31m^2 | ye... |
I have a bunch of classes inheriting from Violation. These subclasses model violations to different rules: UsedTimeslot, TeamConstraint, etc...
I need to check what kind of violation happened in order to respond to it:
if team_constraint_violation_ocurred:
corresponding_action()
However, the only mechanism I have ... |
We have a complicated ERP software written in native PHP and our own micro-framework which uses big and complicated queries. We want to rewrite the application using an MVC framework (e.g. Laravel).
I have developed some other applications with Laravel and Eloquent and I think converting the queries of our ERP app int... |
We are working on a software project, a team of 5-10 developers. The code base is continuously integrated using Bamboo. We have a build plan running also unit and integration tests and then a functional test plan. We get automatic emails about failures but sometimes days pass before a failed plan is fixed.
Question: H... |
I understand that objects external to an aggregate shouldn't hold references to entities and value objects belonging to the aggregate. My question if this also applies to the Application Service that exposes the use cases to the client code.
For example, if I have an Order aggregate, and Order Line is a value object i... |
I'm struggling with aggregates in actor model (akka) and how to store their state. I wonder what role does repository stands for in actor model in DDD.
I have a situation, where my aggregate root creates another aggregate as result. But internally, AR firstly creates an actor and then sends additional messages to it in... |
I'm playing around since a while with building a little open source project based on the output of facebooks pfff tool, that can parse multiple programming languages and output some kind of unified AST.
For example, given a simple PHP file like this:
<?php
class FooBar {
public function functionA(string $arg1)
... |
I am learning design patterns in Java and also working on a problem where I need to handle huge number of requests streaming into my program from a huge CSV file on the disk. Each CSV line is one request, and the first field in each line indicates the message type. There are 7 types of messages, each of which should be... |
I had initially posted a longer variation of the question below on the Stackoverflow site but was shut down for being too obtuse. I am a newbie at using VPS in general and wanted to try out something with a Flask website.
I want to setup a Flask webiste on DigitalOcean with some links that launch some games either back... |
I'm currently working on a architectural design for the testing of a product that's estimated to have over 100k simultaneous user hits. For the product specification, I'm including continuous integration and continuous delivery practices by using cloud CI services as Travis.
Now, I want to also stress/performance test ... |
I'm building a web service where I need to show different products/lists to different users based on their profiles/preferences. For example:
John, 24/M, single: Show list A and D;
Kyle, 48/M, married: Show list B and C;
Jennifer, 22/F, single: Show list C and F;
This is the first time I need to build something like ... |
The problem I have with unit testing is that while it makes refactoring(regression testing) easier, it expands the code base and make it more difficult to prototype or to change the design. Developers tend to be averse to change the API due to unit testing.
Is it possible to develop a testing system such that you don't... |
I'm building a server for a turn-based mobile game. I'm using SignalR for communication and I was wondering if storing list of users in the memory is a good idea?
Like.. a static object of "Server" class which has List<User> same for current games. The game is pretty simple - like tic-tac-toe.
Are there better ways?
|
The traditional Waterfall lifecycle includes a specific phase for design and planning. In Scrum there is no big up front design. A small amount of design to conducted when breaking down features into stories, during the sprint planning meeting and during the sprint.
Since sprint planning is time boxed to a few hours, ... |
Our team has recently started conducting code reviews against each checkin.
As the team lead I'm trying to find a balance between providing too many suggestions, annoying developers and decreasing the teams output, and letting go of code I would have written differently.
Is there any evidence, study or guidance from we... |
According to the definition available online, "Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers". It means I have a Restaurant or School website and I provide access to different restaurant or school to use my application with their own data by using their ... |
I am redesigning a PHP/MySql site that was about 7 years old and had lots of MySql statements. I had updated them all to use MySqli, but have recently heard about "prepared statements", so now I'm wondering if I should take the time to change all the MySqli statements to use prepared statements.
For example, the major... |
Just again another licensing question... By now I read so much stuff about licensing that I'm totally confused.
Let's say I write two little java libraries and put it on github. One of them has a GPLv3 licensed dependency, the other one has a Apache-2.0 licensed dependency. Note that I'm just using these dependencies, ... |
We have a master system storing customer data. Data is replicated to client systems (channels) at night. During the day data can be updated by users/customers on the master as well as on the clients.
I need all data to be kept in sync between master and clients. Preferably "real-time" (within minutes).
What pattern sho... |
Over the years I've been switching back and forward on the idea of creating Sugar Classes.
Sooner or later I find myself repeating the same operation over an existing type. Like string manipulation, date-time calculations... in these cases I am tempted to wrap the object into a custom class and get some extra syntactic... |
I'm fine with staying under 80 characters per line for code (even if some consider that limit outdated), but I'm split (no pun intended) when it comes to splitting comments over multiple lines, versus writing them on one line (as long as it needs to be) and letting the editors taking care of the wrapping.
I think comme... |
As far as I know there are two types of CSS namespacing:
Prefix one:
.myapp-alert {...}
and class one:
.myapp .alert {...}
Which one is preferable? Does one has benefits over the other one? Are there any other?
|
I'm finding that others not having the time to do reviews in a code-review enforced open-source (so volunteer) project is really slowing the velocity - it's really unmotivating to have 3-4 PRs of your sitting there for days and prohibits me from doing any new work.
Real life taking priority is of course understandable,... |
What is the best way to store historical information about products and pricing in a database?
Our suppliers provide us with catalogues in various formats that usually contain
manufacturer's ID of the product,
product's name,
GTIN-13,
and MSRP.
Based on that information I would like to create a database of produ... |
From this bar chart on staff allocation I want to know what is the preceding activity for D and E in order to draw activity on arrpw diafram ?
Is it B or both B and C ?
|
I have an MVC 5 ASP.net app that is working perfectly. A colleague of mine has made a project that reads in data from files and churns some of it to output some calculations for me to display in the web application. I call his methods and I get the data back and display on screen.
As part of his project he has impleme... |
I'm trying to work out what the correct process for deploying a nodejs application to a production environment should me, using webpack.
If this was a standard Java/Maven project I might do something like:
mvn clean install -Pdeploy-production
where the mvn install compiles the application, and the additional deploy... |
I have implemented a checkout cart like this :
Navigation rules are as follows :
User can move to next step only on completing the current step.
But he is free to click on the previous tab and edit the past information.
Currently I have implemented this in a single page using jquery. However, the code appears extreme... |
I want to test-drive functions in C that manipulate an array. But the solutions that I find make me feel somewhat uncomfortable.
Lets speak about the limitations first: I'm using a forward declared struct that is a pointer to a kind of structure my test should have no knowledge of (only my implementation knows the actu... |
I am looking at Fluent Validation for my rich domain model: https://github.com/JeremySkinner/FluentValidation
Lets say I have a class called: Customer. The Customer must have a surname. I can do this:
RuleFor(customer => customer.Surname).NotEmpty();
I can do something similar to make sure they are over a certain ag... |
I wonder if somebody tried creating a language where you can write mutations in a straightforward imperative style, and the compiler transforms the changes automatically to pure, Redux-style actions. For example (pseudo-js):
atomic function repaint_car(car) {
car.color = "Blue"
car.value += 1000
}
would be con... |
I noticed that there are couple of ways one can use to get a resource using rest API. I am currently trying to find a valid pros/cons on each of these technique in order to adopt them at the larger scale.
What would be the main differences between these requests?
Why would I add id into the path, and not into querystr... |
We create a commercial library and code examples that are being used by external developers.
We have (closed, available to registered users) documentation that extensively explains how to use the library.
Many of the developers are first-time users, so a lot of rudimentary errors are encountered.
Is it appropriate to i... |
I'm trying to detect a clock hand in a video of an analogue display and extract the value it points to. I'm using Python with OpenCV for this.
What I essentially do is:
I'm using a Gaussian Blur to lower the noise in the current image.
I use Canny Edge Detection to filter the edges
I apply the probabilistic Hough Line... |
How can I represent a "wait until customer representative is available" in the UML activity diagram below? A solution in UML 1 or UML 2 are both acceptable.
Proposal 1
The simple line back to the second condition "looks" wrong.
Proposal 2
I also came up with this "cleaner" solution.
(I know that the final point is ... |
Context
My team of 8 engineers is currently transitioning to Git (from Subversion) for our next big thing. We have a handful of 'more experienced' engineers that are finding it quite difficult to pick up Git. I get asked the same trivial questions despite having provided user manuals, training activities and whiteboard... |
I have created in Azure 2 Azure Functions resources with the following names:
FrontApiFunctions
PostProcessingFunctions
My Visual Studio solutions is like this:
AllFunctions.sln
|- FrontApiFunctions
|- FrontApiFunctions.csproj
|- FrontApiFunctions.cs
|- PostProcessingFunctions
|- PostProcessingFunctions.cspr... |
When reading about ACL and RBAC I seem to understand it easily - there are either usernames or roles that are given access to an asset. I can also see how I could implementing those.
i.e. this image gives a clear view of ACL and RBAC for me (as in I can go on and design database tables based on above):
(Image courtes... |
I am working on developing a UML class diagram from C++ code. I have a classless header file that is basically a definitions file (it has structs, enums and defined constants). I know how to represent structs and enums in general, but I am unclear about how to represent (or if I should represent) constants in the cla... |
Each time i read an article or a book about asp.net MVC , there will be a chapter for dependency injection and repository . now i can easily feel the benefits of using repository over hard coding the entity framework code inside the action methods, as using repository i can write the methods which uses the entity frame... |
In my understanding, standard library is a whole separate piece of software than a compiler is. In my opinion, they should be kept separate.
Advantages of this approach pretty much boil down to "they can evolve independently".
Disadvantage:
Some standard library features could be rewritten in more modern core languag... |
I've written an application which reads a list of filenames and does stuff on those files. Dynamic allocation is not allowed and our language of choice is C.
The app has an array to hold the filenames, and its size is determined by ARRAY_LIMIT in the Makefile, and used via C macro. The important bits of the Makefile lo... |
I'm currently working on a project, where we'll have to keep a local system in "sync" with a remote application.
For example if a new customer is created in the local application, this customer must also be created in the remote app - via a rest api - and the "remote" user id must be stored within the local app for fur... |
In no particular language:
class fooclass
{
int A, B, C, D;
public int GetItemSum()
{
int sum = this.A + this.B + this.C;
this.D = sum;
return this.A + this.B + this.C;
}
}
compared to:
struct foostruct
{
public int A, B, C, D;
}
int GetItemSum(foostruct ref fs)
{... |
For an application which:
Will use Google OpenID for account creation & authorization
I plan on allowing any user to "create an account" which is why I want to use Google for this
AWS API gateway (to route requests)
AWS lambda functions (to process requests)
where should authorization live? Authentication is easy... |
I understand Uber (or any other cab service) server receives the user coordinates through apps. Say I book the cab at 10am. How does Uber know which cab is vacant and nearest to the user coordinate, then notifies that driver?
Say I am at location X of city New York. How does the Uber server know what are the cabs near ... |
A simple scenario from today:
A developer gets a user story to display nice, layout constant, user-friendly error pages in case of an exception.
Developers want to have detailed pages on dev (local machines) environment and same behavior on staging (to trace bugs). While test case needs to validate the new look of erro... |
I have just read the following blog entry: Validation and DDD
By Vladimir Khorikov.
The blog talks about using the following patterns for validating an entity object:
IsValid method
Check validity in application services layer
TryExecute pattern
Execute/CanExecute pattern
Please see the code below:
public Person(Abst... |
What is the most common and wise way to specify many entities' ids in an API request?
For a singular entity request I have:
GET /v1/entities/{entity_id}
My suggestions for requesting many entities:
GET /v1/entities?entity_ids={entity_id1},{entity_id2}
With the same variable name entity_id:
GET /v1/entities?entity_id=... |
I know that I want to develop a React App like so:
<PhotoPage>
<FeedFilter/>
<PhotoFeed/>
</PhotoPage>
Without using Redux, I know that I need to fetch a dataset of photos which will manifest itself as the <PhotoFeed/>. Should I fetch this data in the PhotoPage parent component or in the PhotoFeed component itself... |
I have simple REST API, based on Asp.Net Core technology.
Now, I want to add OpenID for this API.
API would be used from mobile applications, single page applications and possibly other API services (not necessary).
It seems that I need Authorization flow, or Implicit, or even Hybrid, but as far as I understand, that w... |
A while ago, I asked what are cons and pros between the two version control designs of a project: multiple repositories, vs single repository
When a project has a single git repository and developed by multiple
people simultaneously,
what are some ways to manage the
contributions from different developers so that t... |
I am aware of the existence of several threads on the topic, but I am looking for fresh hand-on experience, that I was unable to find.
I have an application written in C++ (core, linear algebra and image processing) and python (interaction with the operating system, aka text files save, plot production, etc). The two a... |
Rolling my own GUI library for a side-project. Refactoring to use smart pointers; however, I ran into an issue.
I'm aware that you do not want to to use smart pointers across DLL boundaries for obvious reasons. But I feel dirty using 'new' in application code. See below:
// MYFINANCEAPP.H
class MyFinanceApp : public... |
I learnt the SOLID principles back in 2011 and I try to use them in my day to day work.
However, I often find myself wandering if I am breaking the Single Responsibility principle. A class can have a number of responsibilities:
Presentation
Repository
Service
Domain
Infrastructure
etc.
I also see complaints if one c... |
Consider this simplified example: In an online ticket sale website, tickets have variable prices that change over time.
User searches for tickets. Once he finds a ticket he wants, clicks "Buy" and then a quote is issued. Quotes are persisted and they have they own locator that is sent by email. The quote page opens, s... |
Python's re.match does exactly the same thing as re.search except it appends a \A at the beginning of the pattern (meaning match only at the beginning of the string). What is the point of having a whole other method just to do that?
|
How does git help deal with the scenario below:
I have a task broken down into 2 parts: backend task and frontend task. I make a pull request to merge the backend changes and wait for it to be merged (and address feedback). While waiting, I can't really work on the frontend changes because it depends on backend changes... |
Hoping to get some guidance regarding version control of Angular2 project.
Recently i started coding in Angular2, used angular-cli to create a brand new project and go through standard 5 minute setup as per angular.io site.
Now to the version control dilemma i seem to face.
I currently ignore node_modules folder and st... |
Is a segfault (array index out of bounds) always the programmer's mistake or could it be misuse from the user?
|
Some code I wrote was sent back to me during peer review, telling me to add logging to the start of each case in a switch statement in a servlet (Java, if that matters), so if something goes wrong, we can see where. I figured that doesn't make sense, as we log entire stack traces anyway, but the response I got to that ... |
I am designing the architecture of an application which has your typical backend and frontend components. The frontend application must be semi real-time. For this requirement, the backend is pushing messages on a queue and the frontend is consuming that queue. Most likely, I will be using RabbitMQ for this. Let me exp... |
I am using lex/yacc to parse a simple language which allows 'if blocks':
IF something
something
[ELSE IF something][ELSE]
END IF
and also other nested logic under a 'DEFINE' statement:
DEFINE something
something
something else
END DEFINE
I am in need of a common term to refer to these blocks (as the name of ... |
Where I work, we've been gradually beefing up our automated testing capabilities and coverage.
We're at the point where we've got a wide range of tests, and one configuration of "what needs to be run" is no longer sufficient. We want one set of tests to run when new code is checked in; a larger set for nightly builds; ... |
I am wondering what the most idiomatic text abbreviations for comparison operators are. I need to build a custom enum with them, so I cannot use their symbols. To me personally, these seem idiomatic:
== EQ
!= NEQ
< LT
<= LTE
> GT
>= GTE
However, some other languages seem to use 2-letter words: EQ, NE, GT, GE, ... |
Let's say I have the following Java code:
public class ObjectConsumer implements Consumer<Object> {
@Override
public void accept(Object o) {
System.out.println("Accepted " + o);
}
}
Example singleton implementation:
public enum ObjectConsumer implements Consumer<Object> {
INSTANCE;
@Overri... |
I am updating some code to allow us to implement unit tests. What I have so far is a Business Layer which calls the repository to get data from the database.
Business Layer example:
public class ConversationLogic
{
private IConversationData _conversationData { get; set; }
public ConversationLogic(IConversatio... |
This site and SO contain many pages about getters/setters and if they break encapsulation or enforce it. My question is for those developers that agree that getters/setters break encapsulation and should be avoided.
Questions:
How do you display your data in a GUI if necessary without getters? I found this
link, but ... |
In Swift, if I have a class with only type properties and methods (everything declared static) would that be considered a singleton object? If not, why?
|
I am trying to publish a C# application that does two main things. First, it runs a VBScript that goes into the SAP (Software solutions business) service and retrieves information in an excel type format. Then my program runs the main C# part and manipulates the data and then stores it into an excel file on the desktop... |
So I am using Stanford CoreNLP in my project. I have data which consists of reviews of products on a forum. I need to be able to assign a sentiment value to a given review. CoreNLP allows you to predict a sentiment class of a given sentence. The class varies from 0 - very negative to 4 - very positive. How do I combine... |
If you have a program that has a front-end and a back-end written in two different languages, how do those two systems communicate with each other? I have no professional experience in programming, I'm still in school. I know how, for example, to communicate between two java programs if I needed to. If I had two progra... |
I'm a C++ developer who has been using the MVC pattern to design GUIs ever since.
Recently I wanted to get back into C#, and I set up a Windows Forms application, but now I am a little bit lost on how to push it to a MVC compliant structure.
What I am currently trying to do is to "declare" the class I am given for the ... |
I have a style question for designing a class to represent a real model.
Let's say I have Guide that has PointsOfInterest as a member.
Would I want to do something like:
class Guide {
public points: PointsOfInterest[];
}
This seems bad, because let's say I've fetched a Guide from my back-end. To add a POI I append... |
In Single Page Applications, it's common to update the URL when navigating, and re-render based on the new URL. This can happen when the user hits the back and forward button, clicks on an anchor tag, or does something that pushes a new state on the history object.
The consensus for detecting any kind of url change th... |
So what I know about socket is that a socket is an end point of a connection for a process, hence 1 socket on a host binds to an IP and a unique port number for each connection.
But a webserver (by default use port 80) to listen for connections coming in from multiple clients.
My question is:
Does that mean a single ... |
I want to build a middleware system that my company can use and expand on to handle the integration points between our various bespoke and 3rd party systems as well as our hosted websites.
I am having some trouble with the design/architecture and would like some advice (please let me know if there is a better site to a... |
Let's say, for example, I want to test that a warning is shown on the Dashboard of a Car only when the Engine is broken.
The method implementing this functionality might look as follows:
class Dashboard {
function showWarningIfEngineIsBroken() {
if ($this->engine->isBroken()) {
$this->showWarnin... |
I'm going through this series. The author mentions that since state is maintained in object oriented programming, it is harder to write unit tests. He also says that since functional programming doesn't maintain state (not always), it is easier to write unit tests. I didn't see any examples that demonstrate this proble... |
Instead of using #define or const, I usually define constants using class static methods as follows:
//AppConstants.h
#include <string>
class AppConstants{
public:
static int getMax();
static std::string getPrefix();
};
//AppConstants.cpp
#include "AppConstants.h"
int AppConstants::getMax(){
return 30;
}
... |
The following situation:
a product which consists of multiple components, each component
versioned individually (all artefacts of the same component having the same version)
POs are talking of product version X and plan releases X.a, X.b containing specific functionality
each sprint a new release is made (that potenti... |
From time to time I feel exhausted in my software development efforts because I am pressed to think and develop in very specific and very short term manner. One client here and now requires one feature and I should implement it for him. Nor client, nor management of my company are interested in investing some time and ... |
Imagine a structure like this, a list with products.
<div class="container">
<div class="teaser">
<img src="...">
<p>Product 1</p>
</div>
<div class="teaser">
<img src="...">
<p>Product 2</p>
</div>
</div>
We need to test the amount of .teaser elements in .container is ... |
I'd like to ask about best practices on return statements.
So, what would be more preferable, something like...
...
String r = null;
if(var != null) {
r = "NOT NULL!";
}
return r;
Or something like this...
...
if(var != null) {
return "NOT NULL!";
}
return null;
In other words, one return statement and the val... |
I need a little advice with project design. I have taken on a personal project to enhance my knowledge of Java Swing, API integration, JDBC and OOP
I have chosen to do this in Java as I previously did a similar project in HTML and JSP's and learnt a lot.
For those who are interested, here is a breakdown of the App
From... |
I am required to speak at daily stand ups, change review and architect reference group meetings.
I usually find that I speak too quickly, include too much or not enough details, or go back and forth without a narrative. However I always understand the material and write well structured emails and technical documentatio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.