473,606 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

classes

do people prefer to design classes for the particular job or for a rangle of
tasks they might encounter now and in the future.
i am doing some simple win32 apps and picking classes is simple, but
understanding others peoples logic isnt (that doesnt mean they are wrong).

i prefer designing classes for the currect job and making tangible 'things'
classes , not overdoing it with loads of classes or inheritance..

it seems easier to make classes and use previous work if possible. the idea
of making re-usable code to be used all the time is impractical
Also using polymorphism,in heritance etc on old code to make it usabke for
now is an overhead of simplictity to read. Again simply designing classes
from scratch with previous work as a help seems easier to do.

are there any rules of thumb for this
Jul 23 '05 #1
4 1803
"john townsley" <jo**********@o ptusnet.com.au> wrote...
do people prefer to design classes for the particular job or for a rangle
of tasks they might encounter now and in the future.
Yes.
i am doing some simple win32 apps and picking classes is simple, but
understanding others peoples logic isnt (that doesnt mean they are wrong).
Understanding others is never simple.
i prefer designing classes for the currect job and making tangible
'things' classes , not overdoing it with loads of classes or inheritance..
OK.
it seems easier to make classes and use previous work if possible. the
idea of making re-usable code to be used all the time is impractical
Well, that's not what the Standard Library designers thought...
Also using polymorphism,in heritance etc on old code to make it usabke for
now is an overhead of simplictity to read. Again simply designing classes
from scratch with previous work as a help seems easier to do.
'Seems' is probably the key word here.
are there any rules of thumb for this


The rule of thumb is simple: do what's easier. Of course, some understand
that rule as "do what's easier NOW", and some as "do what's easier IN THE
LONG RUN". I guess it depends on your expectation of the lifetime of your
own work. I've written a few "one-timers" myself. They did their work as
needed when they were created, and were never designed for re-use. It is
quite possible that among those I've written some more than once to do the
same essential task. If the amount of such share is below one quarter of
all "one-timers", it's probably OK. If every time you when you sit down to
write a one-timer you suddenly, half-way through implementation, realise
that "you can swear you've done it before and probably more than once",
then you ought to keep those and document them well.

It's one thing to reinvent the wheel that was invented by others. It's
totally different thing to reinvent your own wheel [all the time].

Another sentiment: when we were little, we were taught: repetition is the
mother of learning. The question is, are you still consider yourself
learning or is it really time to grow?

Re-use is the cornerstone of good design. When you don't intend something
to be re-used, you usually do not apply enough thought to its design. It
becomes a vicious circle, a catch-22: you can't re-use your old work since
it wasn't designed for it, so you start writing everything anew, and it too
comes out non-re-usable because you don't have time nor the intent to do it
right.

V
Jul 23 '05 #2

"Victor Bazarov" <v.********@com Acast.net> wrote in message
news:Wv******** ************@co mcast.com...
"john townsley" <jo**********@o ptusnet.com.au> wrote...
do people prefer to design classes for the particular job or for a rangle
of tasks they might encounter now and in the future.


Yes.
i am doing some simple win32 apps and picking classes is simple, but
understanding others peoples logic isnt (that doesnt mean they are
wrong).


Understanding others is never simple.
i prefer designing classes for the currect job and making tangible
'things' classes , not overdoing it with loads of classes or
inheritance..


OK.
it seems easier to make classes and use previous work if possible. the
idea of making re-usable code to be used all the time is impractical


Well, that's not what the Standard Library designers thought...
Also using polymorphism,in heritance etc on old code to make it usabke for
now is an overhead of simplictity to read. Again simply designing classes
from scratch with previous work as a help seems easier to do.


'Seems' is probably the key word here.
are there any rules of thumb for this


The rule of thumb is simple: do what's easier. Of course, some understand
that rule as "do what's easier NOW", and some as "do what's easier IN THE
LONG RUN". I guess it depends on your expectation of the lifetime of your
own work. I've written a few "one-timers" myself. They did their work as
needed when they were created, and were never designed for re-use. It is
quite possible that among those I've written some more than once to do the
same essential task. If the amount of such share is below one quarter of
all "one-timers", it's probably OK. If every time you when you sit down
to
write a one-timer you suddenly, half-way through implementation, realise
that "you can swear you've done it before and probably more than once",
then you ought to keep those and document them well.

