• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the MetaData?

 
Praveen Kannan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am working on the Conversion tool. and i have the data read from the ascii file. I am computing the lenght of the Header in number of bytes. and this is written to the header of the file. Then i wrote a test program that uses the DATA class to read the data file i created and it keeps on giving incorrect Header length. Could someone please tell me how to solve this problem???
Thank u all so much
Praveen.K
 
Jerry Pulley
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen,
You should only use the public methods of Data to write the file.
Jerry
 
Praveen Kannan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that really neccessary? If i used the Data class then i will have to use the entire package. Where i don't need more than 3/4th of the methods. Do u think such an overhead is really required? Could i just cut/copy-paste the second constructor into my DCT and make it work??
Thanks
Praveen Kannan
 
Jerry Pulley
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen,
Yes, you could roll your own DCT from scratch without using the Data class. That's not a great idea for a couple of reasons:
1) You'll have to test and debug your new code. The experience that led you to your original post should convince you of the cost of this approach.
2) (The real reason) It's bad design to duplicate logic; it'll have to be maintained in two places. What if someone modifies the format later? If you use Data in the conversion tool, then the tool will most likely still work. What if you inherited such a system? Personally, I always appreciate reuse - I only have to read and understand half as much code. After all, this is a design test.
The overhead of designing, coding, testing, debugging, and maintaining new logic far outweighs the cost (if any) of a few lines of unused code in Data. Code (and design) reuse is one of the benefits of object-oriented programming.
Jerry
 
Praveen Kannan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx Jerry,
a very valid point! But then now this module is just too easy!!!
Praveen Kannan
 
Jerry Pulley
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen,
Don't worry, the other parts are more work.
Jerry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic