instruction
stringlengths
34
36.1k
How should be represents process of versioning in developer team? Suppose that we have CI system, and we want start versioning our software. If we speak about semver, then major and minor version must changes manually, right? What to do with path version? I think also manually, but not sure. Build number may got from ...
Using a static site generator has the advantage of themes, blog and hosting (via Netlify). How can this be combined with a login form, show a user is logged in and dynamic pages (flask backend), while still keeping the same styling and being perceived as a single app?
I have open source C# .NET project at GitHub with Appveyor CI + code coverage. There are configurations like Release and Debug. There's also platforms like x86, x64 and Any CPU. This results to following: Configuration | Platform | Tests --------------+----------+-------- Release | x86 | 100/100 Release ...
I'm just starting out with Qt and I really want to try and keep my application as separated from Qt as possible in case I decide to use a different toolset later, but at the same time don't want to make any decisions that will really cripple my application right from the beginning. When writing a Qt Application is it c...
I have the opinion that each method in a service should only do one small step of a larger task, delegate a result to the successive step/method and terminate. No matter if this next method lives in the same service or not, it is always triggered via inter-service routing (message queue, service discovery + REST call, ...
I have been asked to develop a multitenant application where, Company/Users can log in, a user can belong to a company, but I has been asked specifically that they don't want to be inviting users to their company manually because they think it's a lot of work, but they also want to avoid exposing other companies when a...
So I'm working on a project and I'm running into conceptual problems in creating my user interface. It's for a DirectX11 multi-monitor game I'm writing. I've got a prototype working, with entity menus popping up and more entities inside those menus. All is well and good, except it's a coding fuster-cluck. I'm doing ...
Unit testing requires writing tests first then code, on the other hand in F# (and most of the functional languages) some codes are extremely short as follows: let f = getNames >> Observable.flatmap ObservableJson.jsonArrayToObservableObjects<string> or : let jsonArrayToObservableObjects<'t> = JsonConvert.Deseriali...
I have a piece of code where I iterate a map until a certain condition is true and then later on use that condition to do some more stuff. Example: Map<BigInteger, List<String>> map = handler.getMap(); if(map != null && !map.isEmpty()) { for (Map.Entry<BigInteger, List<String>> entry : map.entrySet()) { ...
I am a layman without any programming-like education but I spent the better part of my free time to get into programming bots for some games in first AutoIt and then C++. I was introduced to programming in a very procedural style only using free functions. A couple of weeks ago, my focus shifted from actually making th...
Please see the question here: https://stackoverflow.com/questions/2352654/should-domain-entities-be-exposed-as-interfaces-or-as-plain-objects The general consensus is that Domain Models should not contain interfaces. Now see here: https://github.com/jbogard/presentations/blob/master/WickedDomainModels/After/Model/Memb...
I am trying to implement a preemptive scheduler in C, but I have some understanding problems: When the scheduler is called by an interrupt, a context switch may occur. The context switch can only be programmed in assembler. In my C program a task is a function. If the scheduler is called by an interrupt and a context s...
Given an array A[N] of N booleans, return a, b such that a >= 0, b > 0 and A[a] = true A[a+b] = true A[a+2b] = true or -1 if they don't exist. The best algorithm I could find was brute forcing the entire search space, O(n^2) and I wanted to know if there's a better algorithm.
It's very common see a generic's DAO implementation like this: public List<E> getResultList(String namedQuery, Map<String, Object> parameters) { Query query = entityManager.createNamedQuery(namedQuery); parameters.entrySet().forEach(e -> query.setParameter(e.getKey(), e.getValue())); return query.getResultL...
Using SQLite in a WPF application that schedules events for people. The application will be used by 2-4 users concurrently. I'm wondering how to ensure each user has the most current database information. What I came up with is: Start a separate thread responsible for checking for database updates. Use time interval...
Say I have a namespace as follows: CompanyName.TechnologyName[.Feature][.Design] Like this: https://github.com/vkhorikov/DddInAction/tree/master/DddInPractice.Logic/Atms .Design is the AggregateRoot (e.g. BuyingAggregate). This namespace contains all of my Entities and Value Objects. Say I also introduce a Domain Ser...
I have the following scenario: We want to create nuget packages on VSTS We want the packages to be available for an external party (preferably no login, tokens...?) For our developers we want to have the symbols for that package coming from VSTS The Debug packages should have the output + pdb files. (no source) If I...
When parsing user input, it is generally recommended to not to throw and catch exceptions but rather to use validation methods. In the .NET BCL, this would be the difference between, for example, int.Parse (throws an exception on invalid data) and int.TryParse (returns false on invalid data). I am designing my own Foo....
Sorry if title is not clear, suggestions on better title are welcome. For the purpose of [self-]education I am writing a toy scripting language that would compile to bytecode and be executed on a toy VM. This is not going to be a turing-complete language, and it would only contain simple flow control structures such as...
In DDD, is it okay if creation of one AR forces creation of another AR? Take for example: class User { // User related functins } class Schedule { // Schedule related functions } class Scheduler { private ScheduleRepository repo; // injected public void Schedule(User user, Event event) { Schedule sche...
In my company, We are planning to build more than one web application on a single Database. The proposed design of each of these apps are - ASP.NET MVC as Presentation layer, Restful API as service Layer(also works as domain/business Layer) and Entity framework (EF) as data access layer. But Many of my colleagues a...
Let's say there is an extensible system in place, which uses an algorithm that requires that the elements it operates on are unique. The signature to call this algorithm looks like this: function algorithm([Collection of Elements]) Now there are multiple modules that use this algorithm, which call the algorithm like th...
Reading a Node Stream I want to be able to receive a stream of text, and trigger the continuation of my stream. The following code solves my purposes but I recently read that we are using Subject too much when we may not need to. I'll use this code to read files from disk or from S3. Is it possible to replace my subje...
Background I've been thinking about documenting design patterns in our code by setting up interfaces for the common design patterns so that when people read my code it would be clear that I am using a design pattern. I would do this by create a project, in our solution, called Design Patterns, so it was clear it was me...
In C# we have Extension methods. Extension methods enable you to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. An extension method is a special kind of static method, but they are called as if they were instance methods on the extended ...
I've found out that there are 5 use case levels: Level 0 Cloud Level 1 Kite Level 2 Sea Level 3 Fish Level 4 Clam Cloud level lists only high level users goals such as "Manage files". Kite level mentions the actor and some more specific cases. For what I've understood, Sea level use cases should document the foll...
I have a current project which consist out of two independently developed projects: Spring REST as back end Angular as front end I do have a Jenkins instance available for building my projects and I'd would like to "marry" both of the projects in a CD job to a single deployable file (.jar) Is this a job of jenkins, t...
The question is pretty straightforward, I'll try to explain why I want some explanations. (All of this is my 1½-year junior Java developer opinion, which may be more than incomplete. Which is why I am asking the question there). It increases the coupling between classes, as some classes need other classes, and so on. ...
I have a LogFormatter class which looks like below @Sl4j class LogFormatter { public static String format(String taskType, String taskId, String message) { return String.format("TaskType: %s, TaskId: %s, Message: %s", taskType, taskId, message); } Mostly there are 4 type...
I'm building a website that lets a user pay for a service that automatically does some video encoding for them. Encoding takes several minutes. A naive solution would run each encoding job immediately. this could lead to several instances running and cause all of them to finish very slowly. the processing would probabl...
I'm asking this question for a colleague since he doesn't have enough reputation to post images in a question During our normal development we found a deficit in our REST Api. We display entities in our UI like this. Whereby the buttons at the top are so called actions. In the Image you can see buttons which act as ac...
With all the talk of Microservices with Domain Driven Design, I have been looking at two architectures, the Database-Centric Architecture and the Domain-Centric Architecture (Not to be confused with Domain Driven Design). Now in the Database-Centric Architecture, the database is the focal object we depend on. Without i...
I have read plenty of questions on here about overriding .equals and .hashcode for testing purposes only. My Domain classes have implemented .equals and .hashcode. Should I be 1) Duplicating these classes in my test project or 2) Using the Domain Class .equals in my test project The only justification I can see for ...
I'm working on a file-synchronization client that currently produces a stream of changes to the underlying filesystem. That is a stream of create/update/move/delete events is produced for each synchronization "target". Each event includes a sequence-ID, which provides information about the ordering of events, and then...
Is the M (model) in MVVM equal to business logic + data? Or is it just supposed to be data/state for the view? Background: In a project we use "model" as a name for an object that holds presentation data. I expect that to be wrong. In my opinion a class/structure that just holds presentation data or state should called...
I was talking with a friend another day about OOP in small projects. In the most of projects that me and him worked the SOA was the rule. Per example, imagine a Order in a SOA application. The scenario of this application could be: A lot of services (UpdateOrderService, CreateOrderService, etc) calling each other. The...
We had a debate on our team about how clean the Master branch should be. The application is written and maintained by two people, me (a developer) and a GUI/UX designer. The GUI/UX designer does a lot of prototyping (or "sandbox"-type experimentation) to test or fix various layout issues in JS & CSS. This preliminary o...
Assume that you have the following 3 entities: Manual Version Document 1 Manual has multiple versions and 1 version has multiple Documents. I want to build a Web API that allows customers to insert their manuals, versions and documents, but what is the best practice? Do I accept the posted data object in a nested XML...
In a company of about ~100 developers, and ~2 pen-testers, a product is being developed. There's a good amount of diverse code coming in via github PR requests every day. The goal is to review as much new code as possible before it gets merged. On the one end of the extreme, it'd be something like 'review every PR a...
Please see the code below: public virtual bool Equals(Entity other) { return Equals((Object)other); } public override bool Equals(object obj) { var compareTo = obj as Entity; if (ReferenceEquals(compareTo, null)) return false; if (...
I think one of the biggest pain points in working with microservices is making sure that the APIs are well-documented and APIs do not change their behavior without affecting downstream applications. This problem becomes amplified when you have many services that are interdependent on each other. Perhaps at that point y...
I was reading on this page about setting a flag in a loop and using it later. Most of the answers agreed that it's a code smell. One of the answers suggested refactoring the code by putting the loop into a method and the boolean and break become a return instead. The second answer suggests that using the break means yo...
The implementation is MVC. The View is isolated to the browser layer. The Model is isolated to the persistence layer. The Controller is split with: UI controls in the browser mostly so input is syntacticly correct, authentication and authorization controls are in the listener layer (Tomcat and remote LDAP), and data...
Say I have a function that returns a weighted selection from a set of resources, according to a desired distribution. For argument's sake let that resource be string colors. const distribution = { red: .1666, // We want 1/6th of colors in the world to be 'red' yellow: .3333, // ... 1/3 to be 'yellow' blue: ...
When it comes to tests, I can think of two options: Put both test and application in one image. Include only application code in the image. Create a test-specific container that builds after the main image and adds some layers to it (test code, dependencies etc). With the first option, I can test the container and s...
For example, I have simple C program that only have main function that just returns 0. What registers should loader (Linux exec loader, I guess) install before start a program? I didn't find information about this except stack pointer register.
Looking at a range of cross-platform languages, libraries and GUI toolkits, I often notice a conspicuous absence of support for asynchronous file I/O. This seems like too much of a common factor to be a coincidental oversight in all of them. However I don't know enough about individual OSs or these languages'/libraries...
Here we have TV class and DVD class as example: class TV { public: TV(); virtual ~TV(); void on() const; void off() const; }; class DVDPlayer { public: DVDPlayer(); ~DVDPlayer(); void SetCD() const; void StartPlay() const; void Eject() const; void PowerOff() const; }; We crea...
We have a micro-service that has a Domain Model and have an analytical service for the domain which has its own Query Model. The domain model and the query model are stored in separate persistencies. Currently our Query Model uses a sub-set of the attributes from the Domain model. However going forward we have require...
Working on an application that uses DynamoDB for data storage, which is new-ish for me. There are two tables, both use a simple guid for their key. I need to divide data per client. Someone can sign up for their organisation, which means I need to separate data between clients. I was thinking of using a range key for c...
I have quite some experience with TDD in Java and Kotlin and currently try to learn testing with Javascript. I am not sure if this is really a question about weak vs. strong typing or about general design. I always was under the impression that mocking/stubbing code you don't own is a bad idea. In Kotlin I would cr...
I have used RabbitMQ but I haven't used Apache Kafka. Is it a similar problem that these products solve, or is there no connection?
I've the following endpoint: a/{id}/b and want to create a b with sending POST request to it. If a with given {id} is not found should I response with 404 NOT_FOUND or maybe with 409 CONFLICT? It is to handle plain a/{id}, the trick is that here a subresource is used.
Let's say we have following SQL table structure Entities (5-15k) Keywords (15-20k) EntityKeywords ExcludedKeywords (keywords which should be excluded from common matching) We need to find related entities, which are entities which have most common keywords ordered descending. Now obviously, querying this on each load...
This scenario seems pretty ordinary, and yet, strangely, messaging systems (like Google Cloud PubSub and Task Queues and ActiveMQ) do not seem to support it -- they assume that topics/queues are long-lived. A frontend webapp server sends a request to a backend server. The backend server replies to this request wit...
The goal of the RegEx is to match exactly 6 characters, but in addition it should match empty strings or white space (e.g: ^$|\s|^(\w){6}$). Is it good practice check for empty string/white space in a RegEx expression, or to perform this check in the higher level code, such as String.IsNullOrWhiteSpace? There seems to ...
As a C++ developer I'm quite used to C++ header files, and find it beneficial to have some kind of forced "documentation" inside the code. I usually have a bad time when I have to read some C# code because of that: I don't have that sort of mental map of the class I'm working with. Let's assume that as a software engin...
How thick should a viewmodel be? For example, should my viewmodel or model handle the actual filtering? For example, let's say I have a Roster object holding a collection of Users which are assigned a type (i.e. full-time, part-time, etc.). Instead of having one large viewmodel to handle the filtering of full-time ...
I'm new to forking and open source and I'm porting a Rust library into Swift but I wasn't sure if I needed to fork the original repo and then replace it with my new files or just upload my own repo and mention in the README that it's a Swift port of an existing library
I am not working yet, just studying and recently dealing with SOLID principles. I have read quite a lot about open closed principle but unfortunately most of the books and articles share the same examples. I do not understand the following: if the class should not be changed after it has been
I've been mulling this question over for a few days in my head and I can't come to a solid answer. We understand that client side validation for forms is not enough, because you can easily turn JavaScript off. But what about for a form that is submitted purely through AJAX (I have a register form that I want to be subm...
I am trying to decide whether to introduce mocks in my isolated Domain Model tests. I have a class method similar to this: public Offer AssignOffer(OfferType offerType, IOfferValueCalculator valueCalculator) { DateTime dateExpiring = offerType.CalculateExpirationDate(); int value = v...
I am trying to understand the async and await.Now i want to apply async and await keyword in my current project.My process structure are: //DataAccess Private List<Users> GetAllUsers() { .... ; return List<Users> } //UI List<Users> UserList=new List<Users>(); private async void Ok_ClickAsync(object sender, Rout...
The Setup So I'm working on a project in which there exists a MainViewModel class. This MainViewModel contains a list of Soldiers through an observable collection. I have a button in the MainView which displays a new AddSoldierView. The AddSoldierView is binding to elements from the AddSoldierViewModel. The AddSoldierV...
I am just getting started with RxJava, Java's implementation of ReactiveX (also known as Rx and Reactive Extensions). Something that really struck me was the massive size of RxJava's Flowable class: it has 460 methods! To be fair: There are a lot of methods that are overloaded, which bumps the total number of method...
A typical advice before any production deployments is backup the DB first. This way, if the new update has some issue that can lead to potential data loss or logical data corruption, then you still have a backup to compare and correct old records. However, this can work well till DB size is in few GBs. Once the DB siz...
Say I have an interface Interface, which only contains getters for various fields. This interface has multiple implementations (say Foo and Bar), each of which adds various fields. All these implementations are immutable. Assume I have an instance interface of Interface, and I want to create a copy of this instance whi...
I have a collection of people. Each person have rank (A, B, C, D where A highest and D lowest) and set of skills (SkillA, SkillB, SkillC, SkillD) defined. I also have a set of requirements - for example: - 1 person with rank A - 1 person with rank B and SkillA - 3 persons with rank C and SkillA and SkillC etc. I'm loo...
I want to know that whether storage is an issue with respect to current hardware and software market when we talk about the large size of C++ programs?? Because in certain conditions we have to choose between some types of programming etc like between OOP and procedural programming. I know that object oriented programs...
I have written a data cleansing application which, for the most part, works well. It is not designed to handle large volumes of data: nothing more than about half a million rows. So early on in the design process, a decision was made to try and do as much of the work in-memory as possible. The thought was that writing ...
I have read questions like this: Are unit tests really used as documentation? With regards to code comments; my research so far is telling me: 1) Some developers do not like any code comments and prefer to read unit test code method names to understand the code. 2) Some developers prefer code comments and unit test ...
Background: I've recently inherited a set of projects at my company and I'm trying to sort out some fundamental issues with how they've been handled. Namely, the previous developers (who are no longer with the company) were not using any form of source control, made little documentation, and didn't really have any good...
We are working on a large (legacy) distributed system with various applications, messaging (soap services, database dblinks, rest services)... We are lacking for documentation and a big view of this complex system. and we are searching a way to know if a certain update on a shared datatype could or not impact our syste...
I'm trying to get my head around a the development workflow for working with microservices and docker multicontainer applications. The thing that I'm particularly trying to solve - is getting a good 'live reload' workflow going for development. For example: For my frontend I can use webpack-dev-server which automati...
Looking for continuous deployment strategies regarding SQL server database projects targeting Azure SQL using VSTS. My scenario... Using VSTS for CI/CD Using a SQL Server Database Project to define my database schema Using Dapper for my ORM (so no migrations through EF) Using an Azure SQL Database Some of the tables h...
For Example my input is this dictionary s=["noon", "n", "o", "noo", "Good", "Goodnoon", "marry", "me", "marryme", "air", "r", "airbag"]. The output should be a list of compound words. like Good noon, airbag.
I wanted to know if it's ok to try and dependency inject into a class that is dependency injected, something like: class RootDependency{ } class AnotherDependency{ [InjectDecoratorForWhateverLibraryYouAreUsing] RootDependency injectedRoot; } // Inject AnotherDependency into a class... class RandomClass{ ...
Learning about the Liskov principle, I do understand that preconditions can be weakened and postconditions can be stronger in subtypes. However, I do not understand how invariants can be stronger in the subtype? If the base class says e.g. the Speed must be lower than 100 al the time, and then a subtype says Speed < 5...
I'm struggling with a very simple question: I'm now working on a server application, and I need to invent a hierarchy for the exceptions (some exceptions already exist, but a general framework is needed). How do I even start doing this? I'm thinking of following this strategy: 1) What is going wrong? Something is aske...
The SRP states that a class (module) should have only one reason to change. The "duties" of an Interactor in Bob Martin's clean architecture are, per use case: receive requests/inputs from a controller; orchestrate domain entities to fulfil the requests; and prepare the output data. Does this imply three reasons to ch...
In my domain where I am applying CQRS, there are some external service calls in order to some validation. I am a bit puzzled about where to put these calls. I am considering to put these calls to my Process manager on the other hand AFAIK the process manager should be a simple state machine that reacts on events and di...
So imagine, I have an endpoint where subscription payment to a magazine can be made. There could be different flavors of subscription. eg, weekly, fortnight, yearly, 5 years etc. For each subscription, the JSON request to the subscription endpoint varies in slightly different ways. For example, perhaps with the 5 years...
Please see the code below: public class Customer { private readonly IList<Order> _orders = new List<Order>(); public FirstName FirstName { get; set; } public LastName LastName { get; set; } public Province Province { get; set; } public IEnumerable<Order> Orders { get { foreach (var ord...
Wherein portability is defined generally as the percentage of platforms a language or technology can run on, C/C++ are often cited as being more portable than Java, because a Java application depends on a JVM being present. But, what prevents a Java application from shipping within a JVM wrapper? Or being transpiled to...
In reference to one interface control document, I found difficulty in understanding this concept. There is one parameter having LSB of 0.0625 and MSB of 2048 that should be transmitted from one piece of equipment to another. It's range is 0 to 2400. This should be transmitted using only one word. That is 2 bytes. Now t...
I am building an SPA. It will use WebGL, Canvas and SVG for certain components, and html for rendering views. I have a messaging system setup to define messages coming from a server, which will get handler classes to apply the logic in the domain model. I'd like the domain model as simple as possible without any ceremo...
I am all in favour of progressive enhancement and using server-side rendering when fetching a URL. The age-old discussion gives several advantages, such as improved load time, SEO crawling and possibly an improved level of "correctness"...etc However I am getting my doubts as to why I am also setting up my server-side ...
We have a highly efficient library written in a low-level programming language. We would like to allow third parties to implement a GUI for it. The approach we would like to take is to write a REST server. The GUI (written in whatever language) needs to start the server and is then able to use the library. As said, the...
So I have a function in our application's Business Edits assembly (which references the Data Access assembly) which I've found a need to use in the Data Access assembly. I like the idea of keeping the business rules together, but if I want to use the function I obviously have to move it. So what I've decided to do is...
I’ve been reading about older processors (8080, 8086 and that) and i’ve seen that those older 8-bit processors had some 16-bit instructions through the use of register pairs. For example, on the 8080, the XCHG instruction exchanges the value from the HL pair and the DE pair. if these registers are 8 bits wide, and the ...
What I want to get clarified is, having a polymorphism factor of 100%, does it means code becomes hard to maintain , and does high polymorphism factor introduce high level of coupling even though inheritance is used to reduce coupling. The polymorphic factor (PF) is a metric proposed by Abreu & Melo to measure how much...
Imagine a game that needs to score words. A words needs to be scored immediately, in a list of words or even in a list of words from list of players. I've created a scoring module which has the following public methods: score_single_word(word) -> int score_list_of_words(list) -> int score_group_of_players(players) ->...
I am trying to write some art of "generic" data access library to access the data of my company's ERP Software, which is our main/core application where all our related data is managed. I am a student worker and my boss & coworkers always come to me and ask to write small apps, to make any kind of stuff, from continue...
I have previously implement Client Side Data Encryption using Azure Key Vault using the following approach: Encryption Approach: Every record that needs to be encrypted gets a Content Encryption Key (CEK) The content is encrypted symmetrically using this CEK. The CEK is then encrypted asymmetrically using a Master Key...
Amongst other things in my life, I'm writing a framework in PHP to manage a slew of common problems I come up against in every project I tackle. The framework is currently very data-centric, with the largest component (named Data) being part-ORM and part-DDD in it's approach. The ORM-ness of this component heavily abst...
I am reading specific parts of Martin Fowlers refactoring book again (the areas I was not clear about the first time round). I am looking at the Extract Method chapter at the moment. I can understand why Extract Method is beneficial; for example: 1) Inheritance and overriding 2) Clarity for the user of the class Say ...
I am writing a paper about the use of a message broker for inter-process communication where I state that all computer communications can be broken down into two categories: Function calls Events My reasoning for this that code either needs to run other code to run to achieve its goal (function call) or merely trigge...
I have java/spring based web application with front end in JSP/HTML/JS/Jquery. We already have spring based i18n support. In JSP labels are coming from property files. html/browser download the js file specific to locale which contains validatins messages. Problem for both above points , half of the labels/messa...
Scenario: Images are uploaded to the server once in a while. Users send an API request for downloading all of those images that were uploaded to the server (Images reside in the server itself). Instead of downloading every single file, the server would collect all the images, archive it and then send the zip file to th...
Underlying problem In a case of a peer-to-peer discovery protocol,suppose we need to advertise peers in a manner that the network graph will grow such that we avoid cases of both too dense areas (e.g cliques) and too weakly connected areas (e.g bridge nodes).A node can also fail,disconnect, reconnect and update the lis...