Answer the question
In order to leave comments, you need to log in
Have I properly planned the architecture of my project?
Good day!
There is a project (c#, visual studio 2010) that parses XML (>500GB) and puts it into a database (ms sql 2005).
I ask you, dear community, to express your opinion about the architecture:
The following classes (pseudocode) are defined:
1. Static class Storage;
This class is designed to store objects of the Packet class. Basically, it's a queue. Methods for adding and retrieving objects are defined.
2. Reader class;
A class that performs sequential XML reading. Creates a Packet object and adds the read items to the packet until the Packet object is full. Once the packet has ended, it is added to the Storage queue for processing.
3. Writer class;
Takes an element from the Storage queue (remember, hollow packets are added to the queue) . The element is a package. Next, the data from the package is added to the database.
4. DataBase class;
Class for working with the database (connection, methods for adding and changing data)
5. Class Packet.
A package is a collection of elements from XML. There are methods for adding data to a package.
How it all works - when the application starts, a connection to the database is opened.
An object of the Reader class is created and reading the xml file, forming packages and adding them to the queue begins in a separate thread. The Writer class is created in the main thread, it has a Write () method that takes threads from the thread pool, each thread from the pool takes one packet from the queue (Storage) and sends data from the packet to the database. All this works until the end of xml and the queue is empty.
Let me know what you think and what needs to be improved/reworked.
Thank you for your attention!
Answer the question
In order to leave comments, you need to log in
My advice to you is to write with TDD. Then such questions will not arise, build the optimal, minimum and supported architecture in a natural way
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question