Hi Michael,

On 4/16/2012 3:08 PM, Michael Schutte wrote:

store = StorePrompt();
status = StatusPrompt();

Both prompts would display a list in a window.

In my opinion, this isn't a good design.

a) The procedures StorePrompt and StatusPrompt do two things: (1) they perform the business/database logic needed to get a list of potential values for a field and (2) they perform the UI logic to load, display and read the results of a screen/window.

In my opinion, a subprocedure should serve one purpose so this should be divided into two procedures.

b) What if you needed a list of (for example) valid stores for some other purpose besides an F4=Prompt screen? With your design, you'd have to re-code the logic to retrieve the values. If the business rules ever change, now you have two (or more) places to re-code the logic. (This is strongly related to reason "a", above)

c) What if you wanted to use a different UI besides green screen?! Since your business logic and display logic are intermixed, you'd have to rewrite the logic.

d) Mixing completely unrelated business logic together in the same service program will definitely become awkward. You will have the potential (depending on how you design the file access) for hundreds of files to be opened when you only needed one.

e) Mixing so many unrelated functions together also makes maintenance more difficult. This object has to be re-tested and re-promoted each time you change any of the internal "prompt procedures." With hundreds of them included, this might mean that this service program is replaced frequently for completely unrelated purposes. This makes it likely that two programmers will need to make changes at the same time to the same srvpgm.

f) It doesn't make any sense to me that these are grouped together purely because they're both invoked by "F4=Prompt"? Is the fact that they both prompt for information REALLY the defining characteristic of each? Example: you have a procedure described as "choosing a store number" -- what's the most important part of that description? Is it "choosing"? Or "store number"? I'd definitely say the latter. But, you seem to think the fact that the user is choosing something is the defining characteristic... and I can't agree with that. When you finally graduate into a modern display paradigm, are you going to have a ListBox service program with all list box procedures, and a RadioButton service program will all procedures that use that, and a SpinButton service program will all procedures that use spin buttons? Seems to me it's more important to group by business function rather than the type of UI panel you are using.

In my opinion, this isn't a good design.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].