Tag Info

New answers tagged

4

In this case, CalcFoo() should take in an OsEarnDetailPoco. The method signature then becomes CalcFoo(OsEarnedDetailPoco data). Services are typically injected in a DI architecture. Data is usually passed around through method calls.


3

In a Microservices architecture, each one is absolutely independent of the others and it must hide the details of the internal implementation. If you share the model you are coupling microservices and lose one of the greatest advantages in which each team can develop its microservice without restrictions and the need of knowing how evolve others ...


2

The usual approach is to isolate those microservices as much as possible - treat them as single units. Then transactions can be developed in context of the service as a whole (ie not part of usual DB transactions, though you can still have DB transactions internal to the service). Think how transactions occur and what kind make sense for your services then, ...


1

I think if consistency is a strong requirement in your application you should ask yourself if microservices is the better approach. Like Martin Fowler says: Microservices introduce eventual consistency issues because of their laudable insistence on decentralized data management. With a monolith, you can update a bunch of things together in a single ...


2

If two services are sufficiently intertwined that it would be a pain to implement them without sharing DTOs and other model objects, that's a strong sign you shouldn't have two services. Certainly the example makes little sense as two services; it's hard to imagine a specification for 'User management' so complicated it would keep a whole team so busy they ...


1

I think the standard wisdom is to never have transactions cross microservice boundaries. If any given set of data really needs to be atomically consistent with another, those two things belong together. This is one of the reasons it is very hard to split a system into services until you have fully designed it. Which in the modern world probably means ...


4

Systems such as RabbitMQ (or in your case maybe look into Kafka) can offer persistence, or guaranteed delivery, as well as configurable TTL on messages. However, they are not designed as a long-term persistent storage solution, and if we're talking about days, I would actually store the job in a DB as you suggest.


1

You can have as many models as you need to meet the many goals that a successful application has to address. One concept that might help here is the Single Responsibility Principle. Basically, you ask the question, "what would cause this data structure to change?" In your case, changing the details of the quiz structure would be a prime source for change. ...


0

As an example, floating-point arithmetic often has high throughput, but also high latency. For example, you might be able to start two multiplications every cycle, but it might take five cycles until the result of a multiplication is available. The first is called throughput (two per cycle), the second is latency. If you perform calculations so that one ...


1

An application is called memory-bound if it requires a lot of data from memory, so most of its execution time is spent reading and writing data. Latency-bound can be thought as a subset of the memory-bound category and it occurs primarily when you don't retrieve too much data from memory at once, but you have to wait a lot to get the data close to the ...


3

How can I convince them that this is a bad idea? It might not be a bad idea. I've seen not a few systems where each event got its own tiny handler class, and the handlers were discovered and dependency injected at runtime leading to a fairly huge fragile mess. Without knowing what you need to do, and what you might need to eventually do, it's hard to ...


2

There is an anti-pattern - God Object. Just like you stated, God Objects: are hard to maintain usually violate one or many SOLID principles. impossible to understand for new developers hard to locate functionality in for new developers do not describe system at first glance at file structure etc. Having module controller is quite OK actually, something ...


3

You say that the example is artificial, so I don't know if what I'm saying here suits your actual situation, but my answer is - use an ORM (Object-relational mapping) layer to define the structure and querying/manipulation of your database. That way you have no duplicated logic, since everything will be defined in the models. For example, using the Django ...


1

I've written a silly example to explain an idea: class BinaryIntegerOperation { public int Execute(string operation, int operand1, int operand2) { var split = operation.Split(':'); var opCode = split[0]; if (opCode == "MULTIPLY") { var args = split[1].Split(','); var result = ...


9

As lxrec pointed out, it'll vary from codebase to codebase. Some applications will allow you to put those kind of business logic into SQL Functions and/or queries and allow you to run those anytime you need to show those values to the user. Sometimes it may seem stupid, but it's better to code for correctness than performance as a primary objective. In ...


0

I would strive for data-driven design. This means that your code is driven by customer specific data. This data may be stored in database or configuration files or whatever suits you best. This way you don't have to build different binaries for each customer with the conditional build directives. In cases where you need different behavior for different ...


1

First thing you should check is how many lines of code a typical Organization class implementation has, and how it is structured. If it has less than 100 lines of code, and the class consists mainly of properties providing some flags or data, do not worry. If it has more than 2000, and it contains a lot of business logic, you should consider to split it into ...


1

I think you are almost there. You are getting the State and the Strategy. The way of selecting maybe would be a Factory or a Builder maybe reading a configuration file or a database just as you pointed. At the end it will depend on your own requirements, but the strategy mixed with the Factory or a Builder Pattern to create the object which contains the ...


1

I would define "application core" as either code or library, that every other code or library depends on, and without it, it cannot function. It should contain only critically necessary features that your application needs to run. It shouldn't contain any domain logic nor models. In case of the article, it seems the "application core" is primarily managing ...


3

At a high level, you're essentially asking: Is building a Controller cache better than using singletons? I would argue that in your situation, yes, it is. And here's why. From your description it doesn't sound like you need the semantics of a singleton here. Your game would be just fine if you instantiated a new Controller every time one was needed. In ...


0

