From: Robert Klemme Date: 2013-02-14T02:50:11+09:00 Subject: Re: Select "columns" from multidimensional array? On Tue, Feb 12, 2013 at 10:49 PM, Robert Klemme wrote: > On Tue, Feb 12, 2013 at 9:26 PM, Joel Pearson wrote: >> Thanks for the advice and examples, I'll see whether I can understand >> how the classes and methods work with each other there and set about >> experimenting with them. > > I didn't put commenting in the gist. If there's anything unclear feel > free to ask. Maybe one explanatory sentence: I chose to use two values for addressing cells in the Matrix class I put on github. That is a design decision. You may want to choose something else (e.g. "R3") but the main point of the example was this: it does make sense to turn things you talk and reason about into classes (i.e. Matrix, Column, Row). One can do that and still maintain connection, i.e. if you write through a Row or Column instance the Matrix gets updated. That way you can easily maintain consistency in the Matrix and yet present the user abstractions which are more appropriate for his particular use case (e.g. if you want to sum all values in a column you obtain the column and then iterate through all values and sum them up). Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/