instruction stringlengths 34 36.1k |
|---|
I am redesigning a CRM tool, of sorts, from the ground up. We are creating the application and the database from scratch. In order for developers to stay out of each others' way, each developer has a local copy of the application's database rather than sharing a single dev database. This avoids the case of developer 1 ... |
http://gitversion.readthedocs.io/en/latest/why/ and https://github.com/GitTools/GitVersion explain the advantage of GitVersion over "Version.txt/Version in build script" and "Build Server versioning"
Before being able to understand the differences between the three approaches, what kind of problem do the three try to... |
I'm not even sure how to ask this, but here goes:
Let's say I have a Web application that incorporates Teachers, Courses and Students in such a way that I can do things like this (pseudocode):
teacherQuery = new TeacherQuery;
teacher = teacherQuery.getById(teacherId); // teacher is a Teacher object
foreach (course in... |
http://gitversion.readthedocs.io/en/latest/why/ and https://github.com/GitTools/GitVersion explain the advantage of GitVersion over "Version.txt/Version in build script" and "Build Server versioning".
Before being able to understand that, I was wondering what the two other methods
"Version.txt/Version in build scri... |
It is generally a good idea to restrict access to your variables as much as reasonably possible. For example make things private instead of publicand make variables final if they aren't supposed to change. I believe the same applies to method parameters, but I find actual practice of this to be extremely rare.
For exam... |
So I'm working on a growing C program in a Linux / POSIX environment, and I've run into an area where I'm not quite sure how to proceed.
Basically, I'm using a module pattern to develop my code for use with different external hardware and I/O operations (for example: a file module, a camera module, a Serial module, etc... |
So we have a code base that gradle builds into 3 different targets for 3 different clients that are from a business perspective completely separate.
To simplify our release workflow, we have opted to keep the same versioning for all targets as less than 5% of changes are client-specific and we'd much rather keep track ... |
It's a good idea to have a Singleton implementation with dependency injection?
I have some classes that performs some heavy tasks on instantiation (related to database loading).
I would like to use them always as new instances but is problematic due to performance.
The code I am working with is from a legacy app, so i... |
Today I had a discussion with our architect about writing using statements in WorkUnits.
Lets assume we have a PersonWorkUnit with methods:
public class PersonWorkUnit
{
private IContextFactory contextFactory;
private IRepositoryFactory repositoryFactory;
public PersonWorkUnit(IContextFactory contextF... |
Problem Statement: Write a program to build a house, house can be of the following types: Apartment, Individual House, Bungalow.
Kitchen is customizable: ItalianKitchen, ModularKitchen, StandardKitchen;
No of Bedrooms is customizable: OneBedroom, TwoBedroom, ThreeBedroom;
Drawingroom is customizable: StandardDrawingRoo... |
Playing with some 3d game stuff in my spare time in C++.
C++ doesn't really lend itself well to fast, simple functional programming, and games where there is a lot of necessarily shared state don't always either.
However some functional ideas still seem useful. For example my renderer is implemented as a single "pure" ... |
If you have an enum with values only (no methods as one could do in Java), and this enum is part of the business definition of the system, should one write unit tests for it?
I was thinking that they should be written, even if they could seem simple and redundant I consider that what concerns the business specification... |
This is a WPF application using MVVM design that connects to Services (Business logic layer) which manage Models, with an exception that some property set of the model is bound to some views directly. This means the model properties are updated without involving ViewModel in some cases and this view scheme cannot be ch... |
I know they can for addition and subtraction, but I'm not quite sure if they can for multiplication.
|
why do we need priority queue when a set always keeps its object sorted, I think we can always remove the first/last element of a set and it would work as priority queue because priority queue offers the element with max priority(last or first positioned element in sorted collection), apart from the fact that set does... |
I am working on a graph problem which is special in the sense that the nodes are computed only when required. This is because the graph is so huge that the entire graph won't fit in memory.
So, in my code I only have a node class and a computeChildren() method which gets called only when needed. I also have certain glo... |
I like to try out stuff in projects I am in.
When something doesn't seem right to me, I like to implement a new thing, see if it fits or not for a while, and then, slowly implement it to the rest of the cases.
For example -
Lets say that in the UI, I want to try out unidirectional flow.
So I take one page, and make... |
I got a headscratcher: someone submitted code to test whether all of some checkboxes were unchecked, and it indicated True when an even number were checked. The code looked something like:
if (box1.checked == box2.checked == box3.checked == box4.checked == box5.checked == false) ...
and I read it naively as: if each o... |
I know CC is counted at the code level to determine a set of basis paths (i.e. independent paths), the elements of which then can be combined to create any possible execution paths.
In software testing, CC therefore determines the minimal number of test cases to exercise those paths and cover all edges and all nodes.
A... |
In my very small C# application, I handle the SQL queries directly from the code using basic ADO.NET. I do not want to use an ORM, such as Entity Framework.
Now, I have a repository for CRUD operations. But I find I need flexibility for more complex queries.
For example, here is the (naive and simplified) process of lo... |
The biggest difficulty I am having is finding responsibilities of each object identified by me in the system or so called problem space. I am positing a very simplified description of a book reader.
This time I thought like which actions can be performed on an object and that action became the method on that object, la... |
I have a C++ project, cloned from GitHub, which I'd like to build with a Docker image (a customized Debian stable). The image contains the usual tools for compiling C++ apps plus all the dependencies required by the project.
My ideal workflow would be:
cd into the project dir;
invoke Docker and let the container confi... |
I'm confused how to name software functional requirements, and I have searched some examples and found names like F-01 (for functional requirement number 1) and found other examples like SIMT-01 (the name of the system followed by the number of the functional requirement).
Does someone know a standard/journal that says... |
Current Setup
We have a staging environment which used NFV (be precious NSX)
to configure the network (Software load balancer and software
firewall)
The Production environment has used the traditional
networking techniques (hardware load balancer and hardware firewall)
Both environments have the same application serv... |
I am working on a project where the input is a map of key-value pairs. Different users can provide different key-value pairs in the input. But the keys are pre-defined and maybe even an Enum.
Based on the presence of a key, I need to execute some logic.
For example, if the map contains key A, then I need to execute log... |
I am developing two libraries in .Net
Firs one it's a library with core functionality (named it Library.Core.dll)
Let's focus in User class
public class User
{
//set of constructors and methods
public void LogOff()
{
//does not know the functionality
}
}
In the other library I am implementing... |
I'm very new to this,so please correct if I'm wrong.
I've understood that with Amazon RDS one can create read replicas and use those for all read-only operations. This helps scaling the application a lot.
Unfortunately, I have a PHP application that does not support separate read-write and read-only connections.
Is th... |
I often end up with methods with long number of arguments (up to 5 arguments). for ex -
public void doSomething(obj1, obj2, obj3, obj4, obj5)
obj1 to obj5 are unrelated to each other
I thought of creating a Bigger Object obj containing obj1 to obj5 then pass only obj object that is -
public void doSomething(obj)
Bu... |
I've been questioning the size of the user stories that i'm currently working on. The feature that i am implementing is a Datepicker component. The business value of the component is to allow users to quickly choose a date range. The component will be used on multiple pages of the web application.
Currently, there are ... |
I'll describe an example:
I start making an API for a baking shop. The API will allow people to search their catalogus for baking products, such as home-made minty chocolate chip cookies using api.examplebakery.com/search?q=......
Someone uses this to look for a product named pineapple-banana flavoured cookies and will... |
We have a graph that shows bandwidth usage over time. The bandwidth is returned from the server in bytes.
We need to decide which units to show in the graph in case there are several different bandwidth points.
The data is received from the server like that:
[10000,200,3150,150,25900,193] // In bytes
The client shows ... |
I am new writing good test cases, so please bear with me. Writing a test case for private methods
public Stock getStock(String stockTicker) {
Stock company = new Stock();
String url = getEndpointURL(stockTicker);
htmlDocument = fetchHTMLDocument(url); // private method
c... |
We're working on a reporting system which has a clear write and a read path. For example writes will only happen after consuming events from a queue and reads will only happen when serving requests from an API. The responsibilities won't likely mix, i.e. the service writing to the DB won't use the queries used by the A... |
I'm new to AKKA and i can't figure out a general proper way to integrate a backend actor system with my WPF views.
I studied a few examples i found (all very similar, probably based on this), but in my opinion they can't be really taken as a guideline.
How do you tipically make an actor system and WPF communicate?
|
I am looking for suggestions/examples on how to setup permissions for my project.
I am using ASP.NET Core 2.0 with EF Identity 2 (on one server) and will be using IdentityServer4 (secondary server) as my authentication source.
I have multi-tenants (Organizations) that have multiple locations below them.
Users may have... |
I’m wondering whether a busy websocket connection uses significantly more battery on iOS than a sparsely utilized one - or if there is a constant overhead simply for maintaining the connection that dominates. This will inform some architectural decisions. Thanks!
|
Sometimes in Single Page Applications (SPAs) there are pages like Welcome, About, Help or Support which are just static content and which doesn't require frameworks like Angular. I often see that people just create component for these pages too which is managed by these frameworks.
The other reason is often these pages... |
The general question is what kind of mechanism can I use to transfer data to and from publishers and subscribers where publishers or subscribers can be permanently offline? Can message queues be used for this?
Possible approach
I am thinking a message queue style approach where the online service (publisher) publishes ... |
We are going to implement Integration Testing at our project for an Embedded Product. The plan is to develop the Tests and execute them at each sprint.
I suggested that the tests could be executed after all the changes for that round are implemented, in parallel with the System Tests. A coworker suggests that it would ... |
I have been increasingly using immutable data storing for my web-app, due to some advantages it has (simpler writes, ability to view history / activity).
I am doing it using MySQL dabatases, simply by only doing inserts; no updates/deletes; and with the id (primary key) on each row being an autoincrementing kind of 't... |
Here is the case: according to ubiquitous language - payment can be sent for processing to payment gateway (which is in different bounded context integrated via ACL (anti-corruption layer) + OHS/PL)
In local context, payment is aggregate root so I would expect design like this:
payment.send();
but the problem here is ... |
As far as I understood it is already not possible languages like Java, C# etc. Because the method name of defining constructor in these languages must be same with the class name. That because I'll talk about PHP which creating the constructor is more abstracted from the class name.
public function __construct(Type... |
I've recently joined a project that uses a database model which is, to me at least, unconventional. Every column, except the primary key, is nullable. Instead, the constraint is enforced in the code used to access the database.
The reasoning of the developers is that it's more flexible to do so, and since the REST API ... |
I'm currently making an desktop application for the company I work for. The goal of the application is to control the flow of a manufacturing process and it will be used by 5-7 user (working of remote desktop clients) with different UI windows, two to input orders into a database and the remaining (like in a manufactur... |
As a rookie programmer, I've only recently been digging into benchmarking, and have been comparing various ways of accomplishing the same task in terms of speed.
Most of the time, the result is either that the difference in speed is negligible or that it is so huge that I'm definitely going to use the faster option.
Th... |
There are strings and each string has a weight in a data structure. The getRandom() method should return a string randomly with its weight/total weight probability.
There is already a question on how to define this getRandom() method on stackexchange.
But this question is about how to test this getRandom() method?
Any ... |
I am currently developing an SFML application which stores a certain value in my model, which the view is displaying.
As SFML operates on a kind of render loop, which refreshes the interface constantly, I need to fetch this value which has to be displayed from the model where it is stored in every iteration to keep it ... |
I recently picked up 'Clean Code' by Robert Martin and have taken to refactoring my recent project. I'm realizing how important it is to name variables and functions in a way that clearly expresses their intent.
One of my functions is called addEvent(). But the problem is, this function sometimes adds 1 event and somet... |
In the C++ community it is considered an extremely bad practice to type:
using namespace something;
in the scope of the file for any reason, even if the project size is only a few hundred lines at most.
However, other languages offer analogous constructs. We can, for example, do this in Python:
from some.thing import ... |
If I have a validator class with a validate function that takes a ruleContainer as input. Should the validation pass if the container is empty ( least astonishment?) or should I throw an exception or just return false ?
|
We're building a web application to monitor industrial facilities, and we need to add a module to notify the users when certain things happen in the system.
We get data (lots of data) from the facility machines as 10 minutes data series (a value each 10 minutes, like machine's components temperatures, output performanc... |
I want to implement an abstract module to store credits and I have the following structure:
Model: Credit (abstract)
Dao: CreditDao (interface)
Service: CreditService
The Credit model should be implemented in the application which is using the module. The application can choose how the model is stored in any database.
... |
My company developed a RESTful API that is used by a few internal applications. This API allows clients to charge one-time payments as well as recurring payments. Both of those things are made up of resources; a person needs a payment method to create a subscription that will create a transaction. The data is very rela... |
I'm building a small application composed of:
Client (command-line)
Business logic (remote server)
It's a simple game of tick-tack-toe where the client sends information to the server about which field has been marked and the server returns an updated ASCII drawing of the board.
My initial idea was to implement the c... |
Is there a nice way to test code which performs IO? In Java in particular, if you go the Mock route, you need to wrap most of the native APIs in your own mockable classes, something like:
public class Filesystem {
public void write(String filename, String text) throws FileNotFoundException {
try (PrintWriter out ... |
I want to completely sperate the front-end and back-end, the backend using Java EE stack expose restful web service, the front-end web application interact with back-end using json.
In such a front-end application, is it possible to using client side language only(html+css+javascript) ?
|
A follow-up to Difference between '\n' and '\r\n'.
It's been few decades since the schism was introduced. Nowadays, when documents are being exchanged over the internet, typically with no prior knowledge of the client's preference of line endings, the clients have to deal with both \n, \r\n.
To me it seems that it's sa... |
As a WPF developer, I was confused when I discovered that I'm not considered front-end because my platform isn't web, even though I clearly deal with user interaction and the front end of an application.
One thought I had was that desktop applications don't have a separation between the front and back ends (the UI and ... |
I started adding informations about the behavior of functions to their name recently.
Two big examples:
pure - this function has no side effects (besides the returned value), which I would use in Java like static int addingNumbersPure(int a, int b) (bad example as no one would expect side effects in such a method, but... |
I am currently working on a project where I am developing a library which will do HTTP POSTs to a backend service on my server. The data that the backend service receives is processed and stored in a database and allows the user using the library to see the data.
I want to ensure that the backend service only processe... |
After reading a lot about semantic versioning I got a basic understanding of the concept but I'm not sure what's the best way to increment the version number in the following case:
Let's pretend that the last release was version 1.0.0. Now, I've a bunch of pull requests. Some of them are fixing bugs, others add new fea... |
I'm implementing an algorithm that needs to
Sort elements, in parallel (this will be done on a GPU, but that doesn't matter much)
Compute a comparison metric for every pair of elements. This comparison metric is the identical to the one used in a sorting.
My initial plan was to use bitonic sort for step 1 but I don't... |
I was going through a fantastic talk by Alex and nearly all the things he spoke made sense to me except for the given thing.
Link
In a nutshell how does module manage versions. If I have a module v1 with a method with different implementation, a separate module v2 with a same method signature and return but a different... |
I am developing software in Window 10 and Visual Studio in C++. I would like to restrict the use of the software to a set of computers, by implementing a license control.
My thought is to query a few key parameters from the system such CPU Type, Harddrive Serial Number, MAC address, and create a hash. I would then t... |
IOC principle can be implemented, using either:
Dependency Injection
Service locator pattern
This article also supports these two approaches for implementing IOC principle.
Spring IOC container is named after IOC principle that supports IOC implementation using Dependency injection, where implementations(<bean/>) ca... |
I have started a new job as a software engineer one month ago working on a web, saas oriented piece of software.
I like it, but I have spotted an area where I need to increase my skills, which is visualising new features of software in my head, fast.
Let me explain the context: we are a small team of 6 developers, we w... |
When the load of the hash table grows too large in proportion to the hash table size, you increase the size of the hash table to improve performance. When the load is too large is dependant on a predetermined value, the load factor.
How do you refer to the term that decides when to decrease the size of the hash table w... |
I am making a website for a competition my school is taking part in, however I am not on the team and am not receiving any compensation (save for better references :P). The only condition I have set is that I receive full credit and attributions.
All of my Javascript files have MIT licenses at the top, as they were wri... |
I want to be able to call on a list of files that are being processed by the server. The problem is, I want to call them on a web app (think React) whenever a user does something. i.e. a list of all possible choices and possible regex to narrow the list down.
How do you think I should store these names? I don't want to... |
I am new to adopting a completely TDD approach using DI so that I can mock every dependency. One of the pain points that I identified so far is the fact that whenever I do work in my constructor every test has to prepare for that sequence (expect the corresponding mock calls). An example for such a sequence might be cr... |
I'm just starting to look at understanding the graph data structure and the breadth first search and depth first search algorithms. For a package manager like npm, where one package might have dependencies and those dependencies might have more dependencies, if you wanted to check whether you had those dependencies al... |
Does this make sense or what is wrong with this approach?
So instead of using event store, we may use aggregate repository to update the aggregate based on values contained in published event.
|
What is the exact definition of a memory address space?
Is it correct to name the set of all the numbers from 0 to the highest addressable byte the definition of an address space?
EDIT:
I would like to know if there is a formal definition of an address space the same way as there is a mathematical formal definition for... |
In the React docs, the constructor functions of class components contain lines where this is explicitly bound for event handlers e.g. in the docs for handling events
class Toggle extends React.Component {
constructor(props) {
super(props);
this.state = {isToggleOn: true};
// This binding is necessary to ... |
I'm currently developing some Standard Operation Procedures for the company I work for. I'm starting with the very small examples; like scripts. There are currently several scripts being written in different languages. The idea is to stick with the best practices of each language for when developing a tool. The real pr... |
Suppose that the server restricts a JSON field to an enumerated set of values.
e.g. a POST request to /user expects an object with a field called gender that should only be "male", "female" or "n/a".
Should a wrapper library make sure that the field is set correctly before making the request?
|
This piece of code is in many of my methods, in a certain area of the codebase. It's not violating DRY since its a bit different for every method. But it still bothers me that 5-8 lines of code like this is in every method.
So I want to hide it away :) The question is how.
//e.g /configurators/configjohn/defaultfronte... |
I've recently been reading about Object Calisthenics and I'm stuck on Rule 9.
My typical approach to code (I'm a C# .NET developer) is to model data as POCO classes which only exist to represent data schemas. Inevitably this means a set of properties exposed with getters and setters. These classes implement few, or mo... |
Given that we cannot build on every commit, we end up building from multiple commits. Typically this is about 30 commits to a build.
Eventually, we break the build. How does one go about identifying and fixing code changes that introduce regressions? Are there any practices to tracking down the bad commit?
|
A number of tutorials on polymorphism state that "Any object that can pass more than one IS-A test is considered to be polymorphic." I wonder what they mean by that, and if that's even a true statement.
From my understanding, (subtype) polymorphism is when you have the interface of the base class and the implementation... |
I've been working on a 24-bit virtual machine to help me learn more about computers and programming in general and was hoping to find a bit more information on memory mapped input/output and hardware interrupts.
At the moment I have most of the opcodes implemented and about have of them implementated in an assembler. A... |
I need to modify the data members of a class, but since there are a lot of use cases, I would like to put the modifier methods in separate classes to not make the main class too large.
So I'm thinking of making the data members protected, and using derived classes as interfaces to modify the data members for each diffe... |
I've been looking around hoping to get some perspective of the pros and cons of using a Single Page React App vs. a Multi Page React App. The end product of the project is a page with 5 tabs, each having a form within it, with some of them having form dialogs.
We're using React on Rails. My initial thought was to allo... |
I was discussing a project structure of mine with a friend and he pointed out an interesting point about how my architecture seems to introduce complexity and over abstraction into my layers by having "clones" of existing models.
My project structure, overall, is such:
[UIL] ---- Consumption / U.I. Layer (Just for the ... |
When writing tests, why would someone want to use an in-memory database over just mocking the data?
I could see that in-memory databases could be beneficial for testing out one's repositories. But if utilizing a framework (such as Spring Data), testing the repositories would be testing the framework and not really the... |
So I am working on an existing website project that has a BLL layer with some functions that use physical file paths.
But now I am creating a console app that will be setup as a windows scheduled task that will call some of these functions and it is complaining about not having the existing files.
Sounds to me like th... |
I am part of a development team producing a project which requires many rounds of iterative development, each of which must be user tested, frequently in an A/B kind of environment.
In our deployment environment it's not straightforward for us to deploy side by side versions at the moment so I was interested if anyone ... |
Let's say I start developing a role game with characters that attack other characters and that kind of stuff.
Applying TDD, I make some test cases to test the logic inside Character.receiveAttack(Int) method. Something like this:
@Test
fun healthIsReducedWhenCharacterIsAttacked() {
val c = Character(100) //arg is ... |
According to following article Named Constructors The Author suggests using static factory pattern to construct objects is way better than instantinate with new keyword. At the begining the idea is appealing(according to some details in article) yes method names are more obvious and it gives a sense that the constructi... |
Is that okay to share the business logic between a web application and scheduled tasks.
Or should the business logic of the scheduled tasks be separated.
Currently some of the methods of the business logic layer are used only by the scheduled tasks. This seems a little dirty to me taking in consideration the SoC princi... |
I'm evaluating the Kafka. It provides some nice features which I want to use, especially durability be default and the access to past messages for new consumers, whenever the consumer wants to reach something from the past.
I split the communication into three types:
app to server - where I want to use simple messagin... |
Is there a difference between defining a variable in C and assigning a value to a variable in C?
I know that declaring a variable simply means telling the name and its type like int a.
On the other hand defining a variable means telling the compiler its value.
So in my understanding there are the following associations... |
I currently have the following set up where I have 2 or 3 classes implementing IZoneController and I have a set of conditions determining which function they need to execute when called. I first started out defining about 20 classes for each different function, but they were really sparse, and I thought I might be able... |
I have a simple VS project which references DLLs which must be specific to a version of the software I am integrating with and I need to release my project for multiple versions of the software - 2015 & 2016.
So I need to build MyProject2015.DLL and MyProject2016.DLL - let's pretend each must reference Application2015... |
I'm planning on writing a C++ program which is heavily influenced by plugin modules. Initially I had only thought of making the APi available as an abstract class that others extend. After talking to someone they mentioned that I should think about making it available in a language agnostic way.
How do I effectively ex... |
Given that one needs to deal with case sensitive environment, when would one benefit from having all caps or all non-caps names of variables or similar identifiers, as opposed to have camel case? Limit being number of characters being enforced - max 6!
Normally one would not care about the case (machines would sort it... |
I noticed that if I declare a global variable multiple times the compiler does not even output a warning.
However if I declare a local variable in a function multiple times, for example, the gcc compiler outputs an error and does not compile the file. (I ask in terms of gcc, but this is more a general language design q... |
I am trying to learn C++11/14 new features and I am playing with tuple and variadic. I wonder if it is possible to use tuples to return multiple values that are not fixed at compile time.
Something like (not working code):
template <typename... Ts>
std::tuple<Ts...> get(bool f) {
if(f)
return std::make_tup... |
I have the following code in PHP:
abstract class AlgorithmOnArray {
public function runOn($array) {
$this->setup();
foreach ($array as $item) {
$this->processItem();
}
$this->cleanup();
}
public abstract function processItem();
public function cleanup() { ... |
In order to ask this question I need to define a couple of terms to ensure everyone reading it is on the same page:
Unit testing is the testing of a single class with all dependencies mocked / stubbed in some sort of way.
Integration testing, in this context, means integration of a selection of objects within a system... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.