instruction
stringlengths
34
36.1k
To make maintenance and versions tracking easier, I would like to expose the app version of each of the applications I develop on all my environnements. Can the app version and the last deploy datetime of my own application be considered as a sensitive information that should not be public ? Is it professional to do th...
I'm learning DDD. For a practice, I'm trying to convert my own app to DDD aggregates. What I understand so far on aggregate. Aggregate defines transactional boundary Design aggregate as small as possible If there is no invariant to protect, I might not need an aggregate. You need to load everything from an aggregate....
Is there a generally accepted convention for brace placement in F#? I found some examples in the documentation, but they didn't seem to be consistent with each other. In particular, and to take an actual example, is there a consensus as to which is better, this seq { for polarity, a in Set.filter (fun (polarity, _)...
I would like to build an application for sending emails. So I chose ASP.NET Core (API) which will be deployed by Docker. The application will get some request and "do some things" and then sends emails via Google SMTP. There's a Template that already exists ... so the system replaces tabs in the template with real data...
Why runtime ploymorphism is required ? give a real example that "why it came into existence when we have compile time polymorphism??" As mainting the runtime polymorphism requires lot of overhead of maintaining virtual tables and pointers. What are the benefits of "runtime polymorphism" over compile time with a good e...
Having used a lot of scripting languages, it's pretty simple to make a change. No compilation necessary. But now I have an ASP.Net C# application. It's small, so I can learn from it, but how do I make changes when they are small? For example, say I need to add a column to the API. I forgot one. What do I do? The a...
I have software that connects to several marketplace APIs such as Amazon, eBay, Etsy, and so on and imports it into our database. I've written a basic test. The test provides an order number for each marketplace importer. Each importer attempts to import it's order number. The test then asserts if this order exists in ...
We're starting to refactor one of our major products to a more microservices-oriented architecture. Presently we're using the Implementing Domain Driven Design folder structure to organize the source files. However, we're finding that the domain and infrastructure projects aren't doing a good job of organizing each m...
I am designing a web application that is supposed to be an 'entry point' for a few file processing tools. Lets call the main app the 'Connector' and the tools will be 'Tool1', 'Tool2' etc. The tools will be installed on separate servers and expose a REST API (my design). The files should be stored somewhere in a shared...
I had a C (programming language) teacher at the Lowell Institute at MIT who said this in the Spring of 1996. It's an overstatement, but still seems like a classic quote to me. I've had no luck searching for attribution over the years. I don't want to debate the usefulness of IEEE floating point. It is useful and I u...
I have been tasked with writing an on/off control for features in our product based on who is signed in, in principle with one on/off flag for each feature. Put simply, this is a permission based feature access that can be activated at the user level. The problem is that I can see this becoming a complexity nightmare. ...
I'm having a difficult time understanding when device drivers are needed, and when its fine to just talk directly to a port controller via the OS-provided serial/parallel/USB/etc. driver. For instance, Example 1: let's take OpenBCI, an open source hardware BCI that allows you to read EEG + EKG ("brainwave") readings. T...
Why we need compile PyQt rather than simply using 'pip install' to put PyQt to my package repository? What happened during the compiling? Can I compiled PyQt once but allow many Macs through share folder to import it?
To those who may not be aware, Bootstrap is a HTML, CSS and JS framework that can be used as a foundation or starting point in building a website or web application. I'm now in a position where I have an application in production that was designed with version 3 of the framework, but with additional styling that is con...
I'm in the process of writing Doxygen comments for this library of mine; it's a header-mostly C++ library, but it does have some code which gets linked rather than included. For that code, which has .h/.hpp headers - should I also add Doxygen comments in the .cpp file, for the library to be "properly" documented, with ...
Is there anyone seriously using C++ ATL or MFC at work these days? Please describe what kind of projects would require them these days.
I'm currently looking into a way of replacing all foreach loops with for loops in order to see the if I could gain some minor benefits in some legacy code that creates a ton of garbage. The thing is that it would take days to change all by hand in order to measure if the garbage removed would impact the performance in...
I've seen many companies that once used to follow plain old waterfall process claim to have switched to scrum and to be now doing agile development. But their software development process does not differ that much from what it used to be: Marketing/sales come up with an idea for a new feature They pass their ideas and...
We´re on the way to newly develop a WebApplication. We wan´t to make it a ASP.NET MVC app and we thought, that it will be the best approach to start with .NET Core. We started with project type ASP.NET Core WebApplication (.NET Framework). Has someone experiences with .NET Core in production? How is e.g. Entity Framew...
I have a Rails 5 application with Resque as the background job backend. A typical job does quite a few things, mainly it collects stuff from HTTP services, processes and aggregates some of the downloaded data and stores it in the local database via ActiveRecord. The question is, where should this be written? If it is a...
I have a model call Drug class Drug{ String drugId; String name; String strength; } this interface takes a drugId and returns the Drug Model interface IProcessor{ getDrug(String drugId) } // easy flow class ProcessorA extends IProcessor{ protected Drug getDrug(String drugId){ //get Drug from source A return Drug...
I've started to develop an application that allows the user to play notes on instruments. In particular, traditional Balinese instruments. As with many instruments, they have a certain amount of notes within an octave. Now I am completely out of my depth here on how to get started about the musical theory. My initial p...
I would like to compute a numeric value for strings containing only /[a-z0-9]/i (ignore case). Later, I want to use this value for sorting rows. For this post, I am ignoring number also. My thinking was, that I can define an alphabet like 0123456789a...z and compute a sortable value by summing up the indexes of each ch...
I am redesigning a large enterprise web system and a major concern has come across the table. The system allows for many users to Create, Read, Update, and Delete items in the system. This is problem if two or more users are editing the same file or item. What is a good technology or approach to integrate on this? Sev...
I have a simple entity class in my C# application that I would like to add additional properties to for use in the app. These properties will not be persisted to the database. In the past, I was told that the entity should mirror the object as it appears in the database, and that a separate class file should be used...
I'm developing a very complex wizard-style application similar to tax preparation software. The user is guided through many screens, each asking for some piece of data. Different answers lead the user down potentially different paths and there are dozens of screens they will ultimately see. This project started small ...
I have a family of products that currently houses 3 product lines. All 3 product lines share the same 4 options, but on top of those, each product line has 1, 2, or 3 different options respectively, individual to that product line. To illustrate: +---------------------------------------------------+ | Product Family:...
High level: I think my design pattern is flawed. Despite implementing Polymorphism, I find myself relying on large switch statements based on derived Type within my WPF application. As I'm adding more and more classes derived from my abstract base class I can't help but feel like my code it bad.. spaghetti code if you ...
In a development environment where developers are freely given root / admin access to their personal development VM's is there a need to prevent integration testers from having root / admin access in their personal testing VM's? The environment will use continuous integration and continuous deployment and aims to follo...
I'm designing a distributed game server which will support both browser and UE4 clients (hopefully both over HTTP for simplicity) and I keep butting my head against REST and doing semantic backflips to get the logic I want put in place. For some things, REST makes perfect sense - get a list of games, create a new game,...
Background: My team writers back ends, whose job is to receive input, perform calculation and either return the result to the caller or to another server down the line for additional processing. We write in C# and our code runs as Windows services. A few years ago we used to communicate via TCP with other servers (whi...
Background My boss gave me a project he gave up on, it's a CFF/OTF font subsetting + embedding feature. There is no deadline(well, it's more of a research project than a feature request). So I started with sfntly library and extended CFF support to it. I think I'm still in the early stages of the project as I just got ...
Overview I've got 2 systems over a network. The 2nd system produces some results based on the current contents of system A. How can I efficiently produce results in system B if getting the contents of system A takes a long time? Current sitation I've got a system, system A, that keeps customers (personal details, et...
I have a cms with some modules, and now I working on big update for it with new api. And I feel sadness when write updates for every single module. Too many things changed at this time. How can I avoid this in future? There is any recommendations for good api design? Google gives me advices only for making modules with...
I have a program which may accept several dozen arguments. I am questioning whether there is value in testing every possible argument. (In the examples, I don't have the exact syntax for pytest readily in my head. If the imprecise pseudo-Python is causing problems, I can edit to something more correct.) About half of t...
I have designed what I think is a useful, reusable functionality that I'd like to: Implement in C/C++ as an open source library; and then Write different "native binding libraries" for it in various higher-level languages, such that end users writing applications in these languages (Java, Ruby, Python, C#, Haskell, et...
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors. - Tweeted by Jeff Atwood Agreed. All software engineers can understand this. Choosing suitable names for variables can make an enormous difference in the readability of code. Very good programmers have an arsena...
I have a design problem, and no-one to help me thrash it out. Except for you. The system handles data files. Each row can be compared against a number of criteria, chosen by the user. The row is then true or false for that criteria. Each criteria also has a price and a cost (and a margin: price - cost). However, the u...
Hi i have a class like this class MyClass { private ExternalClass1 ex1; private ExternalClass2 ex2; private ExternalClass3 ex3 public String doSomething(String arg1){ val1=ex1.invoke(arg1); val2=ex2.call(val1); result=ex3.doit(val2); return result; } } unit test of this method @Test void doSometing...
I started very recently at a company that uses a rather unusual custom framework for their web applications, at least compared to the typical web application frameworks I know. Instead of a RESTful webservice an RPC mechanism is used to communicate with the server. Communicating with the server looks like a simple fun...
I'm trying to build a 'distributed' data system. My first attempt is built using Entity Framework. Very loosely, it's built around having Element objects, which themselves have a group of Property objects. Much like class objects and their properties. The reason is that any changes to these are synchronized between the...
I am struggling to find solutions to a problem that I encounter in a concurrent system (I am currently using the Actor Model). I basically have a diamond structure of actors: So D sends messages to C and B, which consequently send messages to A. Each part performs some form of operation upon receiving a message. As a...
We're in the process of migrating a monolithic application to microservice architecture. Due to some regulatory requirements, we have to keep client's data from different countries in separate (country specific) databases. I.e US db for US customers, UK db for UK customers... The following designs that we are consideri...
OK... I am attempting to implement a simple MVC windows application... There is a helper class (ConvertPDF) that is instantiated by the Controller. As it is currently implemented, the Converter directly updates the View and the Model. I have an inner feeling that this is just bad form! I have included these two assoc...
I have a Python script launching a C++ executable. The C++ executable is a multithreaded program that usually takes several hours to run. The way the C++ code is written, it will run on all the cores of the CPU if possible. However, when I run the Python script and check my task manager, I read that the Python scri...
I think the main difference between BSD and LGPL is that someone who modifies an LGPL library has to publish his modifications. I think this is usually a good idea because it guarantees that someone who uses my library is forced to contribute his improvements. I usually write code in Python and most of the libraries th...
I'm developing an application where users can create certain business objects (for simplicity let's just call them 'objects') that are stored in table in a relational database (the column names are trivial: id(int, primary key), name(varchar), type(varchar), and a few others that are not that relevant). The operation a...
I have noticed a pattern when I refactor my code for readability. When I refactor a method into several smaller methods, I often have to introduce parameters which sometimes (too often) makes the code less readable than before. I am wondering if this indicates that I should refactor to a different class, instead of jus...
Consider the following: #include <iostream> class Base { public: void go(){this->doSomething();} protected: virtual void doSomething(){std::cout << "base";} }; class DerivedA : public Base { protected: void doSomething() override {std::cout << "a";} }; class DerivedB : public Ba...
I already got the idea that string variables are immutable, so the they are copied to another place in heap every time we make a change, and since GarbageCollector has to collect them all the time, it causes performance issues.. Question is: Integers or doubles are immutable too. Are they also copied any time we mak...
There is a moment when you begin to understand that, in micro service architecture, it is more scary to wait a week to deploy all micro services at once to make sure that everything works together, than to strictly enforce api versioning, write lots of automatic tests (a bit of each: unit and exploratory, integration),...
I am learning React / Redux, and one feature I like is, when you fire off an Action, you actually provide a request as the "result" or what is called the payload in Redux, and the Redux middleware won't pass this Action to the reducers to compose the final application states. Instead, it will wait for the request, whic...
We are trying to work through an effective branching strategy for our organization so releases, versioning and such are all handled consistently. We have many C#-based solutions, each with anywhere from 2-60 projects. Each solution relates to a particular product for which we release updates on a regular basis. These p...
My question is which method below of defining variables is a cleaner way to code and why? Option 1: file_one=/path/to/file1 file_two=/path/to/file2 if condition cd(file_one) else cd(file_two) Option 2: if condition file=/path/to/file1 cd(file) else file=/path/to/file2 cd(file)
This is more about architecture question. I will be developing microservice in Lumen or Slim, it will not be accessible from the public. The private microservice will be dealing private stuff. Laravel backend will communicate with microservice via REST API (Private / Internal use only). Users will know nothing about m...
So I have an application that utilizes 14 different libraries. It's been a while since I have updated this application and one or more of the libraries involved have since experienced a major revision (using semantic versioning). That being said, I have just updated the application to utilize all of the newest versions...
I know function names can be very expressive. And therefore it can be tempting split up a program into particular functions and call them from a large "oversee-able" functions file. However is this actually effective for a programmer? Since each function usually relies on some input provided from a previous function, ...
I've seen this syntax in many places, such as when using javscript, thymeleaf(spring), properties files etc. //ex; in properties file. Where are the values coming from? ${someText} ${set.config.username} What is ${} actually called? I am trying to do research on understanding where the values are coming from when i...
We have many siloed legacy multipage applications. For example, a personal information collection application may contain four or five HTML4 form based applications. The backend is based on Spring MVC and there is no javascript on the front. For example, a user may enter the name information on one screen and click ...
If the question title was a little too vague or confusing, I'm talking about something reminiscent of the Mindstorms NXT/EV3 IDEs. But the code editor, instead of having prefabbed generic blocks to work with, would use just boxes with code inside of them that links to other code. I'm interested how this implementation ...
A common way to implement "PIMPL" in C is to do this: typedef struct _Opaque Opaque; Opaque* createOpaque(); void doSomething(Opaque *opaque); Or: typedef struct _Opaque* Opaque; Opaque createOpaque(); void doSomething(Opaque opaque); The first requires that the caller treates Opaque as a pointer, the second requir...
I am new to unit testing. Started working on unit test using PHPUnit. But it seems to be taking too much time. If consider I take 3 hours to write a Class, its taking my 7 hours to write test case for it. There are a few factors behind it. As I told, I am new to this stuff, so have to do lot of R&D. Sometimes I get co...
I'm currently working on a .xml to .uml diagram converter, but you may also add relations/attributes/operations and change pretty much everything. but drawing multiple arrows between 2 classes would cause one to override the other one pretty much, i guess that's not the intention Is that allowed by UML? Because i can n...
I am learning Redux (a JavaScript state container tool). I am finding numerous references to something called a "selector" (e.g. here, here, here, and here). However, I don't seem to be finding a simple definition of what a selector is (as opposed to, say, examples of selectors or details about some aspect of selector ...
I've been working on a UTF-8 iterator adapter. By which, I mean an adapter that turns an iterator to a char or unsigned char sequence into an iterator to a char32_t sequence. My work here was inspired by this iterator I found online. However, as I looked through the standard when I was beginning my own implementation, ...
I've recently become incredibly confused about the notion of "strengthening/weakening a precondition/postcondition". I think my confusion lies in my interpretation of the words "precondition" and "postcondition". Here is why I'm confused: In the rules of Hoare Logic, one can "strengthen the precondition and/or weaken t...
For context, I am running a REST API built with Node.js. Because of callbacks and some complex DB calls, I have a chain of functions that are async but also unique, so it's tough to reduce redundancy. I came up with the idea to call my own endpoints (different endpoints) from within the code itself so I can reduce redu...
I have a parent object, with multiple child objects. Every child object is of the same type and has a "ChildMethod" that contains some child specific logic. If the ChildMethod is called on any child, i want to serialize the state of all children. I put that logic into the parent object. Also I implemented it with the o...
I am writing a tool that will give users the ability to summarize text content on a webpage, by highlighting the text that they wish to get summarized. So far, I've received results that I can work with in order to further optimize the algorithm, but only when applied to single paragraphs. When multiple paragraphs are ...
This is sort of like the chicken and egg problem. In order to ensure that my arbitrary precision code works correctly, I need to rely on other, existing bignum implementations. This is relatively easy in Java. We already have the java.math package to help in this situation. So far, I've used it to test my basic arithme...
I have an API which is basically comprised of two parts: 1. A TensorFlow neural net that provides predictions based on input image (mainly GPU computations) and 2. Post processing on those predictions (mainly CPU) This is kind of a best practices/recommendation question. What I am wondering is if these two sections of ...
I am trying to build an extended CRM, using OpenSource PHP-Software. What I have for now are 3 separated systems, that all work well independent from one another. I would like to combine them. The System will have a public and a Private (Internal use only) parts. The Public part is not included in this diagram, but wil...
The way I created my rest api is the following: /api/users/{id} /api/users/{id}/items/{itemId} But I also have URIs like this one: /api/items/{itemId} It's a bit confusing to me how to handle the item authorization in this case. I don't want to send every request for a resource to the /api/users/{id}/items/{itemId} U...
I understand that there is a thread discussing a similar issue here: How to efficiently search a set of vectors for a vector which is the closest match But my problem is slightly different - and hopefully easier. Given a set of vectors of the same dimension, e.g., [2, 3, 5, 9] [12, 9, 2, 8] [45, 1, 0, 1] And a query ve...
Let's say we have a full-text database. The reasonable thing to do, for scalability, is to store only an index but not the content of documents. The issue I'm facing is: I would like to deliver highlighted preview of the content when listing search results for a given query (just like Google does), but I find hard to c...
I am a C++ newbie, and I'd basically like to know how to set things up to run unit tests as fast as possible, which I think is pretty equivalent in my case to compiling as fast as possible, without regard for anything else. So if there's practices to avoid, frameworks that are faster or slower, or compiler flags I want...
We have an API server, which serves both of our web app and mobile app (both Android, IOS). We have to shut down database servers sometimes for up-gradation or maintenance, so the site shows Maintenance in Progress kind of page. It works for the web app, but what to do about the mobile app? We can't show any kind of ma...
I am currently running a team of 5 VB.Net developers and have decided to make a switch to C#. The team builds and maintains around 20 different applications that run our whole platform, so the code-base is fairly moderately sized. There are several factors for making the switch, but the biggest is to overcome recruitme...
I know the purpose of it and everything. I see myself as a solo developer for a couple more years. I always see answers that it is contract. Yes I get it. But here's something on my mind: If a class did not provide what an Interface wants, it'll throw an error. Well, if a class really needs that method, it'll throw an ...
If one needs different JVMs for different architectures I can't figure out what is the logic behind introducing this concept. In other languages we need different compilers for different machines, but in Java we require different JVMs so what is the logic behind introducing the concept of a JVM or this extra step??
Say, a repository licensed under BSD-2 license has been forked on GitHub. A major refactoring is happening and new features are going to be added. No interactions with the original repository is expected in the future. What should/could happen with the original author's name present in the source code? Should the fork ...
A common pattern I use on my nontrivial programs is to have a class that parses out a config file (usually YAML), and makes the items in the values in the config available as properties on the class. I then import this class elsewhere in my program anytime I need to refer to the user-provided configuration #config.yml ...
Context: I am using C# I designed a class, and in order to isolate it, and make unit testing easier, I am passing in all its dependencies; it does no object instantiation internally. However, instead of referencing interfaces to get the data it needs, I have it referencing general purpose Funcs returning the data/behav...
If I were to write a security application and sell it or "opensource" it, how would I avoid writing the same code coincidentally if I cannot review source code of other programs out there? (and replace matching code) I understand citing source can prevent plagiarism, but even then, how would a company know without acce...
There's a pattern for RPC or distributed computation I've seen a couple times and I'd like to know if there is a standard name for it so that I can communicate it more effectively. I'm describing it using Java terminology, but I don't think it's Java-specific. To submit a job or RPC call, the calling code creates an i...
I want a non-primary key column to be unique. This is enforced with a unique constraint. In a service endpoint I want to return a nice error message structured into a {field, messsage} object when unique constraints are violated. Currently I check if the column is unique in the service layer and throw a UniqueFieldExce...
Just wondering if there is a good way to do this? Currently i'm performing the method calls as if they were happening prior to the conditional block, then comparing what would be the result in "[isDoable == true]" with isDoable being the result of the long chained method call. An example of the method call contained wi...
I need to store two 32-bit numbers in a way that is quickly accessible and as storage space efficient as possible. My keys are a combination of the following two values: port: 0 - 29 vlan: 1 - 4095 struct Dat_s{ int id; int val; } Dat_t; Also I need to pre-allocate all the storage that could be taken up in a ...
I have a matrix of values that is anywhere from a few dozen to a few hundred rows and columns (always square). I have a series of tasks that need to be performed on the matrix. (I'm using the Hungarian Algorithm.) Because they may take a long time, I'm doing the work on different threads to keep the UI from getting loc...
I'm currently working on a project where i am the only developer, but it should be delivered soon to "customers". Since this is actually an application consisting of multiple libraries for physicists laboratories, the boundaries between developers and customers blur or disappear - my colleagues in the labs are familiar...
I have an application service which returns entity by its registration number public Entity FindByRegNumber(string number) { if (!RegNumber.IsValid(number)) { return null; } var regNumber = new RegNumber(regNumber); return repository.FindBy(regNumber); } Here RegNumber is a value object an...
It got my by surprise yesterday than ordinal indicators are considered letters. I thought letters were only [a-zA-Z]. Why are they considered letters and not symbols? char.IsLetter('º'); // true char.IsLetter('ª'); // true char.IsLetter('°'); // false char.IsLetter('ᵗ'); // true Is there any flag I ca...
I know the differences between these associations (as described here). However I'm wondering: Composition, why not simply use an association with multiplicity of 1..* (and thus implicit saying that the target class has to exist). Aggregation, actually using multiplicity here too Or am I wrong here and do these associ...
Over on StackOverflow I found myself recommending the following pattern. I see it used fairly often in production but I don't remember having seen any articles or blog posts discussing its use. The gist is that you provide an overridable implementation method which does not form part of the public API. The public-faci...
In the Ruby on Rails communication, it is often said that RoR is "convention over configuration". Can you say for React / Redux / Flux and AngularJS, Angular2, they are also "convention over configuration"? Some details: the reason is, engineers probably do things in quite standard, or convention ways, such as // in i...
I used Angular 1 and React / Redux, and one thing I like about React / Redux is that there is a definite app state, and a middleware that can convert a promise into real data. In Angular 1, we often said, either have some sort of data in the top most controller, or in a parent controller, or by a service object, and pe...
I'm in a situation where a part of my application depends on a website which I have no control over. The website might change unexpectedly and without warning, and the changes may or may not break a part in my application. When that happens, I always have to figure out what changed and how I need to change my applicati...
I am often in the following situation: I have a config file, specifying the path to a resource file This config file gets parsed and the values (e.g., file path) are stored in a ConfigStore object A business logic object needs to content of the resource file. Now who should actually read the resource file? Config...
One of the last projects I worked on had a lot of deprecated methods. Are there any good strategies for making sure that the use of these methods actually decreases over time? The example below is Python-specific, but this question really applies to all languages. I've read a little bit in the past about adopting infor...
First Software Engineering question, so I hope I'm on topic. I'm an academic scientist working on on Python GUI applications for educational (and eventually research) use. The GUI uses PyQt and pyqtgraph to plot the results of calculations derived from user inputs. I've put a prototype for the first app on GitHub. In a...