简体   繁体   中英

Good design practices for concurrent access

I am developing a Java application that analyzes excel files. These files have different formats. So, in order to analyze the first thing I do is get the location of the cells that contain the variables who uses. To make each analysis the application accesses the file. The application consists of a main module that invokes the other sub-modules. So the question is: In terms of good design practices, which is better: 1) Leave the location of the variables in the main module and pass them to the submodules, 2) Or, each module find the location of the variables again. Thank you in advance.

Keeping location of the variables in one module gives you an opportunity to monitor the access from that module, in case of concurrency. This is actually a known practice, to create a module/class responsible for giving access to certain data (little analogy: the monitoring class is responsible for giving keys to locked boxes, so that you do not need to protect boxes from concurrent access themselves - you just need to protect the keys)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM