instruction stringlengths 34 36.1k |
|---|
I was arguing with my colleague on how to implement a dashboard function in a web site. Suppose a user can create a dashboard, which contains multiple gadgets in the web site. We planned to add more gadgets later on, and allow users to customized more on each gadgets, such as the formula to calculate the pie chart data... |
So I have to do a project for about 10 days. About the work, lets just say Im going to develop a Website with a front-end and a few interfaces between internal services. Now I have to use a projectmethod and I'm thinking of the Scrum Method. But since I'm only one person, I'm asking, if it is possible to implement the ... |
I use "reference" term here like in C++ world, not like in C# (for example). I use non-C++ syntax on purpose -- this is general question, not about this particular implementation.
Starting something like C++ afresh I would like to make rules and validation in order to prevent a case when reference outlives its source. ... |
Motivation: (Skip to "The Problem" if you don't need motivation for it)
As a project for myself, I'm writing an expression parser for certain kinds of mathematical expressions, and I'm using the interpreter pattern (as it often is used) for my Expression classes.
At the same time, I'm also using the template method pa... |
Imagine I have a set of houses I want to sell and I want to present then on a website. The user should be able to filter the house they want by price, city, number of floors, area etc. However, I don't want it to be like this:
First select price only, then you can select city and only after that can you select the numb... |
According to Is it wrong to use a boolean parameter to determine behavior?, I know the importance of avoid using boolean parameters to determine a behaviour, eg:
original version
public void setState(boolean flag){
if(flag){
a();
}else{
b();
}
c();
}
new version:
public void setStateTr... |
I have found many posts about how to organize work on develop branch and up to release branch. Or even how to work without the develop branch.
The trend of the "develop" branch going away, GitFlow branching strategy, but without the develop branch,
To branch or not to branch?... But I have problems about how to organ... |
I'm having a hard time to decouple two classes.
I have my code behind (will call it "class A") that I use to tweak the interface (defined in xaml).
Next I have a class B that is only logic. But while the logic is executing I have to update the UI.
My problem is that I can't "return" from the class B back to A to update... |
I'm trying to get into TDD, and a lot of examples sugests that we should use stubs to make our code more flexible. If I'm using javascript (for example) then why should I use stubs, since methods and even whole objects can be easily replaced for a mock?
Should I favor this:
const fetcher = require('some-async-lib');
f... |
Assuming I have a paginated api endpoint:
GET /api/meetings
My client is consuming this api endpoint and displays it in an infinite scroll that underneath gets page by page as the user scrolls down.
Now I want to add real time capabilities to the api.
New meetings can come in and also existing meetings can change (for... |
Say I have a Business Object like this:
public class CustomerBusiness
{
Guid ID;
decimal Salary;
datetime DateOfBirth;
}
and a data object like this:
public class CustomerData
{
Guid ID;
decimal Salary;
datetime DateOfBirth;
string Name;
}
Say I know the Name and Address when I m... |
I have an application that receives a number of values that need to be applied to various properties of an object (sealed class). Originally I just set the value without checking anything and updated the object, but of course sometimes the new values wouldn't be valid, and other times they would be identical to existin... |
When you are using frameworks like Angular, Angular2+, and React, the way you put data in the UI is by binding a property to an attribute of a UI element.
On the other hand, when you're doing standard iOS dev or traditional JS/JQuery dev, you extract a UI element reference, and do what you need with that reference.
My ... |
I am looking into Event Sourcing (ES) and having a play around with some code Greg Young put together (Greg Young Git Repo).
I like what ES offers in terms of functionality, but I am trying to apply that to my knowledge of a specific problem domain. Most applications I have worked on are all based around storing all d... |
At work I'm dealing with a situation where we have a large amount of time series data and need to display sections of it to the user at a time. The data essentially has an infinite number of records, and so it's not possible for the client to load the entire dataset at once. However, the API call to request sections of... |
I was reading this paper about the differences between software development in general and game development and the authors made some good points regarding software testing, pointing out, for instance, that
...game developers are hesitant to use automated testing because of
these tests' rapid obsolescence in the fa... |
In this article Mark Seemann explains how Onion/Hexagonal Architecture (or Ports and Adapters) are somewhat similar to a layered architecture when the Dependency Inversion Principle (DIP) is applied. Especially if you consider the claims made in this article to hold water, I think it's all quite clear and straight-forw... |
For example, let's assume we have a class that is imported three times from other classes. This would lead to a reusability of three. However, as there might be functions that are called only once, it would make more sense to count the called functions.
One general suggestion from measuring code reusability is to answe... |
Currently working with a client and their lawyers to launch a web application.
The website will be hosted in AWS on Debian Linux instances.
Debian contains (among others) the GNU General Public License which in my understanding is a Copyleft license.
We are being asked by lawyers, given this is a Copyleft license and w... |
I'm designing an application which will in an early stage collect data A, B, and C from clients, but later on will instead collect data A, B, and D.
A, B, C, and D are very related and right now exist as columns of a single database PostgreSQL table T.
Once C is no longer needed, I want to remove its references from my... |
As time passed by I learned that not strictly following the rules of a architectural pattern like mvc kind of counteracts the actual purpose of having a maintable software. Usually I end up with fat monster controllers or a model that does too much. Usually this happens because I didnt modularize my code enough just to... |
Let's assume that I have such a simple database scheme:
CREATE TABLE tbl(key INTEGER PRIMARY KEY, cap TEXT NOT NULL);
I want to show at least three independent GUI windows.
One window (window A) with list of items,
if I choose one item it should be possible to open window B,
that allow delete or update item. Also it s... |
On our project we have this data format that we use to process and record data on. As of late our application changed so that many of the data formats parameters have become obsolete. Currently we receive these data "packets" over internet (UDP or TCP) and from saved binary files.
We want to create a new more space... |
I've heard that changing a function's behaviour based on argument type is called ad hoc polymorphism:
program Adhoc;
function Add(x, y : Integer) : Integer;
begin
Add := x + y
end;
function Add(s, t : String) : String;
begin
Add := Concat(s, t)
end;
begin
Writeln(Add(1, 2)); (* Prints ... |
I understand Role Based Security.
I have read about Policy Based.
I have read what others call Activity Based.
What I want to know is if I do Policy-Based, am I avoiding what Role-Based requires and what Activity-Based seems to avoid - hardcoding security, refactor because of some new requirement, hardcode some more, a... |
I have a website that allows users to be "tracked" and track their time/work. This involves the users being able to update their account with my site at most every minute, but typically users do it only a few times per day. However, there is nothing stopping other people from updating your account.
Each update creates ... |
What is a widely accepted naming convention for date variables or properties in an Object-based, strongly typed language like C# (and by extension, for date database columns)? Do you use the word "date"?
Are there any official or semi-official style guides that recommend such a format?
I'm going to avoid an example wi... |
I'm writing a WebExtensions browser plugin that will modify the DOM of the current page when the user presses a button in the toolbar. More specifically, I need to insert HTML tags into the DOM. Even more specifically, every word on the page needs to be wrapped in a span tag.
In principle there's no way to predict how ... |
If you want to implement a layered API design for example, you may have one API layer that represents the application layer. And I assume that the application layer is represented by an endpoint and uri. Let's say we implement a Spring MVC Boot based controller, within that controller we may make a httpclient rest ca... |
I have bunch of keys and values that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K and then send to our messaging queue.
Packet class:
public final class Packet implements Closeable {
private static f... |
I just read https://techfindings.one/archives/2652 about functional programming and came accross this:
anonymous functions can often not be JIT compiled and will never be
optimized
Can someone explain to me why this is the case?
|
I'm trying to follow Uncle Bob's clean code suggestions and specifically to keep methods short.
I find myself unable to shorten this logic though:
if (checkCondition()) {addAlert(1);}
else if (checkCondition2()) {addAlert(2);}
else if (checkCondition3()) {addAlert(3);}
else if (checkCondition4()) {addAlert(4);}
I cann... |
I have to build a Windows Service which requires OAuth2 authentication. The service is intended (like all services should be) to run unattended (no user need to be logged in in Windows). The problem is, there is some user interaction required to get the OAuth2 authentication.
The service uses a third party API (I have... |
I have a function a plugin that is called whenever the WebAPI's "Plugin" endpoint is called in the main project, and that has to process the HTTP request. The request holds more information about what to do in method and query string, and I have for now copy&pasted the code to choose methods based on these:
public obje... |
I am working on design of a financial xchange system and especially the order-matching part.
I couldn't find a clear/complete design article especially for scalable/high available order-maching system. There lots of implementations which gives an idea about the system but none of the solutions are scalable and high av... |
We are a fintech startup that trying to re-build monolith php to microservice. As typical web app, we use to manage master data in admin page. How do i distribute this master data through microservice? We build a two API management service. One for the frontend user entry point other for admin/backend user entry point.... |
I'm doing an assignment for my school site and I'm trying to find a "best practice" way to go about solving my problem.
So, whenever a certain method is run I have to reupload five different files, to five different FTP. Each one of these FTPs require different credentials, so for each upload I have to create a new cli... |
I'm having difficulties assessing a design decision regarding entity relations in a JavaEE persistence data model.
Let's say I want to design a simple data model that's supposed to represent a chamber orchestra comprised of different types of musicians.
For now I know that there will be a flute player, a piano player, ... |
If we have different objects,
[A1, A2, A3, B1, B2, B3, B4, B5]
Some calculations will be performed to find compatible objects. For example, lets assume following 3 sets were formed and every set contains compatible objects:
{A1, B2}
{A3, B2}
{A1, A3, B4, B5}
Now we need to perform filtering. One node can participa... |
Consider the following c# example:
public class MyParentClass {
public int MyInt { get; set; }
}
public class MyChildClass : MyParentClass
{
}
public class AnotherClass
{
public MyChildClass GetChildClassFromParentClass(MyParentClass parent)
{
return new MyChildClass() { MyInt = parent.MyInt };
}
}... |
Everyone seems talking easy about it but I don't get it.
.NET Standards is a subset of functionalities of every .NET frameworks that you have to follow if you want to make your framework .NET Standard compliant and so compatible on all the platforms .NET can target.
Then why I have to specify manually "netstandard20", ... |
We recently upgrade to PMD 6.0.0 and are getting several classes flagged as "Data Classes"? It argues that it breaks encapsulation and makes for brittle design (I understand that this site has a different opinion).
Let's say that our team decides to go ahead and refactor the data class, instead of ignoring the PMD rule... |
This has been on my mind as I developed several applications with this feature.
Suppose that an application is required to process incoming requests in an asynchronous manner. Take the example of a notification system (other agents will submit a request for the notification to notify people via email or text, etc.) In ... |
According to the Single Responsibility Pattern (SRP) a method or class should have one responsibility. I have read a couple of sources and viewed some videos and I would like to understand it by writing some code samples.
According to me, the following:
def addAndSubtract(a,b,c)
a + b - c
end
is conflicting with the... |
I'm thinking of making a realtime chat app that would allow me to store user messages into a MySQL database. So far these are the two ideas I have.
1) Create and API which the message is sent to and then saved in the database. After the message is saved into the database a push notification is sent to the person who is... |
What I am going to discuss is typical situation.
Most of the developers I know work on functionality first and then on design.
BUT, when clients check the builds, they usually check design first without bothering much about functionality.
And since we are creating for clients, shouldn't work on what clients are going t... |
I am designing for a new application and I don't want to suffer later for the performance that manges discussion threads (posts + replies, very similar to Facebook or StackOverflow posts).
I wonder which kind of data store / data format I shall choose to persist the threads. I looked for an answer to my question, but... |
I have a Python project where I have a few classes that model various thing I'm considering (e.g., a car class, a driver class and a street class) and then I have a single helper function that does a simple, low-level operation, that I use in some classes.
Is it considered good practice to put this function in a separ... |
There's a large shared object (kind of OpenGL context) in my project.
It is accessed from multiple threads.
To ensure only one thread at the moments is using SHARED_OBJECT, mutex (kind of NSRecursiveLock) is used.
The problem is that sometimes MAIN_THREAD is waiting a lot while some BG_THREAD is doing something with S... |
I have a class library that calls dll_A.
dll_A has dependencies on WPF.
How to I wrap or isolate my class library so that the code calling my library does not need to have a dependency on WPF?
(My class library obviously has to depend on WPF, but the only output is Byte[]).
In other words, I want my library to act as... |
I have to compute small mathematical problems for my work. My main work is to develop and solve these problems analytically. I then have to compute these problems in mathematica, but this is not my main task.
I am not unwilling to do this, but I think I could save time by outsourcing it to someone with more technical e... |
I have a couple of inactive Pinax sites at different versions (0.9.x and 0.7.x). These both started with two common features:
While the version of Pinax was the most recent to have a (nonempty) social starter project, they were both relatively old; and:
Installation hinged on procuring some extremely rare and difficul... |
I’m seeking a term and possibly the code behind what would help me implement that term in Python.
I have been working on a text-based Python journaling application.
When I want to review my journal from the command-line shell, it prints out a series of logs like this:
Log_1”...”
Log_2”...”
Log_3”...”
The problem... |
I'm a first timer here so let me know if I should post this question in a different forum!
I have a python program that takes in user input but is only useful when you're offline, I wanted to make the ui better so I thought using HTML CSS, and JavaScript would be perfect. So my question is, is it possible for python an... |
I am new to AWS and i have learnt and developed code in spark -scala .
My application basically merge two files in spark and created final output.
I read both files (MAIN files and INCR files )in spark from S3 bucket .
All are working fine and i am getting correct output also .
But i dont know how to automate whole pro... |
My question is in context with the Serverless Architecture (e.g. AWS Lambda) and how does one interact with the Databases in this system.
Typically in a 3 Tier architecture, we have a web service which interacts with the Database. The idea here is to ensure that one database table is owned by one component. So changes ... |
I have written a basic web app in PHP, using MongoDB as database engine. The app basically inserts records into database as they become available, and queries the database and displays the data as on a web page when the user visits the page.
When the database is queried and cursor is returned, some processing is done o... |
I read about payara(glassfish) server cluster and find out that clustering with payara only replicate session in multiple servers.
but I use jwt for my project so I don't use session at all.
I decided not to cluster servers and just use multiple servers without connecting to each other and have Load Balancer in-front o... |
I'm not even sure "relevancy" is the most accurate word, so I'll just describe the problem:
I'm building an app that needs to somehow parse product descriptions from a popular website (let's just say it's Amazon) and figure out which certifications the product has based on the text in the description alone. The descrip... |
I have read couple of articles on google but not sure how DB client for example java application connect to clustered DB.
All the articles I read says client will write at master node but will use slave for read.
My question is how client will know which one is master(and its location) and which one is slave(and its lo... |
There exist a number of articles/blogs explaining the Dependency Inversion Principle (DIP) using Swift; to name a few (top Google hits):
GitHub/ochococo/OOD-Principles-In-Swift - The Dependency Inversion Principle,
clean-swift.com / Dependency Inversion – A Little Swifty Architecture
Now, Swift is widely described (e... |
I really love the way open source projects use RFC as a tool to get feedback and ideas from the wider community. I've been especially noticing this over the years with the way Ember have been doing their development.
I'm thinking about RFCs in the context of 'closed source' projects. The kind a consultancy or a softwar... |
I have the following pure function (f2 and f3 are pure too):
class X {
def f1(arg: Type1): Type2 = {
val x = f2(arg)
val y = f3(x)
y
}
def f2...
def f3...
}
Now, I would like to move f2 and f3 and can think of 2 options to do so. Wondering if one is more functional than the other?
Option 1
Move... |
I am struggling to define methods in OOP. Currently I am practicing with this scenario: "A hospital has started the development of a new system to keep records of analysis done by patients and the doctor who asked them."
I defined four classes: Patient, Doctor, Analysis and Hospital.
Patient: represents the person who... |
I have an iOS app that currently has over 2500 images. These are generated into an asset catalog to make use of thinning (2500 x 5 variants = lots of files). The files are largely accessed at random.
Batches of files will be downloaded via in-app purchase. Eventually, I'll end up with 10K images, so possibly 50K files... |
Here is a piece of cool code to add the two integers, a and b:
NameService nameService = NameService.getSingletonInstance();
OperationService operationService = nameService.resolve(OperationService.class);
ValueFactory factory = OperationServiceFactory.newInstance();
AbstractValue va = factory.newIntegerValue(a);
Abstr... |
We have a very large search service (written in golang if it matters) that runs on top of ElasticSearch, receive requests, builds the correspondent query, and returns the results (with some post-processing). The service handles thousands of requests per second and should be able to serve requests quickly and efficientl... |
If I have an app that will authenticate users using ActiveDirectoy and will Authorize them and link data with them that are stored in Sql DB.
Which one is best practice ?
To import data repeatedly from AD and store in DB as (Id, UserName) and each time I'll authenticate I connect to AD and make sure its password is ... |
I work on a java web-application.
In this application, users can generate some reporting (xls/pdf) and create some pack of multiple reporting. (using pdfbox, itext)
More and more data are added in the application since few year.
The generation of reporting is made on the same server as the application, which doing slow... |
First off, I am aware that many questions have been asked about VCS as a solo developer, but they are often too broad. This concerns only branching, and still it has been marked as a duplicate...the supposed duplicate is, again, marked as another duplicate of another question that is too broad and doesn't concern branc... |
Note - This is about software engineering.
A friend at work said:
Did you know that Facebook and Atlassian have abolished project managers for their software dev teams?
This sounded familiar, but I couldn't find a reference confirming this.
I'm asking the question how is it possible for large companies to have soft... |
I create copy of this post here because this place more relevant for my question and I don't remove original question from stakOverFlow because I got comments and start conversations with users.
I often meet in my code or in code from colleagues with bunch of init methods in onCreate() method in Activity and it's looks... |
We would like to use Driessen's git branch model but we also have QA side. I think I understand how this git flow works but I'm still not sure about testing. For example, I have five new features, each of them is in my own branch and I want to give these features to testing. Now I'm confused about where to merge them? ... |
I have observed in lot many C# example where in following pattern is being followed but i am not sure how this will going to help us in long run
Typical approach i have seen is
create a interface
implement interface
create a manager
call manager
it would be really nice if anyone can tell me how this approach wil... |
I've been using Linq for a while unknowingly that it uses a Reactive pattern that I'm quite fond of.
I'd like to roll my own function in that pattern but wasn't sure if it's appropriate and also wanted to throw out ideas about how I would do it.
My goal is to make a video player service that is injecte dinto classes, t... |
TLDR; I have one repo interface and multiple data sources, each with a different data identifier - how can I maintain having only one method in my interface?
I have a need to read a domain object OrderData from two different repositories: one is an outside service and the other one is a local database.
Let's call them... |
It is generally agreed that overloading a method should not change its behavior, but how much of a method's behavior should be kept consistent?
Take for example a REST API client which is responsible for interacting with two different endpoints. Both consume a POST request, share the same base URL, and accept the same ... |
Our company runs applications on a Micro Service architecture that includes thousands of services. I am working on a backend application "X" that talks to 50+ services. Frontend services call my service "X" to execute requests on other services.
Problem:
Front end wants to show user friendly messages when something f... |
Edit added 2+ years later
I "checked" the @dandavis answer because it answers my original question, giving reasons to prefer const foo. However, I am completely convinced by the @Wayne Bloss answer that function foo() is generally superior.
Original Question here
For example, in this Redux video, the instructor always... |
See the comment inside ChildEntity ::__construct():
class ChildEntity extends ParentEntity
{
/** @var int */
protected $classParameter;
function __construct(int $classParameter)
{
/**
* Question
*
* Below are the two ways of initializing the variable of ChildEntity
... |
In the past year, I created a new system using Dependency Injection and an IOC container. This taught me a lot about DI!
However, even after learning the concepts and proper patterns, I consider it a challenge to decouple code and introduce an IOC container into a legacy application. The application is large enough t... |
I'm using an internal library that was designed to mimic a proposed C++ library, and sometime in the past few years I see its interface changed from using std::string to string_view.
So I dutifully change my code, to conform to the new interface. Unfortunately, what I have to pass in is a std::string parameter, and so... |
I'm currently trying to map how to make a good algorithm that won't have issues to find the shortest path. The labyrinth consists of an X and Y dimensions as input; However, the labyrinth will generate obstacles within the dimensions and randomly spawned. There is one entrance and at least one exit after finding the sh... |
I am trying to test a function that creates a message exchange graph from IRC chat logs. I am having trouble trying to mock the dependencies. The function makes use of util module. The functions inside utils receive arguments and return an output after some processing. The problem is that these utils functions are bein... |
I have seen most of times developer declares the string in below fashion
Approach 1:-
public void method1(){
String str1 ="Test";
}
Approach 2:-
Per my understanding better approach will be
public void method2(){
String str2 = new String("Test");
}
Again based on my understanding , Second approach is better than fi... |
I am developing a mobile app in android in which I use Telugu (Indian language) texts. On my mobile Telugu language alphabets are available. Therefore, I am not facing any problem for testing my app. These characters are available in android studio also. So if I give the Unicode codes ranging from u0C00 to u0C7F in es... |
Is the following class definition a good design?
class Myclass:
def __init__(self,num1,num2):
self.complicated_tree = __class__.object_creator(num1,num2)
@classmethod
def tree_creator(cls,num1,num2):
return num1+num2 #in practice, this functions would be really long
... |
My team and I are trying to set up some integration tests of a distributed system that is highly dependant on the flow of time and events coming from external sources. Just to give you an idea about what we're working on:
when event A is received within 8:00 AM and 9:00 AM, and afterward,
within 5 minutes, a second ... |
In my board game I want to decouple my Player and Board class since I've changed piece moving system several times now and it's been a chore each time. I think I could use some interface for taking a player request to alter the board state but I can't decide if a Command or a Mediator interface is the appropriate solut... |
Here's a scenario I've encountered variations of on many occasions.
Imagine an XML feed which displays data about three different types of event: concerts, plays and movies. Each has a different set of parameters. We want to scrape this information and store it for our own purposes. So we create a database which has ap... |
The default behavior of assert in C++ is to do nothing in release builds.
I presume this is done for performance reasons and maybe to prevent users from seeing nasty error messages.
However, I'd argue that those situations where an assert would have fired but was disabled are even more troublesome because the applicati... |
I was talking with some coworkers about the application build and we have some divergences about what each one consider a good practice or something to worry about.
I learn that a good application build is one that is self sufficient, no matter how many dependencies and tests it have, the build will take care about the... |
I couldn't find a specific answer to my question but how would I develop an AggregateRoot class for the following scenario.
public class Root{
public int Id {get;set;}
public IList<Child> Children {get;set;}
}
public class Child{
public int Id{get;set; }
public IList<SubChild> SubChildren{get;set; }... |
I am a member of a 6 person team of software engineers within a 400 person department at a fairly well known company. We are responsible for the business applications our department uses, both third-party and custom asp.net tools we write. The group has been around since 2006ish and I joined in 2011. I have been try... |
I understand an event-driven architecture leads to decoupling. However, can using an event-driven architecture lead to minimal "getter/accessor" use? It seems that if you had some type of event handler such as BalanceChanged that passes the new Balance around then you wouldn't need a getter to access the Balance of a... |
I have three attributes for a user: connectionId (e.g. "sd4-h4sdg-u4j-a2rr3"), userName, and placeInLine.
I can't think of a single data structure that will handle my scenario of only allowing a single user to work on a given webpage resource and advancing the line of people as each active user leaves their connection.... |
I'm trying to implement this right-to-left evaluation algorithm of a postfix expression but I can't seem to get it to work.
for each token in the reversed postfix expression:
if token is an operator:
push token onto the operator stack
pending_operand ← False
else if token is an operand:
operand ← token
... |
My program (a command-line utility) will load configuration from a file, using defaults if file not found, and I'd like to do this in a cross-platform manner that people will expect.
Is there a de-facto standard or other common algorithm for searching directories to find the config file?
I'm imagining something like:
... |
I am a bit confused as for what it really means. In the related questions (Is this a violation of the Liskov Substitution Principle?), it was said that the example clearly violates LSP.
But I wonder, if there is no new exception thrown, would it still be violation? Isn't it simply polymorphism then?
I.e:
public class T... |
I believe there is a person who named this pattern or practice and would like to know the correct nomenclature to avoid confusion.
object.propertyA.propertyB
becomes
object.propertyB
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.