Reputation: 539
I have written a program that's has two thread. One is to to display the status of the current operation.
Another is much more complex. It is used to connect, login, download, unzip files, open images, zip it back then upload back to server.
How can I break it down to a more manageable level? Kind of confuse on how to process from here. Should I put every single one in a separate thread?
Please give advice. Thank in advance.
Upvotes: 2
Views: 64
Reputation: 39164
I think that using a thread for every single operation isn't a good idea. Thread are useful but also hard to debug and need to be synchronized.
According to your problem description, i'd use max 3 threads with the following job subdivision:
Putting the connection management into another thread allow your application to perform that job in "background", while your other thread is processing avaible files. Anyway, from my point of view, if your application requirements are simple enough and don't require strong interactive responses you could do everything without threads or with only 2 threads like you did since now.
Upvotes: 1