suitable representation of data in OO programs.
- From: Tom Forsmo <tom@xxxxxxxxxx>
- Date: Mon, 17 Sep 2007 14:24:22 +0200
I have a question I would like some feedback on:
My basic problem here is that I need to create a configuration module, that can parse both a configuration file and a configuration web page. The input from the file can be a string or a stream but the input from a web page is dependant on the framework used and needs to be converted.
So...
With regards to data beeing passed around in a program, such as configuration data or web form data, I cant seem to make up my mind on what representation of this data is best. I have seen people creating an interface to represent the data in specialised data objects while others just use HashMaps.
- The arguments for specialised data objects are that it is more object oriented, and it gives benefits such as, single method call and no casting of return data.
- The arguments of HashMap is KISS.
- A negative consequence of specialised data objects is that if the dataset changes, you have to change both the interface and the objects implementing that interface. This creates more work than needed. Additionally this kind of approach to designing an application just feeds more complexity into the code.
- The negative consequenes of a HashMap approach is that one needs to convert the data at every use point into the correct data type to be able to use it.
I suppose it all depends on the use, so for configuration information I would think a Properties object is the best. But for web query data, such as a web form, I am not sure which is easier, since you might easily change the name of a forms field or add/remove a field.
Anybody have any thoughts?
.
- Follow-Ups:
- Re: suitable representation of data in OO programs.
- From: zzantozz
- Re: suitable representation of data in OO programs.
- From: Roedy Green
- Re: suitable representation of data in OO programs.
- From: Ed Kirwan
- Re: suitable representation of data in OO programs.
- Prev by Date: Re: Help
- Next by Date: Re: [Eclipse] How to fix indentations.
- Previous by thread: [Eclipse] How to fix indentations.
- Next by thread: Re: suitable representation of data in OO programs.
- Index(es):
Relevant Pages
|