I have been working on rewriting Nmxj (Notes etc Java console app). After spending so much time on the IntFiction engine it has been kind of surprising how different Nmxj is. It is a completely different beast from my other console applications. The biggest reason for this is the flexibily an complexity of the commands. Although they are simplistic comoared to most real consoke applications, they are a much greater challenge than all my other Java console apps.
A great example of how they are tricky is the 'using' feature. The idea is when an entry is viewed it becomes the active entry - the one the user is working with. By having a current entry, the user doesn't have to enter its alias every time they call a command... but they could. Commands can be appkied to the current entry or any other entry.
Often, commands have other optional parameters as well, and a few even have optional flags.
To deal with this, each entity class has a Validation class that does all the tedious parameter validation.
Is an entry currently being used? If so there can be one less parameter. But the first parameter might be a different alias, if so use that and set it as the using alias.
Is the next parameter one of the possible flags? If so set the flag and on to the next parameter.
After all the validation, return a value for every possible parameter so the other methods don't have to care, just use them.
The upside is the rewrite has taken only three days to get Nmxj in a working state. Now for testing and some straggling features.
No comments:
Post a Comment