473,396 Members | 1,886 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,396 software developers and data experts.

Debugging C vs debugging C++

I was browsing the web pages of les haltton, a software engineering
professor ( http://www.leshaltton.org ) and I found this data in

htp://www.leshatton.org/Documents/dross_2006.pdf

< begin quote >
Summary of known measurements
• C++ OO systems have comparable defect densities to conventional C or
Pascal systems.
• Each defect in a C++ OO system takes about twice as long to fix as in
a conventional system.

This is true for both simple defects AND difficult ones. The whole
distribution is right shifted.
• Components using inheritance have been observed to have 6 times the
defect density.

How much of this is attributable to C++ is unknown.

< end quote >

It is obvious that beside the much touted hype, OO systems have
not brought any real improvement to C. The problem is in my
opinion, the staggering complexity of those systems, what
makes debugging thema nightmare unless you wrote them.

jacob
Oct 26 '06 #1
11 1460
jacob navia wrote:
I was browsing the web pages of les haltton, a software engineering
professor ( http://www.leshaltton.org ) and I found this data in
It's hatton not hallton. Do you think you could check your
links before posting them or at least afterwards ?
htp://www.leshatton.org/Documents/dross_2006.pdf

< begin quote >
Summary of known measurements
· C++ OO systems have comparable defect densities to conventional C or
Pascal systems.
· Each defect in a C++ OO system takes about twice as long to fix as in
a conventional system.

This is true for both simple defects AND difficult ones. The whole
distribution is right shifted.
· Components using inheritance have been observed to have 6 times the
defect density.

How much of this is attributable to C++ is unknown.

< end quote >

It is obvious that beside the much touted hype, OO systems have
not brought any real improvement to C. The problem is in my
opinion, the staggering complexity of those systems, what
makes debugging thema nightmare unless you wrote them.
This looks like comp.programming to me.

Oct 26 '06 #2
Spiros Bousbouras wrote:
jacob navia wrote:
I was browsing the web pages of les haltton, a software engineering
professor ( http://www.leshaltton.org ) and I found this data in

It's hatton not hallton. Do you think you could check your
links before posting them or at least afterwards ?
Not haltton either ;-)

Oct 26 '06 #3

jacob navia wrote:

It is obvious that beside the much touted hype, OO systems have
not brought any real improvement to C. The problem is in my
opinion, the staggering complexity of those systems, what
makes debugging them a nightmare unless you wrote them.

jacob
IMHO the whole OO thing is mostly smoke and mirrors. Looked at from a
height, how likely is it the first, (well, about the fourth,) major
refactoring of the coding process is likely to be the final, universal,
and unsullied panacea? Especially when it was grafted onto a
less-than-perfect second try at a system language?

The whole business of abstraction sounds really cool at first glance.
The coolness wears off a bit when you have to work with real code,
which after three or four different minds have layered abstractiuon
upon abstraction, often is so abstract as to be uninterpretable by any
human mind.

I'm thinking in particular of one program, where an experienced
programmer was asked to add just ONE small option. After peering thru
thousands of lines of C++ code, he found it was easier to write a
completely separate function to do the option, just five lines of code,
rather than to try to insert TWO lines of code in the complex abstract
hierarchy.

IMHO giving a huge box of TinkerToys to toddlers does not result in
amazingly robust edifices.

Oct 26 '06 #5
Ancient_Hacker wrote:
I'm thinking in particular of one program, where an experienced
programmer was asked to add just ONE small option. After peering thru
thousands of lines of C++ code, he found it was easier to write a
completely separate function to do the option, just five lines of code,
rather than to try to insert TWO lines of code in the complex abstract
hierarchy.
This is exactly the problem any C++ maintainer is facing.
You have to understand the whole hierarchy, layered in several
dozens of files to be able to just modify a small part of it.

Hierarchy can be a good abstraction *sometimes* but the
problem appears when you try to force it to EVERY
situation.
Oct 26 '06 #6

jacob navia wrote:
I was browsing the web pages of les haltton, a software engineering
professor ( http://www.leshaltton.org ) and I found this data in

htp://www.leshatton.org/Documents/dross_2006.pdf

< begin quote >
Summary of known measurements
· C++ OO systems have comparable defect densities to conventional C or
Pascal systems.
· Each defect in a C++ OO system takes about twice as long to fix as in
a conventional system.

This is true for both simple defects AND difficult ones. The whole
distribution is right shifted.
· Components using inheritance have been observed to have 6 times the
defect density.

How much of this is attributable to C++ is unknown.

< end quote >

It is obvious that beside the much touted hype, OO systems have
not brought any real improvement to C. The problem is in my
opinion, the staggering complexity of those systems, what
makes debugging thema nightmare unless you wrote them.

The defect density thing does not surprise me at all. I've seen
similar studies going back decades, looking at many different languages
and programming styles. The defect density in terms of bugs/kloc is
fairly constant from assembler, to Cobol, to Lisp, to C to C++, to
Haskel, to Forth to...

It's also been observed that programmer productivity in klocs/month is
also fairly constant between langauges.

That defects are more difficult to fix in a more complex hierarchy or
structure is also no surprise.

To a large extent, the language that lets you write the smallest
program "wins." To the extent that OO allows larger, more complex,
applications to be built with a given amount of work, it's a win.

OO certainly has is share of excessive hype, but there's a large class
of application for which it is quite well suited. C++, in particular,
is easy to abuse (and even hard to not abuse by accident), even more so
than C. Many of the bugs you see in C++ code you'd *never* see in
Smalltalk (or even C# or Java). Stroustrup himself said that while C
makes it easy to shoot yourself in the foot, C++ lets you blow your
whole leg off.

Oct 27 '06 #7
jacob navia wrote:
I was browsing the web pages of les haltton, a software engineering
professor ( http://www.leshaltton.org ) and I found this data in

htp://www.leshatton.org/Documents/dross_2006.pdf

< begin quote >
Summary of known measurements
· C++ OO systems have comparable defect densities to conventional C or
Pascal systems.
· Each defect in a C++ OO system takes about twice as long to fix as in
a conventional system.

This is true for both simple defects AND difficult ones. The whole
distribution is right shifted.
· Components using inheritance have been observed to have 6 times the
defect density.

How much of this is attributable to C++ is unknown.

< end quote >

It is obvious that beside the much touted hype, OO systems have
not brought any real improvement to C. The problem is in my
opinion, the staggering complexity of those systems, what
makes debugging thema nightmare unless you wrote them.
I'm the last person in the world to defend C++ over C, however, these
statements are missing some very important considerations.

1) You can accomplish *more* in C++ per line of code. Its not
drastically more, but its definately more. Constructors and
destructors are often called by default, you have exception handling
which means you don't have to write very convoluted clean up code for
successfully backing out of errors, and you have templates which means
algorithms can truly be reused over different types. So in essence
this analysis fails the typical "lines of code" fallacy.

2) The *severity* of defects for the two languages is also very
different. Many of the containers in STL remove the need to use
pointers and "by hand" memory management. So a lot of things like "use
after free", pointing to non-sense, uninitialized pointers, and
ordinary buffer overflows, will tend to be less frequent in C++. The
real problem is that C++ introduces a totally new programming paradigm
which in of itself has built-in potential for errors that raw C doesn't
have. Thus this analysis treats all kinds of errors as if they are the
same as well.

3) C++ is not the only embodiment of OO. Other languages such as Java,
Ruby, Python and Lua have their own notion of OO programming. Its
obvious that in these languages, errors are less severe, the rate of
error production is code is far less, and the productivity per line of
code is also much higher. So I don't think that "OO" is, in
particular, either a culprit or an antagonist to reducing the number of
errors in a program.

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Oct 27 '06 #8
jacob navia wrote:
I was browsing the web pages of les haltton, a software engineering
professor ( http://www.leshaltton.org ) and I found this data in

htp://www.leshatton.org/Documents/dross_2006.pdf

< begin quote >
Summary of known measurements
• C++ OO systems have comparable defect densities to conventional C or
Pascal systems.
• Each defect in a C++ OO system takes about twice as long to fix as in
a conventional system.

This is true for both simple defects AND difficult ones. The whole
distribution is right shifted.
• Components using inheritance have been observed to have 6 times the
defect density.

How much of this is attributable to C++ is unknown.

< end quote >

It is obvious that beside the much touted hype, OO systems have
not brought any real improvement to C. The problem is in my
opinion, the staggering complexity of those systems, what
makes debugging thema nightmare unless you wrote them.
Unless they have a decent set of unit tests.

<ducks and runs for cover>

--
Ian Collins.
Oct 27 '06 #9

Ian Collins wrote:

Unless they have a decent set of unit tests.

<ducks and runs for cover>

--
Ian Collins.
better duck!

(1) It's rare to see any extensive tests.

(2) If the tests are written by the original coders, they have too
much of a vested interest in not poking at their code too hard. Plus
they know subconciously what not to try.

(3) And of course even a full set of tests, even hundreds, cannot ever
guarantee the absence of errors-- they can only at best point out
errors.

Remember the first space shuttle launch attempt-- even with an
exemplary testing methodology they got egg on their faces really badly.

Oct 27 '06 #10
Ancient_Hacker wrote:
>
.... snip ...
>
(2) If the tests are written by the original coders, they have
too much of a vested interest in not poking at their code too
hard. Plus they know subconciously what not to try.
That is a sad commentary on the coders you have encountered. In my
experience they know where the boundary conditions are, and write
tests to explore those.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Oct 27 '06 #11
Ancient_Hacker wrote:
Ian Collins wrote:
>>Unless they have a decent set of unit tests.

<ducks and runs for cover>

better duck!

(1) It's rare to see any extensive tests.

(2) If the tests are written by the original coders, they have too
much of a vested interest in not poking at their code too hard. Plus
they know subconciously what not to try.
<pops head up>
That's why you write the tests first!

--
Ian Collins.
Oct 27 '06 #12

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

Similar topics

0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
2
by: Andy Fish | last post by:
Hi, Using VS.NET 2003, when I use 'F5' to start debugging my web app, it obviously attaches the IDE to IIS for server debugging. However, it also seems to put IE into some kind of debugging mode...
2
by: Alex Clark | last post by:
Hi All, My system: WinXP Pro, VS.NET 2003, SQL Server Personal Edition. I'm having problems with my old favourite demon, SQL Debugging from within VS.NET. I have to say I've found this...
5
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The...
6
by: KevinGPO | last post by:
I am currently developing a website in ASP (VBScript) using MS Visual C#.NET IDE. I just create a new "ASP.NET Web Application" and point to my local webserver (IIS) of my website address. Then I...
5
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into the GAC. Each of the applications contains an...
5
by: =?Utf-8?B?Z2FkeWE=?= | last post by:
I can't get to debug on my local IIS using VStudio.net 2005 Prof. I can on the development server. I get the msg 'the server does not support debugging for asp.net...' I have done the following...
2
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use...
4
by: =?Utf-8?B?TWlrZSBHYWxl?= | last post by:
VS 2008 initially didn't debug classic ASP. SP1 fixes this in some ways. You can debug if you select the debug option to "Start Without Debugging, then either attach the debugger manually or...
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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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:
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...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.