instruction
stringlengths
34
36.1k
We are receiving realtime data from over a 1000 sensors, each of which sends a data point every 10 seconds in average, which is amounting to about 1 million rows of data every day. Our system gives users the ability to select any sensor and a date range and download the data points as an Excel file. We have seen that o...
How should necessary data that is stored in the database be referenced throughout code? Is it better to reference a numeric, auto-incrementing ID, or a unique alphanumeric key/name, etc.? For example: Determining page display based upon a specific setting/value from, say, a Settings database table Retrieving a maximum...
I'm currently getting into BDD/Cucumber and I ask myself: On which levels is it good to use? There are the test levels (from the testing pyramid): User Interface Integration Unit You can apply tests on various levels and fields in the application architecture: Presentation layer Rules (how are business rules refle...
This often happens in my projects. Sometime I have this part of code that is very similar to this other part, yet a few lines makes it complicated to keep the code clean and without duplication. Here is an example of a recent project. I am working on a program which can do 2 things : A will generate an image projected ...
The specific example in mind is a list of filenames and their sizes. I can't decide whether each item in the list should be of the form {"filename": "blabla", "size": 123}, or just ("blabla", 123). A dictionary seems more logical to me because to access the size, for example, file["size"] is more explanatory than file[...
I had an unusual, brief conversation with a very senior architect about dynamic and static languages. He said that company data shows that there is evidence for higher productivity when static languages are used. Note, it's a large company with long history. To my (and others) surprise, the metric he used was lines of ...
I'd like to make my logs more useful. Currently they mostly contain such common columns as: timestamp, logger-name, log-level, message, exception. They are unsearchable and unparsable and writing messages and adding some data to them is not actually helping. Consequently when something goes wrong I'm not able to easily...
I have been reading about consumer-driven contract testing with frameworks such as Pact. The concepts are clear when talking about testing between two services that communication via HTTP. We have Service A (our consumer): Write a test that states when we POST {'foo': 'bar'} to Service B, Service B responds with a 2...
I use Memcache to store content lists with very key combinations, when user edited the content, I must refresh the cache, but it is hard to say what particular list to refresh, it is not either a good idea to flush the entire Memcache server, so my question is: Can I group the Memcache keys so that I can flush a group ...
I have a web application (laravel) with a page which presents a large number of rows (financial transactions) in a HTML table. On each row I want to have a drop-down (select input) allowing the user to assign a category to the transaction. What is the best approach for allowing the user to select/assign these categorie...
I have an odd, intermittent bug that is happening on a web server. One of the methods triggers the creation of a small file (3kb), in a folder. The folder is based on the current year, month and location id. The file is created by a 3rd party component that I have no control over, other than by calling its CreateImage(...
Say I have a database structure like this: CREATE table Customer (id identity, name varchar(30), dateofbirth datetime, Photo varbinary, primary key (id)) CREATE table Order (id int, Date datetime, Primary Key (id)) create table CustomerOrder (CustomerID, OrderID) Say I wanted to copy the database into DynamoDB for C...
Every description I have read about god classes considers them to be an anti-pattern and a bad practice. Most descriptions I have read about mixins considers them to be acceptable in some cases. If the functionality of a god class is broken up into several mixins, each mixin can be separately unit tested and separation...
I'm watching a talk on Vert.x (not in English) and they say that "the whole architecture needs to be asynchronous from beginning to end", and cites as an example of what not to do putting an Apache httpd server in front of the Vert.x application, then explains that using Nginx would be a better idea. I understand that ...
I asked this question recently: Using Aggregation and Association I accepted the answer, however I am confused by the answers response. The answerer talks about deleting database records. However, I am talking about the domain model, not the database. Say I have a many to many relationship in the database like this: ...
I am designing some software that will be delivered to a customer with some limited areas that they can customize using the same platform and compiler (Windows 10, Visual Studio 2017). My goal is to allow them to inherit from a class and generate data from their own proprietary source and pass it to the main system. I...
Background: I was working on a personal project to create an Task Checklist Web App. I worked on the code with vanilla golang and javascript. It is a very simple app with limited capability. I've used a json-rpc like endpoints for the application. Code and Implementations: Endpoints: /getTsk GET /addTsk POST /delTsk ...
Say I have a many to many relationship in the database like this: CREATE TABLE Person (ID int, name varchar(100), dateofbirth datetime, Gender char(1), primary key (ID)) CREATE TABLE Sport (ID int, description varchar(30), primary key (ID)) CREATE TABLE PersonCanPlaySport (Person ID int references Person(ID), SportID i...
We have multiple layered architecture UI --> Application Layer --> Business Layer --> DB There is a third party services that we are communicating with. If Business layer communicates to Third party service, then it has the advantage of making our Application layer light weight and at the same time there is data passi...
Even though I could write something like this (In C#. There are, of course, equivalents in other languages): public int SomeNumber { private get; set; } I have never encountered something like this. Is there any particular reason? Edit: The question has been suggested as duplicated of Private setters and getters. The...
I've inherited an application that has a suite of tests that drive me batty. But one of the design decisions that this test suite takes that completely leaves me scratching my head is the separation of tests and their expectations into separate files. To explain, there are functional tests that have test methods with d...
I’m working on a system where several resources are scheduled (users, rooms, and equipment). Each appointment is scheduled for a user, and may also take a room and/or equipment. Appointments are scheduled over time, slowly filling up the calendar. It’s thus not a classic scheduling problem where everything can be sched...
I work on two code bases that are related, but independent. One is written in PHP, the other is Node JS. Currently, they are in a single repository. The repo is deployed to Heroku for the Node code, and a different hosting provider for the PHP code. I didn't set up the repo, but I now maintain the applications. Is ther...
I have a new-employee form. When the "Save" button is pressed, a SavingRequested event is raised. The Presenter gets an Employee object from the View and passes it to the Model for further processing. Should the Employee object created by the View be passed to the Presenter via the event arguments: public event EventHa...
Scenario. ViewModel has a property State. View has a ComboBox that allows to change value of State. ViewModel needs to run some validation (call bool ValidateState(State value) method) before setting value of State property. Question. How would you implement it? My concerns. I want my solution to be generic so I cou...
I have written a class to represent 'Treeview-like' data, which can be simplified as: public class Item { public string Name { get; set; } public KPI AssociatedKPI { get; set; } public List<Item> Children { get; set; } } To each 'branch' of the Tree, can be associated a KPI, which can be simplified as: pub...
I am using C# on a pretty huge solution that user a Static Class to manage the Session on the database. The performance are not so good because of the number of call to the database. The company decide to introduce Redis as a very fast alternative. Of course it is so fast! But now I have to design a service that will r...
Let's say I have a form for representing a user. When pressing the "Save" button, should a User object be: constructed by the View based on the input, then passed to the Model via the Presenter and then inserted into the database by the Model, constructed by the Model by using the View data (via the Presenter) and the...
I am building a webapp (Angular frontend, Groovy/Spring/Hibernate/MySQL backend) that will allow users to compete against each other over certain activities. Each activity will have 1 winner and 1 loser. I want a live user ranking system that ranks users (1st to last place) depending on their win/loss record/history. T...
I'm currently working on a project in which we're required to define a Entity Relationship Diagram and a UML Class Diagram from a set system. I've successfully managed to define the ERD. It required me to break down information from a specification and form them into entities and then define a relationship between the ...
I'm developing an Android application where they want to have track multiple patient's vitals (current HR, SPO2, Respiration, etc.) in real-time with each patient having a large form that represents their documentation. They want this to be sent over a peer-to-peer UDP network, so that other people can edit the same do...
The GNU Assembler as uses different characters depending on the architecture to specify single-line comments, such as # on x86, ; on 29k, or @ on ARM. Moreover, regardless of platform, C-style comments are also supported (/* */). Is there a technical reason for different comment styles on different architecture? The ...
I would like to write an application something like ecommerce. And you know that in similar applications products could have different properties and features. To simulate such an opportunity I've created the following domain model entities: Category - this is something like "electronics > сomputers" i.e types of produ...
I need to make a time profiling for several modules in Fortran, which means, that I'm supposed to write the same code in every beginning and every end of every function. Really, it looks like this: #ifdef TIME_PROFILING real :: t1, t2 !< Variables used for time storage call cpu_time(t1) #endif ...
Gnuplot seems to be one of the rare applications with the level of perfection in rendering graphics (will be glad to know if any competitor exists to this level). My question is related to the license restrictions of this dependency if I want to use it in my computational applications. I am not well-versed with license...
I was tasked to automate reports used by multiple teams. Each team have their own procedure on how to generate the report that they need to deliver. I can automate the reports but it takes so much time since I need to study each of their procedures and then test them. The issue occurs when a team needs to update a pro...
I have a microservice(Microservice A) which connects to a Client MQ and recieves messages and persists into the database.(Synchronous type MessageA after Message B for the same order). Internally i have n microservices each handling a particular type of message based on some message parameters. All the microservices ar...
Problem Statement I'm writing a C# console program that takes binary data coming in through Serial COM1, converting each byte into ASCII hex, and then outputting those HEX characters out through Serial COM2. I would like this program to run in the command shell continuously but also exit gracefully (so that system reso...
I am a bit confused by the MSDN C# documentation which states that & and | are logical operators and that && and || are conditional operators. I keep calling &&, || and ! logical operators, so I am wrong?
I'm building a ASP.NET MVC Core App. I would like to add 2 new features: A new area for Admins and An Web-API for restful services. I was wondering if the Web-API and the Admin area should be new "ASP.NET MVC Areas" in the same project or should I create a new project for the API and the Admin. What criteria shoul...
I have an interesting problem that I'd like to solve. Let's say I have 2 deployments, US Data Center and Europe Data Center each containing Web Servers and a Redis Instance (replicated, but could eventually grow into its own cluster using TWEMPROXY). We have a Load balancer that identifies the closest available Data Ce...
I constantly struggling to solve data duplication problems efficiently (storing data from any source to RDBMSes). My main concern is speeding up inserts/batch processing. Scenario: I read data from different sources, mainly in json format and I need to process them in way (input: nosql documents), where I only store di...
I wrote some code in the past for 8bit MCUs, realizing that every time I gained experience, the next iteration will be with a wrapper API or something more distant from the "bare metal" register access. I also end up a bit in working environments, learning the company philosophy behind a certain code style. But I saw w...
In this series of blog posts, Eric Lippert describes a problem in object-oriented design using wizards and warriors as examples, where: abstract class Weapon { } sealed class Staff : Weapon { } sealed class Sword : Weapon { } abstract class Player { public Weapon Weapon { get; set; } } sealed class Wizard : Player...
According to Jez Humble, Continuous Delivery involves "ensuring our code is always in a deployable state" [1], and according to Humble's Thoughtworks colleage Martin Fowler "the key test is that a business sponsor could request that the current development version of the software can be deployed into production at a mo...
I am trying to search for a framework or library or even techniques for handling N-Tier Client/Server communications. I am scaling my application software and I am seeing this communication becoming more and more cumbersome. I have an application server, but I also have middle servers for scaling the capacity of connec...
I am building a simple master-details GUI using WPF/MVVM/Prism for some data coming from a Restful service. I have the main window as my main view with a corresponding view model. I have a user control to show the master data and it's got its own view model as well. I have added an instance of the master data view mode...
We have a background job(java batch) which listens/reads from an MQ and persists a message onto the database(local table). Then a trigger sends this message into a queuing table in WAITING status. My polling program (multithreaded in java) continuous polls for WAITING records, picks them up and sends them to the prope...
Background information I am building a program that plays checkers as good as possible. It already plays pretty well but the goal is to improve it even more. This can be done by adding new methods to evaluate how "good" a certain board-state is. I've already implemented these methods but each of the methods has a param...
In the last few months I spent a lot of time arguing about the role of technical considerations when developing user stories. In my point of view, a lot of stories are not really debatable without understanding and respecting the technical boundaries the solutions is developed in. Other people point out, that we should...
I'm developing a REST Api using Node.js & Express.js. Recently I've started looking towards best practices for REST Api design but it's bit confusing so please bear with me. For Example: Lets say I have the following API Collections: Users Tasks (every task must belong to a User) And Have these resources: GET /api/u...
Given this abstract class: public abstract class File { public abstract string Name { get; set; } public abstract void Add(File newFile); } The basis of a composite can be generated: public class LogFile : File { private string _name; public override string Name { g...
Let's say we have a web application where the users can login and have a status (available, not available). There is server application that has to know the users status. This can be synchronised by sending a message from the webapp when the user status changes. The question is how to get efficiently all the users (a ...
I'm facing some issues related to code duplication when following MVP architectural pattern in an Android project that I'm working with. My project structure is separated by packages: data, domain, infra, ui. Inside ui package there are another packages for each screen of the app. Most of them contains this structure: ...
REST APIs can be exposed using an API Gateway and is considered to be a good practice. (at least when they are exposed to internet) However there are a lot of microservices inside an enterprise which are not exposed outside and they are used to communicate with each other. Wonder what are your experiences in terms of m...
A user uploads a CSV to the server to be inserted into the database and I would like to return a meaningful response to this user. My thoughts : { inserted : x records discarded : y records } I believe also that I should specify what records were discarded because of the inconsistent format / missing values. Pro...
I am trying to find an efficient technique to differentiate between seen and unseen content per user. I have a table of specific files, but need to keep track of the user who accessed them and then display a notification if new files or content has been added. I have considered creating a table that just keeps a membe...
What is a good diagrammatic way to represent asynchronous event communication between two systems (the pub sub model)? I am not looking for tools but more of a representation. Is it a sequence diagram, a swim lane diagram or some other?
Consider a distributed system S that consists of several processing nodes (N1, N2, N3, ...) and spans the geographical boundaries. S -> {N1, N2, N3, N4 ...} N is more than 1000. now consider that each node maintains its own cache for storage. Whatever enters system is processed and output is returned while any infor...
Recently, I asked about my difficulties in finding the boundaries of aggregates here and I recently reinterpreted it and rid it of business features and now it sounds like this: In many sources, examples are given of the allocation of aggregates. Most often in these examples of one aggregate one or more important behav...
Summary Our development/support team creates applications for company employees (invoicing, task management and the likes). We have a recurring issue where users misuse the applications they're provided, using workarounds, stepping outside of business process boundaries, leaving data or automated processes in poor sta...
I'm looking through some legacy code and I've come across a case where the developer has 'extended' an existing class with additional members, using inheritance as his weapon of choice. Essentially it reduces to something like this: struct A { int something_old; }; struct B : public A { int something_new; }; ...
Background I am working on improving the backend design for a video game. The game is live and working fine, but we want to improve various things. As a video game studio, we often do events which sometimes need tinkering with whilst the event is live - we would love to be able to do these changes seamlessly without ha...
I have a use case where I have a Bi-Partite Graph. Call one type of nodes "Type A" and the other "Type B." Now when a Type A node gets added, it forms some edges based on a criterion with Type B nodes (usually how many existing edges does the Type B node have?). Type A nodes are being added consistently (say with every...
I am doing some data scraping from websites, its quite a fairly simple task, getting data from some columns, however, those columns can be empty, strings, or numbers inter-mixed in one single column. Now my question is, what is the best strategy to bring that "dirty" data in a consistent way into a table or database sc...
I've been using firebase database and now firestore for a while. I'm prob an intermediate level programmer and still at uni. I'm still a bit unsure re: the best way to handle calls that are occurring async to firebase database and updating the UI. I've previously used delegates to do this but I was wondering whether GC...
I'm learning ASP.NET Core 2, with Entity Framework Core. A real use-case scenario is a small management of a production process. I have some persistent table like customers, orders, machines, etc... but I also have some "live" tables. Example: the current status of the machines. This information is valid only at the pr...
Let's consider I have an std::string instance filled with textual data and an std::set<std::string> instance with keywords. I would like to know whether the text stored inside the std::string contains all keywords from std::set<std::string>. To achieve this I considered two possible implementations: Returning true or f...
Recently, I worked on an Android project with Kotlin. As an architecture, there were immutable data classes and functions (not methods which are members of a class), where the functions generate new immutable data objects from other immutable data objects. And it felt like the scope of unit tests was reduced to those f...
I encountered in a book some explanation how self referential tables in SQLAlchemy (Python) work, as an example, here is the class Employee with a manager_id: class Employee(Base): __tablename__ = 'employees' id = Column(Integer(), primary_key=True) manager_id = Column(Integer(), ForeignKey('employees.id'))...
Hello Software engineers, So I'm a programmer. Not an "engineer". When I do OOP, I mostly create classes and interfaces the way I want. I do not follow any design patterns... BUT now, not only I want to get better but also I need to write a software that won't be maintained by me... I read in this book a method to orga...
I know that the rule in maths for modulus is this: ab mod n =(a mod n ) (b mod n) mod n I have found the following code for computing the modular exponentiation: pow(base,exponent,modulus){ if (exponent==0) return 1; else { newexp=pow((base*base)%modulus,exponent/2,modulus) if (exponent%2 != 0){ return (bas...
Cheers guys, I am quite new to C++, however, I have some years of experience in programming and I am open for challenges :-) Currently, I am designing a "small" scientific program to perform some physical simulations. With respect to the basis of my problem, I will simplify some of the program architecture aspects. I r...
I'm developing an app for the 2nd time but it's the first time i'm using third party libraries in my application. One of the libraries seems to have an MIT license and the other is the android support library. My main question is practical: How shall I include each library's license text into my application? I'd ...
I have a collection that I'm putting elements into based on some sort of input. About 90% of the time, there will be only one element in this collection. There may be more elements, but each element past the first has an exponentially decreasing chance of appearing. So it might have 2 elements 9% of the time, 3 elem...
In order to fix a bug in an application, I modified a method named postLogin by adding a call to an existing method named getShoppingCart. Code protected void postLogin() { getShoppingCart(); } However, I'm not sure what the best way to write a unit test for postLogin is. Approach 1 Use verify from Mockito to ...
When we design the whole system we have few architecture pattern to select from. One of them is the layered architecture pattern, This pattern seems to be generic enough to fit in all other architecture patterns but with different scale. For example if we choose Microservice architecture, each service still need it i...
I work for a finance startup managing the technical stuff. The COO decided to create a new web site using a contract developer and the owner of the company paid for it ($9k). I'm asked to use the new site (Joomla + plenty of custom PHP code), but it appears to be of very low quality and insecure. For example: It doesn...
I want to create a media management tool, for which I try to draw an appropriate UML class diagram. The tool shall hold a collection of different media types (movies, music, etc.) which inherit from a basic medium class. Each medium has different attributes in addition (e.g. interpreter, director,...). I plan to fetch ...
IDLs like Protobuf, flatbuffers, Cap'n Proto or Thrift allow communication over standardised interfaces between otherwise independent projects. Most often, these projects will be developed in separate repositories, and while they all require the files generated from the interface definitions, none of them are the clear...
I have been into web development with both client amd server side code, and have been using JavaScript Ajaxto receive and manipulate for data along with PHP scripts. However, I noticed that websites like Google and Facebook use PHP forms instead of sending ajax requeststo PHP scripts. What I wonder is that what is t...
I am working on a server application that should handle many requests. There is one thread per each request and each request has a Database operation. Creating connection for each request and doing the DB operation will waste time. I/O operations on each thread may cause many context-switches that will waste time too I...
I started out with the following, simple routine: void originalCode(){ boolean status = getStatus(); function2(status); if(status){ return; } function3(); } But then, additional functionality required calling function1 on the status == true path. It was also important to call functi...
I have read about Persistence Ignorance principle, The ebook give some examples of violations of this principle, but I don't understand. Could you please help me to give some explain? Some examples of violations of this principle include: • A required base class • A required interface implementation • Classes responsib...
For example, i have made a software for someone. Regularly, i will update my application sometime for fixing bug reason, adding some function, or remove some function, etc. After that, i will list what i changed so far for my application and added that to my changelog list. First, i will named my application as "Appli...
I am wondering how transactions with web services are achieved. Let's take an online store for example that needs to deal with 3 services: Inventory management SaaS Delivery management Saas Payment gateway The above services expose their services via REST APIs How would one achieve something similar to database trans...
I am evaluating frameworks and I would like to understand Django's architecture better. Coming form a Java background I developed components separately namely front and backend. More concretely for my backend I use Dropwizard and start a HTTP server. For the front end I use a nginx webserver with some forwarding to ...
I'm used to program Desktop applications and old School (without web Services) web pages. Now after reading up on web Services and also wcf I'm unsure about the area of usage for web Services. The Situation is so, that I have a couple hundred Clients in an external Network who try to Access the Server by sending Status...
Given an onion architecture, what are the advantages and disadvantages of throwing exceptions in the business logic (which is in the center of the onion) for invalid parameters provided by the user? The alternative would be error codes. I do have arguments for both approaches, exceptions vs. error codes, however I find...
I apologise in advance if this question seems obvious to some or whether this question should not even be asked. I have done research about the build process and I do understand the purpose of building for Java, C++, and others because of compiling and generating an executable code. I also understand that build isn't ...
I have a legacy system I need to plan a migration for. It's mainly developed in Ingres+4GL (an old Ingres based form system). I have the following information: Data Structures (data base relations and their relationships) All programs accessing the underlying Ingres Data Structure I coded a parser for Ingres and 4GL...
Please see the code below: public class Customer { private readonly IList<Order> _orders = new List<Order>(); public string FirstName { get; set; } public string LastName { get; set; } public string Province { get; set; } public IEnumerable<Order> Orders { get { return...
About methodology Scrum, specifically during the period of Sprint, is it correct to say that: The scope can be clarified and renegotiated between the product owner and the development team during the sprint. Yes or No? Why?
I'm debating whether or not to start using CSS variables. They're wonderful gifts from heaven ... except that Internet Explorer does not support them and never will. According to Net Market Share IE still (and inexplicably) represents about a third of browsers. At what point is it safe to assume that old browsers can ...
We have turnkey software that we release to clients. We set up a set of servers to run the server SaaS portion, and for many clients, we set up terminals that allow agents to place orders for customers. The terminal software is a ClickOnce app that runs on the client terminals. One group of these clients have ever-so-s...
I wonder if there are well accepted/standardized types of diagrams to describe the architecture of a software implementation, for example, a Clean Architecture. By software architecture, I mean a set of defined modules using high-level abstractions without including any libraries, frameworks, or databases. So far, I ha...
I just stumbled upon an article by Lucas Majerowicz titled "Add git-like functionality to your application using Event Sourcing". In it, he describes using Event Sourcing with events stored as nodes in a graph database (he uses Neo4j). In so doing, it becomes trivial to branch the event store from arbitrary events in ...
At work the Team Foundation Server (TFS) admins have created two separate TFS environments. One called Devl01 and the other Prod01. Is there even a remotely legitimate reason for doing this and in what sense? Just to be clear, I can get to the two different environments in this fashion: For 'Development': http://tfs:8...
I am trying to figure what the best practice with loading data from web apis is. Assume you have a model structure as per below: class School { private string name; private List<Classroom> Rooms; } class Classroom { private string Type; private School school; private List<Student> Students; } class Student { private ...
I am playing around the state machine concept trying to better understand the best areas of their application. The formal definition of an FSM contains the following elements: finite non-empty set of allowed states; an initial state; an alphabet ("allowed input symbols"); state-transition function; and a set of final ...