I'm creating my first class - it will be handling 'running of selected action/s' and action will run is based on 100s of options.

I'm creating my first class - it will be handling 'running of selected action/s' and action will run is based on 100s of options.
I have around 300 actions/options grouped in 20 categories. So, I was thinking of having 20x overloaded procedures that will accept different parameters - that control running actions. Because of so many options, I was thinking of creating enums and have them as input parameters - this way I will be able to see in code completion/insight what kind of parameters I need to use to control running specific action.

I hope this simple example shows what I' working on:

// example of categories and actions
TSuperActions = (saNone, saSuperProject, saSuperGroup, saSuperSubGroup);
TMajorActions = (maNone, maClearData, maDeletAllData, maRepairData);
TMinorActions = (miNone, miDeleteRecords, miPrepareInfo, miPrepareForExport);

RunActions = class
...
public
...
procedure RunAction(aProjectID: integer; aSuperAction: TSuperActions = saNone); overload;
procedure RunAction(aProjectID: integer; aMajorAction: TMajorActions = maNone); overload;
procedure RunAction(aProjectID: integer; aMinorAction: TMinorActions = miNone); overload;
...
end;

As these actions will be called from various TreeViews in my project, I would like to have code completion help me use correct method, without looking into class definition every time:

RunActionsClass.RunAction( CurrentProjectID, ... <- here I would like to see what options I can use

The first code completion shows me all options of types of arguments (picture1).
This is great, then I can decide which argument to use (based on what action I need to have run) - since TSuperActions start with 'sa' , I can start typing 'sa' and press Ctrl+Space to see options, and it does show them to me (picture2).

Since this is a lot of work and before I spend days designing this, I was wondering if I'm designing this completely wrong and there is better solution?


Comments

  1. David Schwartz I have File backup limit at 90 , too. This also means that my project folder jumped to 600MB+, from 150MB, but still better than losing anything. I use local drives, backup drives and some online backup solutions, too.

    David Heffernan I guess I will have to try it. It can't hurt, i just need to put some time into it. I don't have any servers or similar additional PCs, so I will have to have all on my work PC. I guess this shouldn't be a problem.
    I was playing with TFS 2012 for a while, since I need to for my customers - it just seems so bloated and always something is off.
    Git - I only tested a bit, again not for my purpose, and those commands... just couldn't get used to saving every single command in notepad and comment it to know next time what I need to do.

    Right now I use Beyond Compare, too, it's an awesome tool for my needs.

    ReplyDelete
  2. Mike Torrettinni Some folks love the command-line version. I'm with you ... it sucks! Check out SourceTree. It's free. There are several other GUI-based interfaces for use with git. They make it a lot easier to use. Some are free, some aren't.

    (A note on SourceTree ... it doesn't have a way to connect to remote repos except the ones Atlassian supports. If you set up an account elsewhere, it won't let you connect. However, I discovered that it uses the gitconfig file to read its settings. So you can manually define as many remote repos as you want. Or, install git-Tower and configure it to connect to the repo you want to use. Then remove it when the trial expires.)

    Note that git saves full copies of all of your source files in the .git folder, but it only does so when you tell it to. So you could cut back on your Delphi auto-saves to 10 or so and then use git more often.

    I don't pay attention to how much space the backup files take up, because losing a file is far more painful.

    ReplyDelete

Post a Comment