473,395 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

A Question about structure...

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
3 1846
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sims | last post by:
Hi, I have some small questions that have never been any problems, (for my compiler?), but always make me curious. So here goes... what does the standard sday about the 'if' statement? for...
1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
1
by: John | last post by:
Thanks. If I define the following structure, typedef struct{ vector<int> v; int ID; double time; }node; What should be the size of the structure node? If I insert elements into vector v,...
11
by: Capstar | last post by:
Hi, I am working on an application, which will run embedded without an OS. The app is build up out of a couple of well defined parts. At first I wanted to keep those parts seperated and use...
7
by: Rano | last post by:
/* Hello, I've got some troubles with a stupid program... In fact, I just start with the C language and sometime I don't understand how I really have to use malloc. I've readden the FAQ...
11
by: Alfonso Morra | last post by:
Hi, I have the ff data types : typedef enum { VAL_LONG , VAL_DOUBLE , VAL_STRING , VAL_DATASET }ValueTypeEnum ;
28
by: WaterWalk | last post by:
Hi, I'm haunted by 2 questions about struct copy. Though I searched the net, but still in confusion. 1. Does struct assignment copies every member including array members? For example, struct...
56
by: infidel | last post by:
Where are they-who-hate-us-for-our-whitespace? Are "they" really that stupid/petty? Are "they" really out there at all? "They" almost sound like a mythical caste of tasteless heathens that "we"...
12
by: Sam Kong | last post by:
Hi, JavaScript hides its memory structure. I know that numbers, booleans, null and undefined are value types (value is directed saved in a variable). I want to know: - How JavaScript...
7
by: ot_007_2001 | last post by:
Hi, all, For pricticing defination of structure in C, I wrote a small code as follow: #include<stdio.h> struct datastruct { int data;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.