0

If I wanted to put a few thousand or so properties in a class could .Net framework handle it? Is there a recommended way to manage large number of properties in a class?

Why do I ask?

We are building apps that scrape and enter data into mainframe screens via emulators.

If i were grab a customer address under our current programming methodology it would look something like this

    GoToScreen "INFO","",customerNbr

    Dim custAddr as String = MainFrame.ReadScreenPosition(10,2,50)

In my perfect world you have

    Dim custAddr as String = MainFrame.CustomerAddress

here MainFrame class already knows the screen and position where to find customer address and all the developer does is pick through a list of properties in intellisense. The BA won't need to locate all the positions of all the fields every time when they write them into the specs.

Is there a better way to do this?

Theo
  • 81
  • 9
  • Danger Doctor Smith! -- You don't need all those properties. Use a Key/Value collection instead. – Robert Harvey Apr 30 '13 at 17:56
  • Isn't the screen position an implementation detail the BA needs know nothing about? You will certainly need a FieldName-to-screen-coordinates mapping at some point, but during the specifications phase? Why couldn't the BA say {INFO}.{CustomerAddress} ? – Tim Apr 30 '13 at 18:01
  • I'd rather leave the screen name out. It is forseeable that might be able to get our data outside emulator screen scraping. If that were to come to be the screen name would just be a dead relic inside the code. I'd like to avoid that if possible – Theo Apr 30 '13 at 18:32
  • 300 lines is the sweet spot. – Victor Zakharov Apr 30 '13 at 20:09

1 Answers1

1

If you are screen scraping thousands of attributes and mapping them to properties, your code will be fragile to change. A small change to the mainframe screen requires your code to be recompiled.

You would be better off using a metadata-based approach. For example, store the screen mapping information in an XML file or database, and expose it through (for example) a dictionary whose key is what you are currently using as a property name.

Eric J.
  • 147,927
  • 63
  • 340
  • 553