thombergs / buckpal

An example approach for implementing a Clean/Hexagonal Architecture
https://leanpub.com/get-your-hands-dirty-on-clean-architecture/overview
2.18k stars 666 forks source link

NoOpAccountLock bean is not clear #18

Closed novicedev7291 closed 3 years ago

novicedev7291 commented 4 years ago

Hi Tom,

I read your book and explore the repository associated with it and I must say my long search for clean architecture implementation with spring and java, have reached to some conclusion now. It helped me understand few misconception about dependency inversion and SOLID principles and I am still trying to embrace it for large enterprise project.

However, I am not able to understand the lock and release part in code, although I do understand it in context of business domain but not sure if you have just demonstrated it with dummy singleton bean or is it real implementation of locking behaviour in this context?

Thanks a lot for sharing your thoughts with a book and all the resources online.

thombergs commented 3 years ago

Hi @novicedev7291,

you're right, the lock is just a solution so that we can't make two transactions on the same account at the same time.

I was too lazy to implement a real version of the account lock, but in a real application, the AccountLock interface would have to be implemented in a way that it locks an account across multiple nodes of the application. The easiest way would probably be to use a database lock if we're using a SQL database.

novicedev7291 commented 3 years ago

Thanks for explaining this, Tom.