Some design chit-chat.

Sep 26 2003 10:44 AM
Let me just talk this out a minute. Maybe I'll find answer I like just "talking it out" or maybe one of you fine folks will show me an epiphany. So, I'm writing this library to do HTTPS GETs and POSTs to transfer data back and forth. Once the company FINALLY got me the proper api docs and I was able to see that the URLs they gave me via email were way off the mark, I got the whole basis working. Now I have this "main class" that I call the Interactor (which incidently follows an established interface and plugs into a Job Framework I've deployed) and it's responsible for creating specific HttpWebRequest and HttpWebResponse objects and doing all the basics. It's all working fine. Now I've created an enum for the basic commands... the common stuff... to tell it whether it's fetching a file listing, it's about to fetch a specific file, post data, etc. Like so: (the array uses the enum entity as its index) private static string[] pCommands = { "/bp/api/getMOD?", "/bp/api/fileListing?dirType=client", "/bp/api/tocListing?", "/bp/api/getFile?", "/bp/api/uploadFile?", "/bp/api/getReport?" }; public enum BearCommand{ GetMOD = 0, GetFileListing = 1, GetTOCListing = 2, GetFile = 3, UploadFile = 4, GetReport = 5 } Now let's say you had to provide url parameters in typical url fasion (someparm=somevalue&someotherparm=someothervalue&andso_on=andso_on). Would you simply require the client to know what it's asking for, or would you typify and objectify them in say... a series of classes that inherit from something like: public interface IOption{ string key{get;set;} string val{get;set;} } and require that your function call also allow for something like (IOption[] options) or just use a hashtable (perfect for key/value pair storage) or would you do something else? I'm tossed as to what to do.

Answers (2)