instruction
stringlengths
34
36.1k
I have recently started working on a complex project and recently had a team meeting where a new feature was discussed. I am not happy with the current architecture, because the system is undocumented. However, I have to prove myself in coming months and, hence, continue delivering. To prove my point that documenting h...
I have an XML file that contains configuration information for a system. I can serialize/deserialize the XML into a hierarchy of objects that describe the configuration (and no more) and then pass those objects to a task which performs work based on the data in the objects. What I want to do is to build a specializ...
I am given a project where the previous developer used <? and <?= whereas I am using <?php and <?php echo. My questions: - should I rewrite all files _ or just when i need to tweak the code - with new files/code should i use my pratice or copy the existing pratice I am hoping this is the right subdivision of stackexch...
I have developed a login system using OAuth2.0 that is currently working within one tab in one browser. Without diving into the code, the system works by having the user enter their credentials to login, the credentials are sent up to the API (WebAPI2 .Net) from the client (Angular), the user is logged in via Active Di...
I'm developing an APP that has a API and a database that holds user permissions and user projects, among other things. Certain stored procedures must be protected, and for that I have to check the scopes available for the user. Should I check the user permissions inside the stored procedures (calling a second proc or f...
I'm involved in the development of an enterprise web application whose functionality is separated into microservices deployed in a Docker Swarm. In order to expose these microservices to the Internet (for example for our client side front ends), one of our microservices is an NGINX web server, which listens to web requ...
I recently asked this question: Should the domain layer be dependent on NHibernate? I have read a lot of questions today, where answerers state that the Domain Layer should only contain Business Logic. This confuses me when I read about the Onion architecture, which states that the domain layer should contain all inte...
We have an old database which is used to hold supporting information about the financial system. Most of the actual code in are in Views which consolidate the supporting data with the financial data (held in a different system) into a single table. Some of this View code is very large. Due to a change in the way financ...
What is the advantage of returning a pointer to a structure as opposed to returning the whole structure in the return statement of the function? I am talking about functions like fopen and other low level functions but probably there are higher level functions that return pointers to structures as well. I believe that ...
One of the proposed features for Java 7's "Project Coin" was the "Elvis operator". A report of a 2009 JavaOne presentation on Project Coin described it as such: One of the "small features" covered in this presentation is the so-called "Elvis operator," a more concise version of the ternary operator. I find myself miss...
I'm having trouble planning the structure of my server side workflow and the technologies I should use. The basic structure and tasks are: Now, things to consider: 1.the server listens to multiple "folders" in the DB at once. the server need to process many changes to the db - about 1000 per sec for all folders in th...
I am making a game with Unity, and am having problems attempting network synchronisation. Deterministic simulation is impossible because Unity's internal logic is float based. I am trying to make a solution which works on an authoritative client-server model, in which the position of every soldier is corrected by the...
If You are Unfamiliar with OOP Matlab For those not familiar with matlab, matlab provides a variety of access attributes when creating member variables. All member variables are essentially C# properties in their own right, who's get and set values default to normal access and assignment. Any (and I mean any) member ...
In class, we are asked to draw a finite state machine with the following instructions: Design a finite state machine to model a vending machine that accepts only quarters and gives a container of juice when 75 cents have been deposited, followed by a button being pushed. If a fourth quarter is deposited before t...
I am not grasping the idea from this quote by Stroustrup on page 862 of "The C++ Programming Language" 4th edition at the end of the first paragraph (I've highlighted the relevant portion): Building the comparison criteria into a sort function is unacceptable because the same data can be sorted according to differen...
We have a chain of service A -> B -> C -> D. A defines format of certain parameters say ParamA B defines format of certain parameters say ParamB D is the one which actually uses these parameters and C pass them to D. The role of C is to get data from D and do bit of business logic on top of that and return that to B an...
I only know about cloud application "in theory"; I've read some material related to cloud computing but never had access to cloud computing from the point of view of their developer (not of the sysadmin!). What is specific in developing (not deploying) cloud software in compiled languages (precisely those accepted by r...
When working in NodeJS and requiring custom modules. Is it best practice to require one file that itself requires dependencies, or is it best to explicitly require only the files that are needed? An example might be having a database class that returns a connection pool. db_conn.js Then there might be separate file...
I use dependency injection with Guice and most of the time, I'm rather happy with it. But sometimes, it's difficult to get the dependencies to where they're needed and sometimes, it's plain impossible. An extreme example is making MyResponse.toString() return some JSON, where MyResponse contains either a list of DTOs o...
If I have a blog system, there is now a query that is given a range and then gets the number of new blogs in that range. The range may be: one day one week a month six months a year How do I design the backend API? Is the design of five independent API, or the design of an API to pass five different enum values on be...
I can't figure out a barcode that would support ~3500 chars. The barcode should contain 40 strings with caret return, each 76 chars long. Each string will look like this: 16N00001CGTXH60G2YE1NKL20518048000183150155491553423519964186228580116N00000 Each string has different numbers and letters. I tried to generate a Q...
Long story short, let's assume I want to create a webpage that would enable the users to sell used cars. I am a beginner to webdev, so pardon my ignorance. Fun fact: two months ago I knew literally nothing, I considered HTML as a relic of 90s, not in use anymore LOL. I've been told I need something for the BACKEND and...
Please see the question here, which I asked yesterday: Domain Driven Design in an Onion Architecture As stated I understand that DDD is an approach that targets the domain layer only and Onion is an architecture for the entire system i.e. core, infrastructure etc. Onion suggests that all interfaces in the application s...
In J.B. Rainsberger's discussion of collaboration tests he describes how tests for "clients" (users of a particular interface) should have two parts to their test. Does the client ask the right questions of the interface? Checked through mocking and verification. Does the client react properly when it receives the an...
I'm new in software engineering and I recently read Philippe Kruchten's famous paper 'Architectural Blueprints—The “4+1” View Model of Software Architecture'. He defined 4+1 views includeing Logical View, Process View, Development view the Physical view, and use-case. But I also find some people call them Design View,...
Imagine you have a user object that holds the following data: id, name, email, telephone, address, created date, last update date. To create the user you only need a subset of these properties: name, email, telephone and address. The number of properties can go out of hand and it is easier to group them in a dictionary...
I've been modifying some code written by a previous employee and came across a function with the following signature: BOOL WINAPI PrependPadding( _In_ SIZE_T cbPadding, _In_ SIZE_T cbRow, _Out_writes_bytes_(cbPadding) _On_failure_(_Post_null_) BYTE *bRow ) For those of you unfamiliar with Microsoft's SAL a...
I need to create a login page for a basic accountancy-related application. Login action should be two-step one: User enters their username and password and hits "Authorize" button, After successful authorization user should set the initial parameters for the current session (i.e. the month and year, the unit for whic...
I'm trying to set up a database, to run a small pig farm. The idea is the following: I have a table called BELLIES, where I codify the sows along with relevant information about them (weight, id, birth date, purchase value, etc). I want to manage on the basis of events the different processes involved, that is, the sow...
I often find that I need to add new conditional feature to code that already exists. This requires me to keep the existing functionality while tacking on something new. I've tried each of the following methods but neither of them seems as elegant as I would like. Option 1: bar_1(): baz() frobnicate() bar_2(...
I am working on a ticketing system. The user in system are organised in one level hierarchical way. There are many teams and each team has one manager and each user in the team has one and only one manager. A ticket can be created by any user in team. I have the following use case: A user can see only the tickets crea...
I am currently writing a class that performs a rather complex computation that should be triggered by one function call. The steps of using the class would be: Construction including the initialization of the basic parameters Initialization with some more case specific settings The actual computation Now, the user of ...
I want to create an app using MongoDB (NoSQL database) that allows people to vote on posts (simillar to Reddit). What's the recommended way to store votes for the users? Probably the database structure will have to quickly respond to queries like: Write: User X votes (up or down) post A. Read: Has user X already vot...
I am working on a set of .NET Core 2.0 Microservices together with some other developers. I wrote some code to add my own custom logging as described here. My logger sends the logging messages to an external cloud based log system (so not the command line). I am now trying to find out where my code should be placed. Th...
Imagine that I am writing a game where tanks fight with each other. A generic Tank class is created and has the method fire() which fires a cannon, looks like this Tank::fire() { /* fires a cannon */ } And then there is a class for BossTank which fire() fires a cannon and also a missile. A senior advised me to do som...
I haven't been able to find a question (or set of questions quite like I am looking for)...apologies if there are. I am basically trying to figure out how to create an algorithm to "split" muscles between workouts. Here is the main idea: 1) Muscles have "pairs". These are other muscles that work well with another muscl...
This applies to to both Java SE & Android, as the contracts are identical. CharSequence documentation for Java SE CharSequence documentation for Android CharSequence does not define a contains(CharSequence) method. I can't seem to find a reason why, and including it would be quite useful, preventing the need to call...
I am striving to have the most maintainable architecture possible in my application, but I cannot decide on a proper domain model design. Here is an example domain model for a user: public class User // Referred to as the domain model { // A model whose properties map exactly to a database table schema private...
I'm following up on this question, but I'm switching my focus from code to a principle. From my understanding of the Liskov substitution principle (LSP), whatever methods are in my base class, they must be implemented in my subclass, and according to this page, if you override a method in the base class and it does not...
At the moment on my blog I have articles only one language. Now I want to write posts in other languages as well. The new posts will not be a translation of existing posts – I'll sometimes write articles in one language, sometimes in the other. The topics might well be different. What's the best strategy to manage such...
Anemic domain model was criticized a long time ago by Evans and Fowler, since apparently it goes against object oriented principles, etc. The DDD community is clearly aligned with this statements. However, in recent years there have been disagreeing voices claiming it's not an antipattern at all and that it is an examp...
I'm currently refactoring a large subsystem with a multi layered architecture, and I'm struggling to design an effective error logging \ handling strategy. Let's say that my architecture consists of the following three layers: Public Interface (I.E an MVC Controller) Domain Layer Data Access Layer My source of confus...
I was reading on this software engineering page about the use of static methods. However, I'm confused, and maybe it's about the context in which it talks about static. The idea is, that static is really bad for testing and shouldn't be used. When creating immutable class, sometimes the constructor is private and a st...
I have a try/catch block which looks like this : try { geoms.add(convertLineToGeom(ln)); } catch(IllegalArgumentException e) { System.out.println("ligne n°" + counter + " : " + e.getMessage()); } My function convertLineToGeom might throw different exceptions that I made myself, all of them extending IllegalArg...
I sometimes see these two terms be used interchangeably. What is the actual difference between these two terms? How are they used differently? Are there any other alternatives to these two libraries?
If I find myself fetching one peice of data, and then fetching its 'related data' in a separate request, is this bad API design considering I could package all of this data into one response object? To provide some context: If I am viewing a product's page, I find myself fetching the product's specific data, and then f...
Just a small bit of background. Right now my team tags release candidates in version control. I've learned that this may not be the best thing to do because we still have to go through user acceptance testing before we really release whatever application was tagged. So now we know that tagging release candidates is not...
I see this term a lot in the context of software architecture ("domain-model", "domain-driven-design" etc.). I have googled it, but I get tons of different definitions. So what is it really?
I have some Views and Presenters. In my architecture, they have a circular dependency, so the View has a reference to the Presenter and vice-versa. Now, which is the more commonly used: class View { View() { this.Event += presenter.EventHandler; } } or: class Presenter { Presenter() { ...
Is the term "payload" used exclusively for the payload of (let's say http) request or it may be used to describe the useful information in the response of a request? If its used for both payloads (request and response), is there a way to distinguish between the two?
Background I need to implement a URL whitelist to limit the number of pages that a javascript widget can be deployed on. The requesting domain is already limited for an account, but I now want to restrict each account to a list of up to 7 paths. Theres a couple of layers I can think of / combine, but none of them alone...
I have a REST API in development were some resources are user related, and users need to authenticate to access those resources. It's tempting to take a shortcut and replace an identifier of: /profile/[user_id]/ with /profile/ considering that the user_id is known based on authentication data. In such case the /profi...
Let say I own a resturant that makes a pie. I want to cut this pie according to the input parsed from the file. That hold the key to the information on how the Pie is to be cut. I use CircleDividerParser class to parse the file.txt. file format: pie_cuttin_style_name = is key for searching it back radius = radius or p...
I have an AR and I can't figure out the best way to create/edit some of the complex aggregates contained in it. These aggregates have many parameters so I decided within the domain model to use Value Objects instead of primitive types. public class Load : AggregateRoot { public virtual string Name { get; protected ...
Say, I make an ajax request to a server from a page, something like "show more articles". Is there a common agreement on the format or rather structure in which a result should be returned? Something like this: {articles: [{id: ..., title: ..., created_by: ...}, {id: ..., title: ..., created_by: ...}, {id: ..., title: ...
I understand that I should consult a lawyer for this if this is is an important matter, but since it is not, I am just going to ask here. What are the legal implications if one distribute their work with only the clause: This work is licensed under GNU GPL. I have stumbled upon one such work. Since there is no "single...
Imagine this scenario: You are relatively new to a very large codebase for a GUI application. A bug report comes in. Since it is a GUI, the report is not expressed in terms relating to functions or exceptions raised from the code, instead it has screenshots of the GUI, descriptions, maybe a video. What strategies do yo...
I would like my project to adhere to the SOLID principles and write clean code, but I am still not very clear on when I should separate from the service layer. I have a Web Api 2.0 Controller called ParkingController which has the following method: public List<Week> GetParkingPlaces(DateTime date) { date = DateTim...
I am not trying to launch a Microservices vs SOA debate but I find hard to understand the following statement: "Microservices architecture does not support contract decoupling, whereas contract decoupling is one of the primary capabilities offered within a SOA" As I know REST contracts can be specified via Open API (ex...
Working at a company that loads all javascript at the end of the page load. This means I can't do $(document).ready() on my page, because jquery isn't loaded (the scripts are injected into the footer by some template or other). I'm stumped on how to address this. I have one page where I want to run a function that is i...
I'm trying to refactor a 2.5KLOC god-class (with about 68 data members and 62 member functions) that performs a wide variety of text formatting and layout operations. After a careful analysis based on: Which member function reference which data members and, The logical formatting sub-tasks I've partitioned the data ...
Unsure if the question is too broad, or opinion based. Though will ask anyway. I'm currency reading through Microsofts "Architecture eBook", found https://www.microsoft.com/net/learn/architecture. It has a supporting solution that is found on Github, https://github.com/dotnet-architecture/eShopOnContainers The sample a...
Here is an example implementation using Onion architecture: https://www.codeproject.com/Articles/1028481/Understanding-Onion-Architecture The webpage suggests a solution structure of: Domain - Solution Folder Domain.Entities - Class Library Project Domain.Interfaces - Class Library Project Service Interfaces - Solutio...
I'm building a wpf application which implements the following features: Take user input and read data from databases perform some calculations on it Showcase it to the user in multiple types of views and write changes back to db Proposed architecture: Database -> Entity Framework -> Repository -> Business Logic -> Da...
I received a big old fashioned requirements document. But my team is working using agile methods (a combination of scrum and kanban), so what we need is user stories. Is there some guidance for "translating" requirements into user stories? Obviously I don't want to start from scratch, as someone did good work to compil...
How small can a scrum team before it's no longer effective? Are there diminishing returns or hard limits on team size before you should abandon scrum?
I recently finished a project which contains more than 30 different pages/features. Each one with some CRUD and more subpages. Each page is totally different from another in purpose. All of it was made using ASP.NET MVC Core and some Ajax for querying some rendered views. Today I'm starting a new project that will be s...
I have several subsystem managers for various uses, for example: AudioManager CollisionManager InputManager etc. At first I wanted them to be all singletons, however now want to make the architecture a little bit cleaner. The main idea is to use only one big singleton (for example System) and it will contain all of th...
Coming to JavaScript from C# and C/C++ world, I'm used to decorating my private members with underscore. But a couple of JS devs I know have told me it's not common in JS world, and my code looks "weird" to them. I got intrigued and interviewed about 4-5 more JS devs and they all confirmed. Just to be clear, her's my c...
My application's model includes a number of entities that share many common properties, and are operated on by many of the same classes. If I was using an ORM, I'd define an abstract class with the common properties, setup class table inheritance for persistence, and have the classes that operate on all these entity ...
I have seen proponents of isolating data management and storage into microservices in a way that each microservice has its own data store (at least in a logical sense). Hence, joins and aggregations are made in the application layer. Why is this better than using, for example, a relational database where different micr...
I have the vague sense that programming now is a more high-status job than it was in previous decades; that it used to be looked upon as more rote, manual work. The sense is that, while today fresh Stanford grads flock to Google, thirty years ago Ivy League graduates were seen as better suited to manage programmers, no...
When building a Service Oriented Architecture (because the services will be used by automated systems or other consumers), how can I go about creating a simple, dynamic form-based web frontend for said services. As an example: A service needs 10 input values and returns a set of matching elements. To get to the values ...
How do I go about unit testing a private method that gets called in a loop like this one: // Calls MethodToUnitTest in a loop public static string Generate(params int[] values) { if (values.Any(i => i == 0)) // return empty string if any value contains 0 return ""; return strin...
I've asked this question myself for a thousand times now but I can't seem to find the correct answer. I'd like to separate a part of reusable code from the actual project however both the project and the reusable code part need each other. Let's give an example. I've setup a working CMS which has it's own git repositor...
This question is a clearer version of a question I posted on SO. I have a C++ Planner object with a method that computes a Route from a start point to a destination point. Planner is the owner of the computed Route pointer. Now, I have a second method (call it TestRoute), that takes the route object and tells if the de...
I have a C++ interface for video provider. Frames can be rotated (Portrait/Landscape) as a result of platform-specific functions. enum class EFrameOrientation { KUp, // default orientation KDown, KLeft, KRight }; Class gives the user info about orientation: virtual EFrameOrientation getFrameOrientatio...
We have a PHP based web application with a lot of project data. All of our customers have a dedicated instance of this application. Now we want to allow a very limited access to some third party users to access some data (read only). We want to create a new dedicated app for these read only users and allow each our cu...
The insurance company for which I work has had an ongoing software development project for the last several years, which has been split between multiple lines. software package: The suite we are using is broken up between several major packages, they are independent, but tied to each other, each with it's own domain: ...
I'm having some concerns about injecting my Entity Framework DbContext into my MVC controller. Below is a sample of my code. The way I designed this is so that I can better unit test my Controller code by injecting a real or mock DbContext. What I'm currently planning to do is using Unity and the IDbEntities interface...
Uncle Bob Martin frames the Single Responsibility Principle as "A class should have only one reason to change." I wonder, is there any name for a converse principle like: "a single reason to change should impact only one class"? In other words, you shouldn't have to make changes scattered across multiple functions, c...
Is there a pattern to handle the following scenario : I have a set of business transactions captured and stored in a mongoDB database that need to be executed at a future date that is also stored in the database. I'd like to build a process that will trigger regularly, scan the database and pick up the transactions th...
So in my mind, the usual users table that we are used to having, is going to split in two: whatever data is within the Identity Provider the domain specific data (user.facialHairStyle) is going to still stay in the user table. One difference is that it will be missing the regular properties covered by the Identity Pr...
I am new to DDD and struggling to find the correct way to solve a simple problem. Let's say I have am working on a project where I am processing credit cards using a third party API that has the ability hit a credit card terminal or use saved credit cards to process a payment. I have a payment entity, a request entity...
I have a situation where I want to track page views, click events, etc. in a time series database but am having scalability issues in the case where I want to retrieve aggregated groups of data that has very high cardinality. The problems I'm trying to solve are: What are the top N referrers within a given time range?...
I'm sure this has been asked multiple times but for me it's more specific as I know what I'm building. I wrongly posted this to stack-overflow (now removed) so I'm hoping this is the best place to ask. I'd like your help deciding how I should move forward database wise for the platform I'm building. I'm currently using...
I am in a software engineering class and I need to pick a design pattern to use for a 'feature'... I have two features, and one of them is to have a feature where a user can enter a zip code and time span of days (up to 7). A collection with weather ratings for each day is generated (say a vector of ints, with 1 being ...
Is it desirable (from an architectural standpoint) to have more than one Presenter communicating with a View? In my particular situation I have one presenter communicating with multiple views, and each of those views have their own presenter. In other words, each view has two presenters. It would be feasible to use inh...
If an app allows its users to signup using multiple platforms like facebook, google, twitter and also use local signup, How should the users Table be defined in the database? Should all users be stored in a single Users table in the database irrespective of their signup mode. Or is it better to breakdown and create a s...
how should the MVP pattern handle views created at runtime ? for example There is a mainView (that has a model and presenter) that needs to display a list, each item in the list is represented by it's own view, listItemView (which also has it's own model and presenter). the listItemViews need to be created at run time,...
BACKGROUND I am trying to design a micro-services based SaaS application, where each micro-service would be packaged into their specific Docker container. I also have a CLI tool (a binary file) that functions as a Swiss knife (i.e. does more than one thing) and there are a few micro-services that would want to use the ...
I am researching Microsoft entity framework and I am confused about when it should or should not be used. I am interested in the relationship between entity framework and product management methodologies, design methodologies and .net web development frameworks. The information I am finding online isn't enough. Does an...
Trying to understand concurrency with CQRS, I came across that question: https://softwareengineering.stackexchange.com/a/349575/286881 But there is something I don't understand when it is said that: it do so by appending the new events to the Event stream if and only if the version of the Aggregate is still the one ...
I’m a bit confused about this type of UML diagram which I’ve seen used in non-consistent ways. Component diagrams often represent some sort of architecture level snapshot of the application in development, they are very close to deployment diagrams, just a bit more abstract (i.e. without the node details). Some people...
This is a sweet spot thing for me. But I am not sure what rules others apply to the challenge. In this codebase I have many large types. Mostly types called *Service. Large types are cool. But I tend to like a smaller surface of interaction. Let's say we a Configuration type. This type has Activate, Save, Publish, Reve...
I have a hypothetical C++ code containing these two classes: Master: it's big, does a lot of things and is meant to have only one instance; Slave: quite the opposite. It can also do a lot of things, but it's small, and has many instances. Every slave needs access to the master, so it is injected through the construct...
Does npm allow you to publish earlier versions of a package? The only documentation I could find was on npm’s site: [npm-publish] Fails if the package name and version combination already exists in the specified registry. Once a package is published with a given name and version, that specific name and version combina...
What criteria do you use to decide whether execute a test on target or on host in a sprint? We have integration testing using a server for an embedded system project. We are starting to learn and researching on how to apply integration testing and I do not know how exactly decide. What are the scenarios for each appro...
This question came up today while discussing with a colleague about the 'create account' page for the website we're working on. My colleague's opinion is that we should make the registration as quick and seamless as possible, therefore we should just ask the user for his email and take care of the rest. I agree with th...
The app should allow users to signup using both local login and also from other platforms like facebook or google. The Users table has a required password field. If an Users signup using the local registration form he/she will fill in the required password field. But what if the User opts to use facebook to signup to t...