Forum: Ruby-core [ruby-trunk - Bug #7369][Open] Matrix #row_size, #column_size methods

Posted by boris_stitnicky (Boris Stitnicky) (Guest)
on 2012-11-16 08:08
(Received via mailing list)
Issue #7369 has been reported by boris_stitnicky (Boris Stitnicky).

----------------------------------------
Bug #7369: Matrix #row_size, #column_size methods
https://bugs.ruby-lang.org/issues/7369

Author: boris_stitnicky (Boris Stitnicky)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 1.9.x


I believe these methods should be renamed. "row_size" is confusing, 
because it can be intuitively understood as both "number of rows", and 
"size along a row" (or size of a matrix row). Same goes for "column 
size". I would like these methods renamed to unambigous, mnemonic names, 
such as

#number_of_rows alias #height
#number_of_columns alias #width

I do not insist on the above names. They are just examples of 
unambigous, mnemonic names. But I insist that "row_size" and 
"column_size" method names impress me as ambiguous.
Posted by marcandre (Marc-Andre Lafortune) (Guest)
on 2012-11-16 17:48
(Received via mailing list)
Issue #7369 has been updated by marcandre (Marc-Andre Lafortune).

Category set to lib
Assignee set to marcandre (Marc-Andre Lafortune)

I agree that `{row|column}_size` can be ambiguous.

I don't believe `height/width` is used in this context though, at least 
in mathematics.

Possibilities I can think of: `column_count` or `nb_columns`.

Opinions?
----------------------------------------
Bug #7369: Matrix #row_size, #column_size methods
https://bugs.ruby-lang.org/issues/7369#change-32981

Author: boris_stitnicky (Boris Stitnicky)
Status: Open
Priority: Normal
Assignee: marcandre (Marc-Andre Lafortune)
Category: lib
Target version:
ruby -v: 1.9.x


I believe these methods should be renamed. "row_size" is confusing, 
because it can be intuitively understood as both "number of rows", and 
"size along a row" (or size of a matrix row). Same goes for "column 
size". I would like these methods renamed to unambigous, mnemonic names, 
such as

#number_of_rows alias #height
#number_of_columns alias #width

I do not insist on the above names. They are just examples of 
unambigous, mnemonic names. But I insist that "row_size" and 
"column_size" method names impress me as ambiguous.
Posted by Eregon (Benoit Daloze) (Guest)
on 2012-11-16 17:55
(Received via mailing list)
Issue #7369 has been updated by Eregon (Benoit Daloze).


m and n?
They are awfully short and might be confusing but they also are the 
names used in standard notation (an m-by-n matrix).
----------------------------------------
Bug #7369: Matrix #row_size, #column_size methods
https://bugs.ruby-lang.org/issues/7369#change-32982

Author: boris_stitnicky (Boris Stitnicky)
Status: Open
Priority: Normal
Assignee: marcandre (Marc-Andre Lafortune)
Category: lib
Target version:
ruby -v: 1.9.x


I believe these methods should be renamed. "row_size" is confusing, 
because it can be intuitively understood as both "number of rows", and 
"size along a row" (or size of a matrix row). Same goes for "column 
size". I would like these methods renamed to unambigous, mnemonic names, 
such as

#number_of_rows alias #height
#number_of_columns alias #width

I do not insist on the above names. They are just examples of 
unambigous, mnemonic names. But I insist that "row_size" and 
"column_size" method names impress me as ambiguous.
Posted by boris_stitnicky (Boris Stitnicky) (Guest)
on 2012-11-18 05:25
(Received via mailing list)
Issue #7369 has been updated by boris_stitnicky (Boris Stitnicky).


@Eregon: #m and #n? Maybe as aliases, but I think that one-character 
methods should be generally left to daring users. Perhaps #m_size and 
#n_size.

@Marc-Andre: This is what they call conundrum. #number_of_rows is clear, 
but almost as long as #each_with_object. #row_count is shorter, but less 
mnemonic. #nb_rows and such is even less mnemonic. #height / #width is 
unambiguous, but slightly boorish with respect to mathematicians. Some 
recommend that methods should be named only with full-length 
(unabbreviated) English words, but on the other hand, when writing core 
or stdlib, one is allowed to trade brevity for mnemonism, as seen eg. in 
"attr_reader". For that case, #no_of_rows / #no_of_columns can be 
considered. Additional possibility is having a method named eg. 
#dimensions returning [m, n] for m x n matrix.
----------------------------------------
Bug #7369: Matrix #row_size, #column_size methods
https://bugs.ruby-lang.org/issues/7369#change-33047

Author: boris_stitnicky (Boris Stitnicky)
Status: Open
Priority: Normal
Assignee: marcandre (Marc-Andre Lafortune)
Category: lib
Target version:
ruby -v: 1.9.x


I believe these methods should be renamed. "row_size" is confusing, 
because it can be intuitively understood as both "number of rows", and 
"size along a row" (or size of a matrix row). Same goes for "column 
size". I would like these methods renamed to unambigous, mnemonic names, 
such as

#number_of_rows alias #height
#number_of_columns alias #width

I do not insist on the above names. They are just examples of 
unambigous, mnemonic names. But I insist that "row_size" and 
"column_size" method names impress me as ambiguous.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.