New answers tagged

1

If i were building this i'd use a set of stateless processors orchestrated by queues or a service bus with a resilient, scalable DB in the back end. For example, publish a queue for the list of hosts to be checked. Have a stateless "checker" node which can be run on e.g. azure functions, AWS lambda etc. and which picks the next item from the queue (and ...


0

Keep a queue of reminders sorted by the moment they should go of. Set a thread to wake up – moments before – the first one. When the thread awakes, verify the time. There are three cases: The notification should have happened at the past. You need to decide how are you going to handle this. The notification should happen shortly in the future. Set a timeout ...


1

Enumerate your requirements. Measure the available products against those requirements. Choose correct behaviour over perceived market niche. Other things being equal choose the one which is "cheapest". Eventually something will fail in your pipeline. What do you want to happen in this circumstance? Can messages be lost without harm being done? Do ...


0

I think you should develop a Service Layer. EF --> Service Layer --> Domain Aggregates Define your domain Aggregates in terms of the business operations you want. For example, the method GetInvoice will return an aggregate containing the customer information, shipping address, product line items and quantities. If you do this, I think you will ...


5

If the users of those "client PCs" have full administrative rights over their computer, then there is no technological way to prevent them from disabling or removing your service. And if there were, you would also be locked out if the service was no longer needed or if it malfunctions. If the users don't have administrative privileges, then it is just ...


1

It doesn't really have anything to do with microservices. Stored procedures can make sense if your service has an 'old-style' layered architecture in which the DB is the foundation of the service, with data access and business logic layers on top. The interface between the service and the database in such an architecture is very specific to innermost ...


2

Let's first get rid of a misconception The microservice architecture "structures the application as a set of loosely coupled, collaborating services": Collaborating mean that microservices may need to work together to achieve a higher objective. They may therefore need to know (or find out) how to work with other microservices, and perhaps even to rely on ...


8

I'll preface my answer by saying that I actually maintain a couple microservices that use stored procedures. Also I've written a lot of stored procedures at various points in my career, and I definitely agree that things can go very, very wrong if they are used incorrectly. So the short answer is, no, stored procedures aren't inherently bad in a ...


0

Cyclic dependencies between microservices should not exist because dependencies between microservices should not exist. No dependencies: no cyclical dependencies. Here's a (slightly edited) quote decent article to get an overview of the idea: If you keep that in mind, you can develop microservices that are independent single functions, and not slide ...


0

Yes. Microservices are (by definition) independently deployable and scalable chunks of code. When you have a cyclic dependency, you can’t deploy one part of the cycle without the other. You lose the main benefit of microservices, and would be better off shipping the cyclic bits together as a larger service.


1

Complementing the answer from @sentinel, seems that there isn't a wide-convention for placing the CORS headers. I'd say that: I'd place the logic in the server if: The infra relies on a different team within the company and I prefer not to delegate it. I need to build dynamic whitelist of hosts, depending on server logic (never seen this scenario though) ...


4

Stored procedures are implementation details. Database functions, lambdas, or a shell script stored somewhere in the file system are all implementation details and irrelevant for the architecture. most books on microservices recommend one database per microservice. Ok, so we can code the stored procedures in these databases. again most microservice ...


22

To write software requires that you tightly couple to a technology. At the very least to the runtime environment provided by the programming language being developed within. More generally though you will find that your micro-service is tightly coupled to several technologies: Network Service Framework to provide high level HTTP/SSL/SOAP protocol ...


43

There is nothing that explicitly forbids or argues against using stored procedures with microservices. Disclaimer: I don't like stored procedures from a developer's POV, but that is not related to microservices in any way. Stored procedures typically work on a monolith database. I think you're succumbing to a logical fallacy. Stored procedures are on ...


0

Ah, the ever-elusive cost of change! Indeed, this is one of those things that, in retrospect seem too obvious, but at the beginning, nobody could have speculated at all. Well, if there ever was a wicked problem in software development, predicting the cost of change might be it! Books sometimes do like to talk in the impractical, e.g. what happens inside ...


0

One of the solutions i've seen is to move shared data to eventsourced aggregates and make it publicly availible to any service that need this data. You may use Kafka or Eventstore to store them. In case of Kafka eventsourced topics are used by another microservices through streams API for example in form of tables with most actual state and new events that ...


0

I'm not exactly sure of your architecture from your description. But just to be clear, your dbcontexts, repo and UoW should be instantiated per request, which should also allow for them to be per tenant. You can either instantiate one of those objects with the tenant information for the request (what I would suggest), or you can pass the tenantId down from ...