Maybe you are missing a layer. Without knowing the details of your application (requisites, architecture, etc) I would do something like Client (whoever it be) -> Application Service -> Domain Model The application service layer is allowed to interact with the repository and the domain model containing the business logic. So you can have something like: ...


3

In an app like this the "tiers" are usually various parts of the same application. You could write it as multiple JARs packaged into a single deployment, but the different tiers are more about separating the different concerns in the code than putting physical distance between them. If you were to put the data access on a separate machine, you would need ...


1

A Factory or Factory method is a way of creating objects without having the calling method be aware of the specific class of object that is being created or the dependencies it has. It takes away the complexity of instantiating objects for which (some of) the properties are not known at code-time but can only be known at run-time. Your Entity Translator ...


1

Consider the three pillars of OOP: Encapsulation: The capability to hide data and instructions inside an object Inheritance: The ability to create one object from another Polymorphism: The ability for objects of a derrived class to override/extend/inherit properties and methods from a base class If these benefits do not offer any real value to solving ...


2

There are several ways to look at this. One way is from the point of view of data abstraction. (I'm going to ignore looking at this from the perspective of programming paradigms, since @Robert's answer already does a good job.) The two most popular forms of data abstraction in use today are Abstract Data Types and Objects. (Actually, there is a rather ...


2

First of all, don't confuse OO modeling with OO programming. Most modern programming languages are more or less OO and can be used to implement most designs whether they have been derived using OO modeling or not. I can write a program following a relatively procedural design (or event-driven, or some other style) and still use Java Collections with their ...


1

The send function is a red herring, because it is unrelated to the basic question, which is whether you should have each employee know their office, or whether you should have each office know which employees are in it. The send function does not affect, nor is it affected by, the answer to the basic question. It probably should not be a function of either ...


1

The best logging is just to format it as a readable string and persist that. Possibly including the data as a block of data that is accessible to programs as well. The reason I say this is that I am continually looking at Windows Event logs, which uses a "we write the data and a link to a resource dll containing format strings" pattern, and invariably the ...


1

Because of low reputation, I am not able to post a comment, but I feel I can contribute to this given answer The concept Phill is describing comes very close to the EventSourcing Pattern. If your systems contains several types of Events, consider such an implementation. The overal flexibility, as mentioned by Phill, will drastically increase since you don't ...


1

As far as the SQL side of things goes, there is opportunity to optimize, but it depends on what you want to optimize around. If you are seeking to simplify queries or speed up performance, denormalization is one way to achieve this. For example, you could include the client_id in the comment table in addition to the blog_id given that it appears that blogs ...


4

I find it hard to give general solutions of this kind since system architecture is always highly depending upon the entire domain. If routing packages to employees is a main concern in your system, maybe neither Office nor Employee have to know about how they relate to each other. You could also think about an additional Entity of your system, like an ...


2

One thing I see with the first example that could lead to confusion is that the Employee is not sending the package, they are receiving the package. I think the send method leads to confusion that the Employee is sending the package, when the Employee is receiving the package. I think the second example is better. The SomeOffice class has a reason to keep a ...


2

If you want consistency, then using a class for each error condition gives you just that - wherever you want to mention that a volume has grown in size, you create an instance of a VolumeSizeIncreased class, passing whatever values you need into its constructor. To me, it's the next step after rigidly codifying your errors (your VOL_SIZE_INCREASE value). ...


3

This is related to constraint-programming. Prolog is an example of such a system. There exists javascript implementations of prolog http://yieldprolog.sourceforge.net/ . You could then make your prolog program and use it on both the server and client. Another approach is having all the logic on the server side but expose it as an api which the client could ...


0

REST alone is too primitive, really. You can get started with REST, but eventually, your rich application will need queries with joins and updates with transactions. Every developer attempting to add these things on their own would be error prone and inconsistent. Fortunately, there's an emerging standard called OData that does just that. It layers on ...


5

Uncle Bob once said: "We don't ship shit...". Working with legacy tools(IE 9) and scraping website you are: Spending significant amount of time on unscalable, potentially unreliable technology. Introducing very custom component understanding which would require future developers a lot of time understand and potentially will cost you a lot more in along ...


1

You should never ( as in never ever EVER) lock any resource while waiting for a user interaction. At some point some of your users will take off for a long weekend leaving some vital records locked. Ah but you won't let that happen because you have some clever time out/deadlock resolution scheme; then at some point this will go horribly wrong and a user ...


0

I'm not very experienced in these terms exactly but I've done a lot of serialization with really complex data types with all kinds of weird dependencies, so here's my 2 cents on managing your POCOs(TLDR; keep them POCO). I have identified some cases where we would actually need to parse the API response data on runtime. Could this be construed as a ...


1

Using tokens is very common in APIs, these tokens are usually sent as a header and have a clear life cycle. Think for instance OAuth. Regardless of your programming language or framework, REST APIs are similar. I can think of several scenarios where you want to limit concurrency, two of them are: Multiple clients updating the same resources like a ...


1

In CQRS, queries are not allowed to have any side effects, and thus they cannot change any data. Commands on the other hand must not return any data, but change the state of the application. With these definitions and your problem domain the question becomes this: What does the search functionality do? If it's purely for finding an order, then it is not ...



Top 50 recent answers are included