It's one thing to reinvent the wheel that was invented by others. It's
totally different thing to reinvent your own wheel [all the time].

Another sentiment: when we were little, we were taught: repetition is the
mother of learning. The question is, are you still consider yourself
learning or is it really time to grow?

Re-use is the cornerstone of good design. When you don't intend something
to be re-used, you usually do not apply enough thought to its design. It
becomes a vicious circle, a catch-22: you can't re-use your old work since
it wasn't designed for it, so you start writing everything anew, and it
too
comes out non-re-usable because you don't have time nor the intent to do
it
right.

V


i agree with what you say and it was a good response

you have to know if your code is going to be re-used and have some idea
what for first. some classes are devloped by adding 100's of extra things
that might be used. you can only worry about the future so much.
of course if you have some idea then include extra functionality and put
extra work in the design.

the best thing you said compared to other on the topic is that you said 'do
what's easier' .

Jul 23 '05 #3
On Thu, 17 Feb 2005 22:47:42 -0500, Victor Bazarov
<v.********@com Acast.net> wrote:
The rule of thumb is simple: do what's easier. Of course, some understand
that rule as "do what's easier NOW", and some as "do what's easier IN THE
LONG RUN". I guess it depends on your expectation of the lifetime of your
own work. I've written a few "one-timers" myself. They did their work as
needed when they were created, and were never designed for re-use. It is
quite possible that among those I've written some more than once to do the
same essential task. If the amount of such share is below one quarter of
all "one-timers", it's probably OK. If every time you when you sit down to
write a one-timer you suddenly, half-way through implementation, realise
that "you can swear you've done it before and probably more than once",
then you ought to keep those and document them well.
There are some things I've written a number of times, each time it gets
better (it's impossible to think of all possible uses at design time,
there's a point where "rewrite from scratch" is more effective than
trying to modify the original). There are some I've had to rewrite for
different languages, as well.

On the other hand there's some code I wrote 20 years ago which I'm still
using effectively unchanged (at that time C didn't even have function
prototypes or void, so they have grown proper modern interfaces since
then, but otherwise they are effectively unchanged).
It's one thing to reinvent the wheel that was invented by others. It's
totally different thing to reinvent your own wheel [all the time].
Yup. "Write once, use often" is a general principle I go by.
Another sentiment: when we were little, we were taught: repetition is the
mother of learning. The question is, are you still consider yourself
learning or is it really time to grow?
Heh. I hope I'm still learning, since Newton and Einstein were proud of
the fact that there was still so much else to know (with a finite
lifespan it is impossible to learn everything). But relearning the same
thing all the time is (a) boring and (b) a waste of time which could be
spent learning something new...
Re-use is the cornerstone of good design. When you don't intend something
to be re-used, you usually do not apply enough thought to its design. It
becomes a vicious circle, a catch-22: you can't re-use your old work since
it wasn't designed for it, so you start writing everything anew, and it too
comes out non-re-usable because you don't have time nor the intent to do it
right.


Or worse, you try to fit the old thing into the new functionality and
end up with something which is totally unmaintainable and clunky. At
which point it's a good idea to treat the original as a prototype and
say "Now that I know more about what it should have done and what I
really wanted I can write a proper specification".

Chris C
Jul 23 '05 #4

"john townsley" <jo**********@o ptusnet.com.au> wrote in message
news:42******** **************@ news.optusnet.c om.au...

"Victor Bazarov" <v.********@com Acast.net> wrote in message
news:Wv******** ************@co mcast.com...
"john townsley" <jo**********@o ptusnet.com.au> wrote...
do people prefer to design classes for the particular job or for a rangle of tasks they might encounter now and in the future.
Yes.
i am doing some simple win32 apps and picking classes is simple, but
understanding others peoples logic isnt (that doesnt mean they are
wrong).


Understanding others is never simple.
i prefer designing classes for the currect job and making tangible
'things' classes , not overdoing it with loads of classes or
inheritance..


OK.
it seems easier to make classes and use previous work if possible. the
idea of making re-usable code to be used all the time is impractical


Well, that's not what the Standard Library designers thought...
Also using polymorphism,in heritance etc on old code to make it usabke for now is an overhead of simplictity to read. Again simply designing classes from scratch with previous work as a help seems easier to do.


'Seems' is probably the key word here.
are there any rules of thumb for this


