[NCLUG] programming question

Charles Clarke clarke at clarkecomputer.com
Sun Jul 1 09:40:37 MDT 2001


On Sun, 1 Jul 2001, mike cullerton wrote:

> another question (or as plato says, a digression). i don't mean to start a
> holy war here, but can't most of this stuff be done with procedural
> programming and good api's? what is it that oo gives you that procedures
> can't? oo has forced me to think about my programs in a different way which
> has benefited all my programming. it also helps me organize my thoughts
> somewhat as to what is actually going on with each piece of a program.

OO as a practice doesn't mean your programs aren't written in some old
language, it is just the organizing according to objects.  OO languages
came later to support the concepts of OO.

> > Because once you've taken the leap to do OO, your code is going to be a bit
> > slower anyway (whether it be C++, Java, or icky-disgusting 'OO' Perl)...
> > you might as well do the "right thing" (tm).
> 
> is this really true? does oo in general make code a bit slower? in any real
> perceivable manner?
OO techniques are usually slower because you aren't mixing everything that
you could because you are keeping them conceptually seperate(so the next
programmer coming along doesn't have to figure out which piece of code is
dovetailed with which other piece of code).

C++ isn't necessarily slower than C.  (in fact, with judicious inlining of
functions, it's faster).  If you are really using objects (tens, not just
2), then it probably will take longer to execute than one coded in C.  Of
course, it only took 2 months to write instead of 10! :)

> folks have mentioned this a couple times. what is meant by profiling?
Profiling is using a tool that tells you where the time was spent in your
code.  Once you find the routine that is executed all the time and takes
up most of the execution time, you can work on optimizing it instead of
working on optimizing the code that is only executed once.

charles

--------------------------------------------------------------------------
 Domain hosting from $15/month with error log analysis and link checking.
 http://www.clarkecomputer.com/sig.html       domains at clarkecomputer.com




More information about the NCLUG mailing list