6

This is fundamentally a user experience question. Test this with actual users! From a software engineering standpoint, any approach could be correct here. A solution that might work well in practice would be to add the global operations to the undo list of the most recently active document. Alternatively, consider representing the global resource as its own ...


0

The CPU will always behave as if all instructions were executed in program order. If the CPU can’t reorder instructions and guarantee correctness at the same time, it won’t reorder. If both addresses for load and store are known, the CPU can check that there is no conflict and do a store to location y before a load from location x, if the locations are ...


3

Should every aggregate be a single microservice and have a single DB ( since every microservice should have a single specific DB)? Most discussions that I see align "microservice" with "bounded context". Back at the start of the millennium, when Eric Evans was working on his book, the usual design was that you would have "all" of your domain model stored ...


1

You try to map two orthogonal concepts: The DDD concepts are used to design the domain objects and domain logic of your application; Microservices is an architecture style that guides the distribution and deployability of an application's functionality. SO there is no clear map between both. Aggregates The DDD aggregate says something about the ...


1

Out of order execution is a microarchitecture detail. The CPU may reorder instructions only when this doesn't change the observable or specified behaviour. Here, this can be achieved in one of two ways: When the CPU issues a speculative memory access but that speculation was wrong, the CPU must roll back the effects of speculative execution. When there are ...


1

The short answer I expect that the predominant consensus to this issue is going to be in favor of separation as much as possible. While I absolutely agree with the underlying intention of this consensus, I somewhat disagree on the degree to which it is (almost blindly) applied as a blanket rule. The rest of this answer focuses on the parts I disagree with, ...


0

I see this as a perfect example of using stream processing pipelines such as Apache Kafka (or Apache Flink). The rationale to use them is that you can add as much producers (Java app) or consumers (Python app) as possible. You also do not have to worry about if they work in different speeds as Kafka will buffer it. Before passing the data to Kafka you ...


0

It looks like you don't really have any logic here. Its all validation and persistence. Basically its a pretty simple conversion though. ADM class Service { void SendPackage(User user) } class User { string Id; string Name; } Fat Model class User { string Id; string Name; void SendPackage() {...} } I would keep the repo ...


3

I feel whole purpose of DI is defeated. Why ? Because if MyProj.MiddleTier has hard dependency reference of MyProj.DAL then I cannot simply switch to another persistence technology tomorrow without recompiling MyProj.MiddleTier. No it's not defeated. Goal of DI is to abstract away dependencies, reduce coupling and facilitate testing with mocks or stubs. ...


2

I think what you're experiencing is a sort of "dependency leak", where the "implementation details" of one layer is leaking into another layer. EntityFramework is notorious for forcing this onto unsuspecting developers. Basically the best way to avoid this is the following: MyProj.DAL is made up entirely of classes that only take DTOs (or plain classes) and ...


2

Yes, this is possible. Logical architecture : Use UML2 component diagram(s) showing components, interfaces, usage dependencies etc. Physical architecture: Use UML2 deployment diagram(s) showing nodes, communication paths between nodes, operating systems as deployed elements inside nodes etc. but not the components. Mapping: Use UML2 deployment diagram(s) ...


2

