domain driven design – Obtaining application generated ID from repostory or from entity constructor?

In the Book “Implementing Domain-Driven Design” the author suggests to implement a repository method to provide the next application-generated (not database-generated) ID. Like so:

class MyRepo {
  public MyId nextId() {
    return new MyId(UUID.fromRandom());

That would lead to code like this:

var id = repository.nextId();
var entity = new MyEntity(id, ...);

But although I can see the point that providing IDs is somehow the responsibility of a repository, I don’t see an actual benefit of this implementation. Why not assigning the ID directly on object construction?

public class MyEntity {
  private MyId id = new MyId(UUID.fromRandom());

One could also argue that the identity is a central part of the entity itself.

But apart from this philoshophical difference, I see the benefit of creating the ID directly in the entity that no additional call to the repository is needed.

Do you see any advantage of providing the ID by the repository?

audio – VOIP application – How to silent notification sound and vibration of external application during the ongoing VOIP call?

I am developing a VOIP application on android platform. I have a requirement to silent the external app notification sound and vibration when the VOIP call is in progress. If the notification is from my own app and any incoming GSM-P call then the notificaton sound should come from the earpiece along with the VOIP call. Vibration should not happen at all in any of the scenarios.

I am setting audio mode to “MODE_IN_COMMUNICATION” using Audio manager android API when the VOIP call is in progress.


Once the VOIP call is over, I am setting audio mode back to Normal in order to have notification sound from the speaker and vibration as per user settings.


Using above code, I am able to get all the notification audio from the earpiece along with the VOIP call. But I am not able to silent the external application notification sound. Also I am not able to stop the vibration in all scenarios.

I have checked the WhatsApp voice calling behavior and it is having 80% similar behavior what I wanted. Can you please suggest any Android APIs which can help me to achieve what I want? Thank you in advance.

aws – How should the server architecture of a service look like that stores files from a desktop application in the cloud (S3/Cloud storage)?

I developed a desktop application and I am in the process of adding support for online cloud storage. The main requirement is to allow the user to store files in the cloud while being able to delete them locally to save space (this is not possible via Dropbox nor Google Drive).

My initial idea is to setup a server with Nginx that accepts incoming connections and forwards them to a webservice by acting as a forward proxy.

If the incoming request is a download/upload the query is redirected to the S3/GCS server. I want to avoid a direct connection to the S3/GCS container. Is this a suitable architecture?

TLDR: How should an architecture look like where a desktop application can send files to a custom cloud server.

Dropbox and Google Drive are not suitable for my workflow as they don’t allow to delete a file locally but keeping them in the cloud. Files and directories are always synced.

web development – Is it possible to build a QR scanner in a web application?

web development – Is it possible to build a QR scanner in a web application? – Software Engineering Stack Exchange

powershell – SendKey to an application

I’m trying to make a tool that allows me to enter a pre-defined set of keys (arrows keys) and as soon I click ‘Run’ or something similar I want to have the pre-defined set of keys being sent to the application that is open. The input delay doesn’t matter.

The pre-defined keys could be a textbox that is shown or could be a file that is opened.

I know there’s multiple ways to achieve this but I’m trying to do this with PowerShell or Microsoft Visual Studio. I did some digging in codex but I’m unable to figure it out myself. I tried the set-clipboard and get-clipboard but I’m not sure what I’m doing wrong.

Any help would be appreciated.

multithreading – What will you do if multiple users access your application at the same time?

I’m an experienced Software Engineer but very weak in concurrency because of no prior experience in that. I’ve been interviewing with several companies in which I was asked similar kind of questions as given below:

  1. If you are designing a fantasy sports application in which there’s a contest which can handle only 100 users. If 99 users are already registered for the contest and multiple users hit the PARTICIPATE button at the same time to become the 100th user, then how will you handle this in your application?

  2. If you are designing a chess game, where multiple users are selecting the users of same level of competence to play with them. Then suppose at same time, users A and B choose the user C (to play with) at the same time, then how will you handle this?

I usually answer this by saying that I’ll use synchronized block in Java or on Database side, I’ll use Locking concept. But I’m not sure of either of them. So, can anyone tell here how do you answer such questions? Should one answer this in terms of Java Multithreading or DBMS or both?

java – Are experienced developers and software architects able to describe an entire software application in terms of design patterns?

A common misconception among developers is that you can describe an application, or build an application, entirely by bolting together design patterns. Writing software is not a matter of choosing design patterns, arranging them properly, and then shipping a product. Software development has not become quite that modularized. If developers cannot build software entirely composed of design patterns, then software architects cannot have conceptual discussions about software entirely composed of design patterns.

A design pattern is a specific problem coupled with a general description of how to solve that problem. It is a tool for communication, primarily, so I can see how someone might think architects can speak in terms of design patterns. They do speak in terms of design patterns, but there is not a design pattern to solve every problem. Instead, architects will speak and think in terms of the bigger picture elements of software design. Design patterns are certainly part of an architect’s vocabulary, but it extends far beyond that. Design patterns, architectural patterns (onion architecture, clean architecture, micro services architecture), design philosophies (domain-driven design) and design techniques (separation of concerns, interface segregation principle, polymorphism, encapsulation, data hiding, etc) can be the main tools of communication.

So, no. Architects cannot describe an application entirely using design patterns. They need architectural patterns, design philosophies and techniques as well.

design – What are the benefits of having database in separate instance to main application?

Database systems generally don’t have fixed overheads – for instance, a table or index can be loaded from disk on demand or stored in RAM, with the same result but different performance. As such, many database systems are designed to make maximum use of available resources – they will claim as much RAM as allowed from the OS in advance and manage it internally, and assume they can use whatever CPU cores exist.

That strategy means they don’t “play nicely” with other applications on the same instance, particularly those with unpredictable resource needs. You can set a limit for what the database preallocates, but set it too low and you waste resources, set it too high and your other applications can’t deal with short bursts in demand.

Running two instances frees you from worrying about that conflict, and lets you pick appropriate resources for each part.

licensing – Desktop application: preventing abuse of online license scheme?

Software companies like Autodesk, Adobe, etc all offer online licensing schemes with the following features:

  • (1) to use the software, you must login from your workstation to activate your license
  • (2) the software may phone home periodically to ensure the validity of your license and also tell the license server that the license is in use
  • (3) once you activate your machine, if you lose internet you can still use the software for a period of time (often days/weeks)
  • (4) you may migrate your activation from machine to machine, but not activate multiple machines simultaneously

What I don’t understand is how (3) and (4) are implemented without easily being abused. What’s to stop a user from activating a machine and then denying the application internet access once the license is authenticated? Lack of phoning home from that point on will cause the license server to think the machine is offline (2), allowing you to authenticate a different machine in accordance with (4) while continuing to use the software on the previous machine (3).

Surely there are ways to setup a license scheme like this without enabling such an easy bypass…but I’m having a hard time thinking of any. Of course one idea would be to keep some application logic server-side, requiring an always-online connection, but that precludes (3), which is important for mission critical software.

Any ideas?

networking – Do I have to duplicate implementations on a client server udp application

I think the question is pretty straight forward but just to clarify, if the client and server are separate machines and need to be able to communicate with each other, does that mean that certain aspects such as synchronization, ack packets, re transmitting, timeouts, etc need to duplicated between the client and server?

For example, if i creating a polling program that switches between sending and receiving messages, would I need to have the same service on the client and the server?

I know somethings will be different. For example the way a client handles inputs from the server may be different then how the server processes input from the client.

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies 5000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies New Proxy Lists Every Day Buy Cheap Private Proxies; Best Quality USA Private Proxies