The rule of thumb is simple: do what's easier. Of course, some understand that rule as "do what's easier NOW", and some as "do what's easier IN THE LONG RUN". I guess it depends on your expectation of the lifetime of your own work. I've written a few "one-timers" myself. They did their work as needed when they were created, and were never designed for re-use. It is quite possible that among those I've written some more than once to do the same essential task. If the amount of such share is below one quarter of all "one-timers", it's probably OK. If every time you when you sit down
to
write a one-timer you suddenly, half-way through implementation, realise
that "you can swear you've done it before and probably more than once",
then you ought to keep those and document them well.

It's one thing to reinvent the wheel that was invented by others. It's
totally different thing to reinvent your own wheel [all the time].

Another sentiment: when we were little, we were taught: repetition is the mother of learning. The question is, are you still consider yourself
learning or is it really time to grow?

Re-use is the cornerstone of good design. When you don't intend something to be re-used, you usually do not apply enough thought to its design. It becomes a vicious circle, a catch-22: you can't re-use your old work since it wasn't designed for it, so you start writing everything anew, and it
too
comes out non-re-usable because you don't have time nor the intent to do
it
right.

V


i agree with what you say and it was a good response

you have to know if your code is going to be re-used and have some idea
what for first. some classes are devloped by adding 100's of extra things
that might be used. you can only worry about the future so much.
of course if you have some idea then include extra functionality and put
extra work in the design.

the best thing you said compared to other on the topic is that you said

'do what's easier' .


I find reusing classes much simpler, when I am focused at not writing one
class, at solving a problem. And solving that problem by making a set of
classes, where each class has one responsibility. I might end up making them
part of a big class, or a couple of big classes(subsyst em) at the end, but
all small factored out classes are usually reuseable..

Jesper
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
741
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a managed point-of-view I've noticed that: 1) for each managed and unmanaged C function (not C++ classes) I get a public managed static method (defined on a 'Global Functions' class) in the generated assembly with an export name of the form...
9
1632
by: Jack | last post by:
Hello I have a library of calculationally intensive classes that is used both by a GUI based authoring application and by a simpler non-interactive rendering application. Both of these applications need to serialise the classes to/from the same files but only the GUI app needs the full range of class methods. Now, the rendering app needs to be ported to multiple OS's but the GUI doesn't. In order to reduce the time/cost of porting I'd...
9
6632
by: Aguilar, James | last post by:
I know that one can define an essentially unlimited number of classes in a file. And one can declare just as many in a header file. However, the question I have is, should I? Suppose that, to use the common example, I have a situation where I am implementing many types of Shapes. My current way of thinking is, well, since they are all the same type, let's just put them all in the same file. The include file would be "shapes.h" and it...
12
21220
by: Langy | last post by:
Hello I'm fairly new to C++ but have programmed several other languages and found most of c++ fairly easy (so far!). I've come to a tutorial on classes, could someone please tell me why you would need to use a class? Perhaps you could also give an example on when it might be used rather than an alternative method.
2
9488
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how to do that? Thanks. Tsung-Yu
18
2033
by: Edward Diener | last post by:
Is the packing alignment of __nogc classes stored as part of the assembly ? I think it must as the compiler, when referencing the assembly, could not know how the original data is packed otherwise. Yet, in my understanding, attributes are only __gc and __value class specific and do not apply to __nogc classes. Is this correct ? If so, how is the packing alignment of __nogc classes stored ?
6
2930
by: ivan.leben | last post by:
I want to write a Mesh class using half-edges. This class uses three other classes: Vertex, HalfEdge and Face. These classes should be linked properly in the process of building up the mesh by calling Mesh class functions. Let's say they point to each other like this: class Vertex { HalfEdge *edge; }; class HalfEdge { Vertex* vert;
0
2023
by: ivan.leben | last post by:
I am writing this in a new thread to alert that I found a solution to the problem mentioned here: http://groups.google.com/group/comp.lang.c++/browse_thread/thread/7970afaa089fd5b8 and to avoid this topic getting lost before people interested in the problem notice it. The important tricks to the solution are two: 1) make the custom classes take a TEMPLATE argument which defines their BASE class 2) EMBED the custom classes in a "Traits"...
2
1911
by: Amu | last post by:
i have a dll ( template class) ready which is written in VC++6. But presently i need to inherit its classes into my new C#.net project.so if there is some better solution with u then please give me the solution.
0
8009
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7939
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8432
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8428
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8299
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2442
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.