Click here to Skip to main content
15,666,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need some validation and thoughts from members on this forum.

I'm working on research case for my area of the application (we are micros services based) to make sure that two users can not perform the same operation at the same time. Basically, locking. Specifically, a user can not enter data for report while the report is being printed/generated.

The feature can be easily implemented by having a simple table that has is locked flag etc.

I could create a very specific locking logic that serves only my area of application or I can create "Locking" micro service and built it generically so that other modules (Micro Service/Workflows) can also utilize them and don't repeat them.

So I'm being reminded by "YAGNI" principle. But I disagree. Locking is a need for my application as well as other applications within the system. So instead of each component defining their own logic, I think it better to create a common locking service which is flexible in design so that other applications can also utilize it.

What do you guys think? Am I breaking YAGNI?

What I have tried:

I have read about Yagni principle. And tried to ascertain if this situation falls under it?
Updated 30-Jun-22 11:18am
Gerry Schmitz 30-Jun-22 21:29pm    
"Tables" per se are not application specific. By default, you're creating something that anybody that wants to locks a table should be able to use. The question is, who's going to use it? "Table locks" are one of the worst "sharing" strategies. One "locks" a document, period, etc.; one is rarely justified in locking a table.

1 solution

I used to develop in-house application frameworks, and this is exactly what I did. I would read the specs for what was being developed in the upcoming release and then implement components that I thought could be used by more than one application. Your example sounds like something that would eventually be used by multiple services, in which case YAGNI does not apply.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900