On Tue, Feb 12, 2013 at 10:49 PM, Robert Klemme <[email protected]> wrote: > On Tue, Feb 12, 2013 at 9:26 PM, Joel Pearson <[email protected]> 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/ -- [email protected] | https://groups.google.com/d/forum/ruby-talk-google?hl=en --- You received this message because you are subscribed to the Google Groups "ruby-talk-google" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
