By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,614 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

A Question about structure...

P: n/a
I have a vector class and a matrix class.
The matrix class uses the vector class to implement a matrix.

Within the vector class there is a polynomial curve fit method.
The curve fit method uses matrices to implement perform the curve fit.

Does the fact that the vector class uses the matrix class violate a design
rule?

Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
not telling wrote:
I have a vector class and a matrix class.
The matrix class uses the vector class to implement a matrix.

Within the vector class there is a polynomial curve fit method.
The curve fit method uses matrices to implement perform the curve fit.

Does the fact that the vector class uses the matrix class violate a design
rule?


No.

Jul 19 '05 #2

P: n/a
not telling wrote:
I have a vector class and a matrix class.
The matrix class uses the vector class to implement a matrix.

Within the vector class there is a polynomial curve fit method.
The curve fit method uses matrices to implement perform the curve fit.

Does the fact that the vector class uses the matrix class violate a design
rule?


Take a look at
The C++ Scalar, Vector, Matrix and Tensor class Library (SVMTL)

http://www.netwood.net/~edwin/svmtl/

High Performance Embedded Computing Software Initiative (HPEC-SI)

http://www.hpec-si.org/

Object Oriented Numerics Web Page

http://www.oonumerics.org/

Jul 19 '05 #3

P: n/a
not telling <no**@nottelling.com> might (or might not) have written
this on (or about) Wed, 13 Aug 2003 14:56:22 -0600, :
I have a vector class and a matrix class.
The matrix class uses the vector class to implement a matrix.

Within the vector class there is a polynomial curve fit method.
The curve fit method uses matrices to implement perform the curve fit.

Does the fact that the vector class uses the matrix class violate a design
rule?


Why does vector need a curve fit method? Do you really want everyone
who uses vector to have to import the curve-fitting code? This is a
violation of the Single Responsibility Principle (SRP) which states
that a class should have one, and only one, reason to change. By
associating curve fitting with vector, you force vector to change when
new curve fitting algorithms are needed. All users of vector, whether
they use the curve fitting or not, must then update their builds.

Robert C. Martin | "Uncle Bob"
Object Mentor Inc.| unclebob @ objectmentor . com
PO Box 5757 | Tel: (800) 338-6716
565 Lakeview Pkwy | Fax: (847) 573-1658 | www.objectmentor.com
Suite 135 | | www.XProgramming.com
Vernon Hills, IL, | Training and Mentoring | www.junit.org
60061 | OO, XP, Java, C++, Python |
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.