What is the right way to group this project into classes?

Posted by sigil on Programmers See other posts from Programmers or by sigil
Published on 2012-09-19T22:53:26Z Indexed on 2012/09/20 3:50 UTC
Read the original article Hit count: 168

Filed under:
|
|

I originally asked this on SO, where it was closed and recommended that I ask it here instead. I'm trying to figure out how to group all the functions necessary for my project into classes. The goal of the project is to execute the following process:

  1. Get the user's FTP credentials (username & password).
  2. Check to make sure the credentials establish a valid connection to the FTP server.
  3. Query several Sharepoint lists and join the results of those queries to create a list of items that need to have action taken on them.
  4. Each item in the list has a folder. For each item:
    • Zip the contents of the folder.
    • Upload the folder to the FTP server using SFTP
    • Update the item's Sharepoint data.
  5. Email the user an Excel report showing, e.g.,
    • Items without folder paths
    • Items that failed to zip or upload

Steps 2-5 are performed on a periodic basis; if step 2 returns an invalid connection, the user is alerted and the process returns to step 1. If at any point the user presses a certain key, the process terminates.

I've defined the following set of classes, each of which is in its own .cs file:

SFTP: file transfer processes

DataHandler: Sharepoint data retrieval/querying/updating processes. Also makes and uploads the zip files.

Exceptions: Not just one class, this is the .cs file where I have all of my exception classes.

Report: Builds and sends the report.

Program: The main class for running the program.

I recognize that the DataHandler class is a god object, but I don't have a good idea of how to refactor it. I feel like it should be more fine-grained than just breaking it into Sharepoint, Zip, and Upload, but maybe that's it.

Also, I haven't yet worked out how to combine the periodic behavior with the "wait for user input at any point in the process" part; I think that involves threads, which means other classes to manage the threads...

I'm not that well-versed in design patterns, but is there one that fits this project well?

If this is too big of a topic to neatly explain in an SO answer, I'll also accept a link to a good tutorial on what I'm trying to do here.

© Programmers or respective owner

Related posts about c#

Related posts about design-patterns