Within this process of mapping, it is not allowed to modify the logical and physical architecture models, only a respective third model should be produced. The two former models need to be read-only, as any number of independent mappings is possible. If this is truly a requirement, UML (and most modeling tools and frameworks I'm familiar with) isn't a ...


2

First point - For simplicity, the answer by Rumen is correct. What I do in larger solutions is to have a separate Infrastructure project which set's up the dependency injection container (in .net core, this would be the IServiceCollection). For example in my current solution I have both a Website & an API. Both of these call methods in my ...


0

Well, making inner joins of multiple objects is not what mongo is for. What you are trying to do is to force a SQL object model inside a NoSQL database. You are left with the following options : Denormalizing heavily your model. E.g. getting necessary details of a user inside each comment. Getting group details into every user. This have drawbacks such as, ...


1

Why not just let both apps read from the same database? Or if you cannot do that, you could write the data to S3 with one app and read it from S3 with the other app. The target app can listen to events in S3 for every file which is written and then just load it. Maybe I am oversimplifying it but it seems easy...(?) There is also Snowflake SQL www....


1

You'll hate my answer, but here it is - it depends on the use case. While syncing with the server, you generally, want to achieve two things: have the latest data state at all paries as soon as possible (server, client) have the smallest number of requests and transferred data To achieve this, you must familiarize yourself with your business ...


0

It's really hard to say where do you draw the line between single and shared ViewModel usages. As a rule of thumb, I would use shared ViewModel in the case and only in the case when two or more views create an inseparable logical unit, but because of the screen size, they are separated in multiple views. For example, if you create some very long object, ...


4

Is it acceptable to invoke business logic inside the repository layer? The DDD police are not going to come and kick down your door. But... The motivation for the repository pattern is to "decouple application and domain design from persistence technology". So adding domain logic behind the repository interface rather defeats the purpose. It also makes ...


3

The last 20-40+ years of systems development can be seen as largely trying to manage the tension between the fact that users want freedom to do what they want in a system, but the owners of the system are more particular. The owners don't want the database screwed up, they want some things secret and some things not, things that are secret are only secret to ...


5

one could just pass a client-formed SQL query straight to the DB engine, and be safe Nope. Let's assume that your security is perfect. I can still write a long running query that locks your tables. saving one conversion layer in our app. Unlikely. User management, auth tokens, serialising, versioning, fail over etc mean that you are probably going to be ...


1

An analogy that made me understand the difference between Sync vs Async vs Multi-threaded is that of a cook in the kitchen. Imagine you are making pasta. You have three steps: Boil and drain the pasta Prepare sauce Combine pasta and sauce Synchronous method. In synchronous scenario there is only one person (thread) doing all the work in sequence. First ...


2

Concrete Examples I would like to add some real-world examples, and connect them to the software engineering world. First, consider something that I hope matches your intuitive definition of "synchronous": the flashing of fireflies, under some circumstances. Second, consider the 4x100 women's Olympic relay race. Third, consider that old trope from ...


12

Asynchronous: not existing or occurring at the same time. Synchronous: existing or occurring at the same time. The async attribute means that the script will be executed as soon as it is downloaded even if the html is still parsing, which means both processes exist at the same time to me. This is indeed confusing! Consider instead the meanings of ...


0

I think the key of your confusion can be summed up by: The async attribute means that the script will be executed as soon as it is downloaded even if the html is still parsing The thing to realise is that this sentence does not make sense because it describes an impossible situation. If the HTML is still parsing then the script download process would not ...


2

Imagine two satellites orbiting Earth. Satellite A has a period of rotation around Earth such that for every full rotation of the planet, the satellite has gone around Earth more or less than one time. Satellite B has a period of rotation around Earth such that for every full rotation of the planet, the satellite has gone around Earth exactly one time. ...


0

"synchronous" means that two events occur at the same time - but which events? When we say "synchronous execution", we mean that the caller and callee are executing (i.e. on stack) at the same time. That's probably the meaning you are after. When we say "synchronous logic gate", we mean that the logic gate is synchronized with the cpu clock. When we say ...


1

One way to think about it are SIMD instructions, like AVX. Here are some examples of how they are used. Synchroneous SIMD instructions allow you to do multiple calculations at precisely the same time, in the same thread, by operating a Single Instruction on Multiple Data. While asynchroneous multithreading allows you to do multiple calculations at "...


6

I'm an electrical engineer, and we dealt with synchronous vs asynchronous in logic circuits (logic gates). Let's say you have an AND-gate (or any gate), which has two inputs, and an output. If it is asynchronous, it will update its output the moment any of the inputs change in such a way that the output changes. This is how your example worked - the ...


48

I would like to give you an answer which is directly related to those definitions you found. When one task T1 starts a second task T2, it can happen in the following manner: Synchronous: existing or occurring at the same time. So T2 is guaranteed to be started and executed inside the time slice of T1. T1 "waits" for the ending of T2 and can continue ...


0

A good question, and terms that are often used in different ways that lead to confusion. My answer is that these terms are relative — and what they are relative to is the main program that is executing (or sometimes to a thread). These terms specify something about the internal operation & timing of a program, as to whether messages are sent or ...


21

I find that the best way to understand it is the following: Synchronous: We know when it will happen (it happens when this other code ends). Asynchronous: We do not know when it will happen. Note: while we can schedule code to be executed a given clock time, in practice we do not know when it will happen, because it can be delayed – even ignoring messing ...


0

What you are doing is a total and utter waste of time and completely useless. It introduces way more problems and complexity than needed. There are two things to balance in every design that must be taken seriously: Coupling: You seem to think you know that coupling is bad, and it is in most cases, but reducing coupling at the cost of cohesion is even ...


4

The entry point of the application (the UI project) must setup the DI container, providing implementations of all the dependencies. That's why it must have direct connection (reference) to all the other projects. What is important is that the UI classes have dependencies only on BLL classes. The additional references are only for setting up DI.


Top 50 recent answers are included