Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Advice please

 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.

I have to create (through a number of computational methods) a matrix of data. As an example here is one:

What I need to do is store this matrix in a text file, tab-delimited.

What I would like to know is whether it would be easier to create a 2-dimensional [n][n] array first and then copy the contents of it over to the file, or form the matrix in the file directly.

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would think not only easier, but far cleaner. Separating your I/O code and your computational code into different methods (or even different classes) will make the whole thing easier to develop.
 
rohit leeta
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree. Make sure that you have a class holding your data and later think serializing it to a file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic