instruction stringlengths 34 36.1k |
|---|
I'm trying to develop a small solution with the possibility of user authentication. Because this will be later hand over to other developers, i want the first iteration of the solution secure as possible for user data.
After reading some stuff about security and hashing, i'm decided to store hash + salt in a single fie... |
I am developing a web based vehicle tracking application. Clients buy GPS devices and the company I work for mounts it on their vehicles. The client then gets a user name and a password for the software and this is how he is able to monitor his fleet.
However, when the company started to grow some clients want to mount... |
In a wpf application, a Model object is created either from scratch or deserialized from some .xml file. To create a connection to the ViewModel, the following method (on the Model!) is used by the application:
class Model
{
public override UserControl View
{
get
{
if (_view == null)... |
Recently, I started to work on some legacy system. People that developed it, came to an idea to store list of strings in single field of database table. Lets say that it is an identifier for object that does not have any representation nor data in database. The range of that identifiers will be relatively small in prod... |
XML is labelled tree, a special case of graphs. So, why there are separate XML databases and why is it that XML is not stored in graph databases? At a first glance it seems so easy - one should map XML parsing and storing operations to graph database insert/update operations and one should translate XQuery queries to t... |
Let's take Spring web socket (with tomcat) for example.
Does Web Socket blocks thread while keeping the connection between server and client? (For example, connection can last 2-3 hours).
(
Does web socket uses thread the same way as regular http request does (e.g., blocks/owns thread while performing the requests)
)
L... |
I am perplexed by comments under this answer: https://softwareengineering.stackexchange.com/a/358851/212639
A user is arguing there against the use of getters/setters and properties. He maintains that most times using them is a sign of a bad design. His comments are gaining upvotes.
Well I'm a novice programmer, but to... |
We have an application using a bunch of services. As soon as the application is launched it should call a webservice method, "RegisterMachineSession". In this method we accomplish some basic work that should be done before any other service call. For example, we load in memory a set of parameters associated with the ma... |
Let we have a (finite or infinite) directed graph and a start vertex. For each vertex we have the set of edges from this vertex totally ordered to specify the traversal order. Let we also have a set P of "preferred" edges.
I want to traverse this graph. This could be accomplished as either depth-first or breadth-first ... |
I'm developing a program where twice I've found the solution to a problem was to use hash tables with iterators as keys and some other arbitrary type as the value.
I found my self using this pattern in initially to deal with two data structures affecting one another, but not being coupled in their own right. In this f... |
I have the following abstract class which implements the "Allocator" concept, using policies and traits to customize behavior:
#define FORWARD_ALLOCATOR_TRAITS(C) \
typedef typename C::value_type value_type; \
typedef typename C::pointer pointer; \
typedef typename C::... |
I know this is a common question, but I haven't found another that solves my doubts.
Usually, if the project is small, I've persistence annotations in the same object that represents the domain object. This allows to load the entity from database and keep all the setters private, ensuring any instance is always in a va... |
I've experienced cases where it would be valuable to restrict access to the API of external libraries and frameworks to prevent negative consequences in the system.
For example, in a SharePoint application it might seem natural to call spList.Items.GetItemById to get a list item, even maybe in a loop, without realizing... |
I was wondering where to do/put calculation of fields to be calculated from other data. Yes, I am talking about computational field. Also the computed data needs to be saved in database. So..
Weather it should be done at Database or by some external code like a windows service. ?
Let me put my need/scenario:
I am dev... |
I know that in C code using L after a number tells the compiler that the respective number is L.
However I do not see any practical use for this. Do modern compilers still have a use for this language construct?
If there are still use cases what would be those cases?
|
I'm writing a class that read lines from a file, process them, store them in an accumulator and when it reaches a threshold bulk inserts in a SqlServer database. Like this:
class FooImporterToSqlServer
{
private string ConnectionString { get;} //initilized via constuctor
private AccumulatorCollection Accumulato... |
I'm having a design issue in my REST api, where I have a resource Device, which happens to represent an IoT device, can be partially updated using PATCH, but some of the things that get updated will begin a long running job.
For instance,
Here is class Device:
public class Device
{
public int Id { get; set; }
p... |
Background:
Currently I am working on a C++ project. It's for business use, so this project is not open sourced. However, this is a project with a fairly large code base (around 10k lines of code) and a couple of external linked libraries and binaries. The problem is nearly 80% of the code base is written in C style ra... |
I am working on a medical application which will be implemented for USA patients and health providers.
I want that there should be only 1 record of a user without any duplication. And I believe that putting a unique constraint on email across the application solves this problem. Mobile number, address, and name are su... |
I was reading about code architecture and the MVC/MVVP paradigm. Ideally, we should have the model as a high-level policy/component where it should not know or directly depend on other components, such as the view. Essentially, one of the roles of the controller is to send inputs to the model and thus has the model com... |
The site I'm building currently has three different regional versions (Australia, Germany, rest-of-world). These will be deployed to seperate urls.
It's a static site, hosted on s3 using react. The three versions share 99% of the code and use the same assests (images, video) but have different text and possibly an ext... |
I need to convert a large number of XML files into JSON. The XML files all have same structure, and differs only in data that they contain.
I could write a basic C# utility that would parse XML and then create JSON file. However, since all JSONs would be same in structure (since all XML are same), would it be better t... |
I have a large data set (more than 3 Million distinct data points that have 6 integer numbers). I want to compute the shortest route in terms of hamming distance. (amount of numbers that change between two data points, meaning that the distance between two points can either be 1, 2, 3, 4, 5 or 6).
Using even nearest ne... |
I have currently an application that have various forms that are basically about scanning some barcode/RFID tags and displays the List.
As such I have some generics components and even a generic sub forms used by others forms.
Basically this form contains :
A top bar with some labels about how many objects were scann... |
Relational database management systems can’t have M:M relationships, so before converting a data model to a database in Access, SQL Server, mysql, or other relational DBMS, the data modeler must solve the M:M into something else.
when drawing the er diagrams what is the correct option regrading many to many relationshi... |
The company I work for now doesn't implement continuous delivery yet. We still deploy the project manually to server, file by file. Which is best practice: to manually deploy one project artifact for each deployment or keep doing the file-by-file deployment?
|
In my company, there is a KPI about code coverage. We measure results by code coverage percentage.
So we combine code coverage result of unit test and end-to-end test together.
Does it make sense to do this?
|
We always used C# to query Active Directory, recently we need to add a patch to some code and it would be easier for us to query Active Directory straight from SQL DB as then we won't need to make any change to our code base other then stored procedures.
I got no clue how it would be seen in world of best practices, ... |
I've been learning some C++, and often have to return large objects from functions that are created within the function. I know there's the pass by reference, return a pointer, and return a reference type solutions, but I've also read that C++ compilers (and the C++ standard) allow for return value optimization, whic... |
Im studying about software architecture but Im with some doubts. Because for example if you dont have any or much experience in developing a application how can you build an useful architecture for a application?
For example if we already have the requirements phase for a web application like a ecommerce app where we ... |
I do believe that my question is similar to: Is it OK for interfaces to depend on concrete classes? and see/understand what the answer explains about how the dependency-inversion principle should be followed. But I am interested in a slight variation of this question. Would it be acceptable to define an interface conta... |
I am curious to know why does the function clock() only returns values in increments of 10,000 and is not able to return values in between.
I have the following code:
#include<iostream>
#include<time.h>
#include<stdio.h>
using namespace std;
int main()
{
int a;
clock_t clock_start;
time_t start1;
time(... |
Currently we are developing the data access layer of a CRUD application. We have the following structure:
We have business entities which are used outside the data access layer to perform the business logic.
We have DAO entities which are used in the data access layer to store the data in our database. These entities ... |
I've read a lot of definitions of abstraction and how it is achieved in programming languages such as Java and C++ using interfaces (Java only) and abstract classes.
I understand that abstract classes and interfaces are required to allow multiple classes to provide their own implementations of the abstract methods and ... |
I've implemented a rule engine like this:
public interface IRuleEngine
{
List<ValidationMessage> Validate(param1, param2, param3);
}
public class DefaultRuleEngine : IRuleEngine
{
readonly IList<IRule> _rules;
public DefaultRuleEngine()
{
_rules = new List<IRule>()
{
new ... |
Our code base is growing for 20 years now. We are about 10 devs + sqa working with 500kloc. Some time ago a small team of us (2 devs, one from sqa) started working on an automated test program. Currently one run takes 11h and is somehow an integration test. We are working on it to get this down and reduce false positiv... |
I'm currently working on a large application (a hundred libraries, several thousands classes) with several entry points (MVC website, webservices, some background running agents, job schedulers...).
Most of those entry points use a non negligible part of the core services (I'd say around 50% at least).
I know from cred... |
My team is developing a system with embedded and Windows components. Currently we have seperate repositories for the Windows and embedded platforms.
The rest of the team have concerns that there is not enough visibility of the current branch status to make assesments about user story completeness. The goal is to perfo... |
NOT ASKING FOR CODE TO ANSWER TO THIS SPECIFIC QUESTION, ASKING HOW TO APPROACH PROBLEM IN GENERAL
there's a question on codefights that asks to find all unique sums of two arrays, one size, the other quantity.
I'm using a cartesian product to determine all the possible permutations. This seems to be too much overhead... |
I've been working on implementing a customer-facing REST API at work the last few weeks. Although there's not yet a requirement for it, I think it'd be really nice to have analytics for this.
For example, to track how many requests are being made by which client, etc.
I'm planning on creating an analytics app over the ... |
When creating a Set in Java, what's the difference between the following? Which one should I use, and why?
Set< T > set = new HashSet<>();
HashSet< T > set = new HashSet<>();
|
Our application allows users to read/add/edit/delete table records through the UI. To prevent concurrent users from editing the same table row (stale record scenarios) we use a row identifier and row version field in the table. These operations are now exposed through web services too. In order to reuse code the read a... |
I am working micro service architecture and figuring out what is the best way to get complex data from a micro service.
So for example : Let's say micro service A is owning data based on any CRUD operations, there are X,Y,Z services which requires some sort of aggregated info and conditional info from micro service A,... |
I just wondered if this would be a good practice:
Imagine a Model for example a User, which is read from a Webservice or an Database.
Of course the user-implementation must not have any knowledge about the datasource.
I wondered if it is an good idea to add those knowledge by an Extension method, so I could do somethin... |
In the following code, int() is an explicit type conversion.
#include <iostream>
int main()
{
void* ptr = int();
return 0;
}
Clang Compiler:
source_file.cpp:5:11: error: cannot initialize a variable of type 'void *' with an rvalue of type 'int'
void* ptr = int();
^ ~~~~~
GCC Compiler:
Workin... |
I work on an online game server. For regeneration of player's hitpoints, I consider using timers. That is, if the player is online and his HPs or mana is lower than maximum, every minute these stats are incremented.
Normally, there is no more than 50-80 players online at the same time. Is a wise approach to create a t... |
Background to avoid the X-Y problem: I'm building a database migration system that needs to resolve foreign key constraints (see here for full background). I need to determine what order I can execute create table/modify table operations so as to not violate any foreign key constraints. A topological sort is a natura... |
To extend a bit on the title, I'm trying to get to some conclusion about whether it is necessary or not to explicitly declare (i.e. inject) pure functions on which some other function or class depends.
Is it any given piece of code less testable or worse designed if it uses pure functions without asking for them? I wou... |
Question
So, is using Cucumber to (near)exhaustively define complex interactions of requirements by example an abuse of the tool?
Question Setup
Is it appropriate use of Cucumber (or any other specification by example tool) for documenting the complex interactions of rules? Global rules in written requirements can leav... |
I just learned about the MVC architecture. I was going back and working on a command line file transfer application I wrote, and I was curious, to what degree should command line interfaces follow the MVC pattern?
|
Like the title asks, for what reasons would you use the ampersand binding in AngularJS instead of utilizing an event system--especially in a case where your application already uses events for some things? Either AngularJS's own $broadcast and $emit system or a third party library like Postal.
It seems like both paradi... |
There is an application which serves a huge list of resources and in the UI the users are able to filter the resources by type and other properties.
The resources are of different types but they have few properties common in them. For example there are resources of type Car, Book and Pet each has colour, price, owner a... |
Let's say I have a Matrix class I've already implemented.
Matrix<float> mat(30, 30);
for(size_t row = 0; row < mat.rows(); row++) {//Assume Row-Major ordering for performance reasons
for(size_t column = 0; column < mat.columns(); column++) {
mat(row, column) = float(row+1) / float(column+1);
}
}
I'd li... |
I recently asked this question.
I am trying to decide where to put the validation in a DDD app. I believe it should be done at every layer.
I am now concentrating on the Domain model. I was expecting validation to go in the Setter methods like this.
What is the "best" way to do validation. I am talking from the pers... |
I am looking at writing test cases (something I haven't done/been taught before). I am creating a web app which has a Java based REST Api backend which uses Spring Boot.
Regarding various types of tests(unit tests, integration tests etc), I am confused about what to apply where.
The code of my application is divided in... |
Let's say that I have a Person class. The person can eat, swim, and sleep. Basically, I do Person:Eat() and he eats and so on. Now what if he has a set of martial arts he can use? How would I do that?
Would it be like Person.martialArts.Karate:Kick() to perform a karate kick?
Or would it be better to have martialArts a... |
I have a NoSQL repository with two tables, Foo and Bar. Each Foo has some metadata and a list of Bar ids. Each Bar has some metadata.
I'm writing the API for retrieving a Foo and would like to provide the ability to specify whether the returned Foo contains either the related Bar ids or the related Bar objects.
For e... |
I knew that by using De-duplication procedure we can save storage costs.
1) I know what is de-duplication but I don't know how it works. Can someone clearly explain how de-duplication procedure works?
2) Can de-duplication be applied across all users? (does any Cloud Service Provider like Google, Azure, AWS and Dropbox... |
While studying the book of Software Engineering by author Roger Pressman I came across this point about software reengineering , where it is written in the book that if creating documentation is time consuming then it is skipped. Roger Pressman says if there are no significant changes after reengineering then documenta... |
Hi there i've been into MvvM and modular design the last few days, i find it really nice design principle that be scaled and maintained really well.
But here is the thing, i see there are multiple platforms like Prism that make the whole process automated, they have their own templates, their own observable objects, th... |
For my software engineering project I will be creating software to automate tasks.
In my project management module I have been asked to describe and evaluate how I can met all the specific goals for Verification in CMMI Version 1.3.
By looking at Wikipedia I can see what is outlined for Verification as:
Purpose
The pur... |
I recently asked a question about validation here: What is the "best" way to apprach validation from the perspective of a DDD purist?
Please see the code below, which I borrowed from here:
if (string.IsNullOrWhiteSpace(email) || email.Length > 100)
throw new ArgumentException(“E-mail is invalid”);
i... |
I have an abstract class with one or two protected methods needed for the subclasses.
abstract class TransformRouteProcessor {
protected String doX(String arg1){
//doX code
}
protected int doY(String arg1) {
//doY code
}
}
The subclasses will need to implement the processor interface... |
I come from many years working with SQL Server. I am working now on a mobile game using GameSparks as the back-end which only supports NoSQL run on Mongo.
I am creating a Computer Card Game and am trying to get my head around the best-practice for creating documents in collections which relate to other documents in a d... |
I need to design an Restful API resource and it's quite a complicated resource in that i need details about other resource to define my property.
Currently I have 3 solution.
Creating the related resource as a property until I have the
granular detail I need.
Pros: Efficient
Cons: breaking open / closed principle ... |
I would like to understand why is redis called an in memory database when it provides persistence similar to databases like MySQL or Postgres:
http://oldblog.antirez.com/post/redis-persistence-demystified.html
https://redis.io/topics/persistence
|
I've decided to implement a database wrapper to provide data operations of a web service using postgresql dbms.
Models in my database are somelike complex and frameworks like slick do provide more problems and need of workarounds due to type complexity than time or effort saving.
Following this Programming in Scala 2 q... |
I need to create a web application that will use MVC. The application is small, and will only use one web page. It will retrieve information from a database, as well as add and update entries onto it. The page will most probably be accessed by only one person at a time. It will not be using Entity Framework.
I'm new to... |
I am working on a program that has several frontends. The main application has a GUI that allows a lot of manual user interaction. The second one is more like a script that just runs a default work flow.
At some point questions to the user may appear. These are most often related to ambiguous input data, where the user... |
I have a class that has loads of functions, and I can't divide it in multiple class :
Class A {
// attributes
/**
* Descriptive of foo
*
* @param i ...
* @param j ...
*/
public void foo(int i, double j) {
....
}
// doc for foo2
public void foo2() {
....
... |
There is a website driven by Django where the user logs in and can answer thousands of questions. I want to persistently save whether a given user has answered a given question or not.
My approach so far is for the User table to have thousands of columns in the PostgreSQL database - a column for each question containin... |
In C# you can use a for-loop without declaring the body, what is the benefit of using this in production-code versus using a foreach loop?
Example
My Examples below use reflection to get the property value of an object based on the p_strPropertyPath parameter. The method can also look at the property of a property, for... |
I have been reading a lot about different design patterns, their pros, cons, main usage etc. However, I like to experiment and try to invent my own ways of the implementations (even if they are not the best). Now I am facing a problem with my Entity component system implementation.
Despite of the pros of this pattern I... |
I am currently working on project which requires parsing different types of files. The content of the files will populate the classes.
eg: file1 populate content of class1, file2 populate content of class2, etc.
My question is where should the parsing logic of the file go?
1st option : If I place the parsing logic ... |
I'm interested in how companies cost in the maintenance of software and or improvement of code quality over time.
The context I would like to add, is not that of a company who have a single product where all their resource is devoted to this one area, more a company who develop many smaller projects per year for a rang... |
In Clean Code, Robert C. Martin states that no parameter methods are better than those with very few parameters. I'm kind of confused as no parameter methods are usually harder to unit test and tend to be more coupled.
I think his rational is that since a class should only fulfill one very specific task the coupling i... |
According to Vernon Vaughn's - Implementing Domain Driven design:
...Events are used to rebuild the state of the Aggregate by replaying
them in the same order in which they occurred. The premise is that
this approach simplifies persistence..
My question is... In a DDD system where your domain is publishing events... |
I'm working on a legacy warehouse system. There is one Aggregate root, Product which has its correspondent ProductRepository.
Right now I have a new requirement that says the following:
Some Products are Purchasable and need to keep track of the datetime they have become purchasable.
So, in order to implement this re... |
I've been through a few iterations of DDD with a few different projects, yet I still struggle with properly defining bounded contexts. I continually find myself wanting to create very granular aggregates. This has become even more true once I've introduced event sourcing into the mix.
Here's a concrete example. Let'... |
I'm writing a C# style guide for my team and I'm trying to describe the benefits of side-effect-free functional-style methods. I want to include online references to back up the suggestions, but I can't seem to Google the kind of functional method chaining I have in mind.
When I think "method chain", I imagine somethin... |
I am writing some test units using googletest and googlemock and I am stuck in a problem related to C++11 smart pointers and polymorphism.
Suppose you have those classes:
class A {
public:
virtual void doThings() {...};
};
class B {
private:
B(std::unique_ptr<A> a): a_(std::move(a)) {}
std::unique_ptr<A> a... |
I'll pick one of the most popular react boilerplates as an example here.
Assume, i've forked it (commits history till fork date remains intact).
According to the text of MIT license, the only thing that I have to keep is the license itself. So, does it mean i can change whatever i want in this repo and remove/replace w... |
I'll break this post into two parts, because I'm trying to abstract the concept, but will explain my implementation at the end.
I have two workflows, Workflow A and Workflow B. Part of Workflow B relies on the results of Workflow A. They can be executed sequentially and work as intended, but I want to pipeline them. I ... |
Would it be correct to assume that in general, I would need as many controller classes as classes that can be accessed/modified by a user?
For example, If a logged-in user can add/modify to a class clients, addresses and stores, I would need a controller for each class?
thanks
|
The project that raised this question is in C#, but it could apply to most languages that use namespaces.
I've read many things on good naming practices:
"Don't prefix your class names with their namespace name. That's just creating unnecessary duplication." (Smurf naming)
"One of the uses for namespaces is separatin... |
Lets say I am creating an API for class University to create a Class.
(This Class has Class name, Teacher and students).
eg:
class Class{
..
private:
std::string class_name_;
Teacher teacher_;
std::vector<Student> students_;
};
class University{
public:
... |
The following quote is from this page:
While some CPU manufacturers implement a single address space in their
chips, others decided that peripheral devices are different from
memory and, therefore, deserve a separate address space. Some
processors (most notably the x86 family) have separate read and write
elec... |
I'm writing a program with the following conceptual mode.
A User can apply to become an employee, which places their account in a Pending state. They can then be Approved or Rejected. The only person who can put an account in the Pending state is the user themselves.
An Administrator can move users to and between the ... |
Say you start a web site on shared hosting and it increases in popularity which might cause it to become unavailable as the number of accesses increases.
So as a developer how do I figure out when the limits are being reached and what can I do about it in terms of the architecture with the suitable hosting solution to ... |
I am trying to adhere to the Single Responsibility Principle (SRP) as much as possible and got used to a certain pattern (for the SRP on methods) heavily relying on delegates. I'd like to know if this approach is sound or if there are any severe issues with it.
For example, to check input to a constructor, I could int... |
I'm aware of software development principles and best practices. However, in most cases I entered a project that was already on its phase 2, and that already had a significant amount of code written. In addition, in some cases the code and architecture of the project was causing several problems to the application (per... |
A Drupal website is using external Rest API service.
The problem is that in a rare occasion when the Rest API service loses database or crashes for whatever reason, that causes the Drupal website to slow down.
Drupal uses many API endpoints frequently so when those are unavailable, the website becomes useless.
What wo... |
Please see the code below:
public interface IUnitOfWorkWrite <TSession> : IDisposable
{
TSession Session { get; }
void Commit();
void Rollback();
ITransaction BeginTransaction();
}
}
This interface is contained in the domain layer. The service layer provides an implementation. ... |
I have a code base consisting of multiple scripts and many functions. Everything is controlled from one master script (master.txt, let's say).
I have a lot of "global" configuration files, for example the URL, login, and password of the webservice I'm communicating with (this changes between test and production), and s... |
Our company still uses a lot of manual testing of software (and this will not change in the coming years). We try to improve our build and deployment process by using a deployment pipeline which handles both the automatic and the manual tests.
The idea is to present the user a list of tests for which he approves that t... |
Wiki says:
Substitutability is a principle in object-oriented programming stating that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable propert... |
I have been given a project recently where REST API have been implemented in the most basic way possible i.e. request comes to app, app hits controller, queries db, returns response.
So this mechanism, as its quite obvious, has started to create issues in terms of response times as data has grown a lot. Plus this appr... |
Suppose I have a compiled dynamic library: .dll, .lib, .so etc. Is it (theoretically) possible to automatically create C header file for such a library? Is there an existing tool that does that?
Intuitively it looks to me like it should be possible. After all, the linker is able to find the necessary symbols inside the... |
We have the following scenario in our company:
There are some business objects which have business rules associated with them. One of these objects, Person, has the following rules:
A Person must have a name (that is in coding terms not null, nor empty)
A Person's name mustn't consist solely of spaces and/or tabs
The... |
Suppose that I have multiple instances I1, I2, I3, etc. of a set of classes C1, C2, etc. Suppose that these classes are all inheriting from a super-class S.
Suppose that there is an operation O(a, b) that takes two instances of S and see if they are compatible (compatible in some since.) In order to check for compatibi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.