473,941 Members | 17,258 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Learning C

I am sorry if this is an inappropriate place to put this post, if so
please delete it.

I am wondering about a few things. Do you guys recommend learning C as
a second language, as someone who already knows java very well. And
what is the best way to learn C, books, tutorials, or what?

Thanks, any response would be great.

Mar 10 '06
26 3001
Richard G. Riley wrote:
"Nick"poste d the following on 2006-03-10:
I thought you were implying Linux was better because the *debugger* was
There is no "the debugger" : although gdb is prevalent in Linux -
albeit with several front ends.
better. I've never stepped through an existing application (that wasn't
broken)
with a debugger. If you say it's a good way to learn C, who am I to
argue.


I said its one way to get used to the structure and flow of
applications which is what he wants. Also, I do think a debugger can
give real insight into how C works in the real world : results of
operators there for you to see with no overhead of printfs which some
favor.


The printf's are portable. The printf's work without manual intervention.
The printfs work without having to understand an additional tool.
But it *still* sounds bizzare to me


What does? Are we talking about the same thing? Do you doubt that
watching other, well written apps work is beneficial to a newbie? It
seems fairly clear to me that it can only help. Its how the entire
Open SW system works : people learning by doing and picking up on
other peoples work.


You've conflated "learning by doing and picking up on> other peoples work"
with "watching ... apps work" and that with stepping through an application
using a debugger. I think that's misleading.

--
Chris "sparqling" Dollin
"Who do you serve, and who do you trust?"
Mar 10 '06 #11

Chris Dollin wrote:
Richard G. Riley wrote:
"Nick"poste d the following on 2006-03-10:
I thought you were implying Linux was better because the *debugger* was


There is no "the debugger" : although gdb is prevalent in Linux -
albeit with several front ends.
< snip >
What does? Are we talking about the same thing? Do you doubt that
watching other, well written apps work is beneficial to a newbie? It
seems fairly clear to me that it can only help. Its how the entire
Open SW system works : people learning by doing and picking up on
other peoples work.


You've conflated "learning by doing and picking up on> other peoples work"
with "watching ... apps work" and that with stepping through an application
using a debugger. I think that's misleading.


You've been trolled!

Especially in the light of the reply by the same person I couldn't
avoid seeing, as I'm forced to use Google from the office.

--
BR, Vladimir

Mar 10 '06 #12

"Nick Keighley" <ni************ ******@hotmail. com> wrote in message
news:11******** **************@ j52g2000cwj.goo glegroups.com.. .

Richard G. Riley wrote:
"Nick"poste d the following on 2006-03-10:
> Richard G. Riley wrote:
>> "mf*******@gmai l.com"posted the following on 2006-03-10:
>
>> > Thanks alot for the response, a few minutes after posting I searched
>> > this group and found hundreds of other threads about the same topic.
>> > I
>> > apoligize as well for double posting, that was a mistake even though
>> > I'm sure it must look like I tryed to bump my thread.
>> >
>> > I wanted as well, to bring forth another concern that I have with
>> > programming in general. Many people say that ACTUALLY PROGRAMMING
>> > real-world programs is the best way to get better. That theory makes
>> > sense, but when I sit down to write a program in java, I often
>> > realize
>> > that I have mastered the sytnax and searching and sorting
>> > algorithms,
>> > yet I cannot apply this to a real-world program. Are there any books
>> > for C or websites that explain the analytical thinking or other
>> > tactics
>> > involved in practical uses of C?
>>
>> One great way is to analyse existing systems. You mentioned moving to
>> Linux : this is a great idea because you can compile and step through
>> existing apps with the debugger.
>
> could we keep the platform bigotry down to a dull roar? Windows has
> perfectly good debuggers available as well. So if you really want to
> (I've never had the urge) you can "step through existing apps".
No you cant. Firstly, I use multiple OSs : windows, OS/2 and Linux so
get away with your attempt to suggest this is an OS war bigotry.

Secondly, what system apps are you aware of in windows which come with
the C source code? Most are in C++ anyway. Most Gnome/Linux system is
in C. The OP was asking about C.


I thought you were implying Linux was better because the *debugger* was

better. I've never stepped through an existing application (that wasn't
broken)
with a debugger. If you say it's a good way to learn C, who am I to
argue.

But it *still* sounds bizzare to me


My $.02:

I learned C on MS-DOS systems. I found using a debugger
(even with 'working' code) to be an *extremely* good aid
in understanding the language and how it was implemented
on that system. E.g. when creating a new function, before
integrating it with the main program, I'd run it in a
'test harness' under a debugger, and more often than
not, I was able to find and fix bugs before they got
into the main application.

-Mike


<snip>
--
Nick Keighley

Mar 10 '06 #13
Mike Wahler wrote:

I learned C on MS-DOS systems. I found using a debugger
(even with 'working' code) to be an extremely good aid
in understanding the language and how it was implemented
on that system. E.g. when creating a new function, before
integrating it with the main program, I'd run it in a
'test harness' under a debugger, and more often than
not, I was able to find and fix bugs before they got
into the main application.

Sure, but that's not what was claimed. The original statement said
"existing programs", so not the one under development. I don't think
tracing someone else's code is likely to be much of a learning tool.

Personally I've never found that even reading other code was useful for
learning basic programming. It teaches one how to read code, which is a
useful skill in and of itself, but not how to program. Only writing
code teaches you that.

An experienced programmer may well look at existing code for tips on
how to approach a problem, but that's another thing altogether.

--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Mar 11 '06 #14

"Default User" <de***********@ yahoo.com> wrote in message
news:47******** ****@individual .net...
Mike Wahler wrote:

I learned C on MS-DOS systems. I found using a debugger
(even with 'working' code) to be an extremely good aid
in understanding the language and how it was implemented
on that system. E.g. when creating a new function, before
integrating it with the main program, I'd run it in a
'test harness' under a debugger, and more often than
not, I was able to find and fix bugs before they got
into the main application.

Sure, but that's not what was claimed.


OK, perhaps I misunderstood. I was simply stating
that I found a debugger to be useful while learning
the language.

The original statement said
"existing programs", so not the one under development. I don't think
tracing someone else's code is likely to be much of a learning tool.
I think it can help (provided it's 'decent' code).
Personally I've never found that even reading other code was useful for
learning basic programming.
I have, especially textbook examples. I suppose this is
just a case of YMMV. :-)
It teaches one how to read code, which is a
useful skill in and of itself, but not how to program. Only writing
code teaches you that.
I also think writing code is the probably the most useful way to learn.
My remarks about a debugger were in that context. "Write it, then
watch it."

An experienced programmer may well look at existing code for tips on
how to approach a problem, but that's another thing altogether.


-Mike
Mar 11 '06 #15
Mike Wahler wrote:

"Default User" <de***********@ yahoo.com> wrote in message
news:47******** ****@individual .net...
Personally I've never found that even reading other code was useful
for learning basic programming.


I have, especially textbook examples. I suppose this is
just a case of YMMV. :-)


I don't mean short illustrative code examples as found in textbooks.
Those have been, hopefully, crafted for teaching purposes. That's not
usually the case with a full-blown program.
I also think writing code is the probably the most useful way to
learn. My remarks about a debugger were in that context. "Write it,
then watch it."


I would agree.

Brian
Mar 11 '06 #16
Richard G. Riley wrote:
"Chris"post ed the following on 2006-03-10:
Richard G. Riley wrote:
"Nick"poste d the following on 2006-03-10: I thought you were implying Linux was better because the *debugger* was
There is no "the debugger" : although gdb is prevalent in Linux -
albeit with several front ends.
"debugger" / "debuggers" whatever. I've used ddd.

better. I've never stepped through an existing application (that wasn't
broken)
with a debugger. If you say it's a good way to learn C, who am I to
argue.
I stress that I talking about "stepping through an application". I have
*no*
objection to examining existing code. One way to learn is to look at
good
examples (and sometimes at bad).

I said its one way to get used to the structure and flow of
applications which is what he wants. Also, I do think a debugger can
give real insight into how C works in the real world : results of
operators there for you to see with no overhead of printfs which some
favor.


The printf's are portable. The printf's work without manual
intervention .


No they dont : you have to insert them in the code.


yes, but you don't have to keep on inserting them. Debuggers are
generally manual.

But thats being petty.
I beg to differ.
Its rare that I find someone wanting their printfs to be
portable in a system process or a an X gui or a Win 32 winproc : they
dont work. Home grown or system supplied logging libraries possibly :
but can you really analyse them at run time? I cant : I like to step
through and see the flow of the app to get a feel for how the systems
heart is beating.
ok I'm not saying you are wrong. I'm just pointing out that not
everyone
works and learns the way you do. I don't single step debuggers to
examine other people's applications

The printfs work without having to understand an additional tool.
But it *still* sounds bizzare to me

What does?
using a debugger to examine existing applications

Are we talking about the same thing? Do you doubt that
watching other, well written apps work is beneficial to a newbie?
*examining* existing applications and other examples, yes.
*stepping* existing applications and other examples, no.

It
seems fairly clear to me that it can only help. Its how the entire
Open SW system works : people learning by doing and picking up on
other peoples work.

right. BUT NOT IN A DEBUGGER

You've conflated "learning by doing and picking up on> other peoples work"
with "watching ... apps work" and that with stepping through an application
using a debugger. I think that's misleading.


Really? Seems pretty straightforward to me and also how close on 100% of
Universities teach coding at some stage or other :


really? *all* universities encourage the use of stepping?
Do you have statistics?

Could you go back and *read* what I and other posters have actually
been saying?

adding modules to existing systems.
yes! absoloutly!

Maybe I'm a bit slow today but I'm not seeing the
subtleties of the point you are making here :
well you don't "add to an existing module" by using a debugger.

the user is looking for
a way to learn how to structure applications and build them himself.
yes yes

I fail to see how analysing existing, successful apps can be anything
other than beneficial. It doesnt take away the donkey work of learning
the lanugage basics, but it can make text book "science" much more
accessible and "real". I cant imagine becoming a programmer without
such practice, guidance and "practical training". Its the same in all
walks of life.
I think I'll give up here. My point wasn't that important. Just trying
to
make the point that different people do thinks in different ways. Linux

is not the only platform. Not everyone uses debuggers the way you do
(some people only use them when they suspect a compiler error). A
newbie should be aware there are different ways to do things and not
lock themselves into a particular approach too early.

Maybe I'll even get my debugger out and step through a program
sometime to see if it brings me any insights. Maybe you should try
a "debugger free day" and try and see what you have to do to manage
without. Try reasoning about the program. Consider invariants and
post/pre conditions. Try adding asserts etc.

no way is the One True Way

"A desk is a dangerous place from which to view the world" - LeCarre.


"there is nothing as practical as a good theory" Lewin
--
Nick Keighley

Mar 11 '06 #17
Richard G. Riley wrote:
"Nick"poste d the following on 2006-03-11:
Richard G. Riley wrote:
"Chris"post ed the following on 2006-03-10:
> Richard G. Riley wrote:
>> "Nick"poste d the following on 2006-03-10: >>> I thought you were implying Linux was better because the *debugger* was
>
>> There is no "the debugger" : although gdb is prevalent in Linux -
>> albeit with several front ends.
"debugger" / "debuggers" whatever. I've used ddd.


ddd is a front end to gdb.


I know

>>> better. I've never stepped through an existing application (that wasn't
>>> broken)
>>> with a debugger. If you say it's a good way to learn C, who am I to
>>> argue.


I stress that I talking about "stepping through an application". I have
*no*
objection to examining existing code. One way to learn is to look at
good
examples (and sometimes at bad).


And how can stepping through an app be bad? Were you never put onto a
new project with a code base of several hundred thousand lines of code
and told to isolate some relatively bugs to get you familiar with the
code base?


about a year ago I was put on 750 kloc application. I had no previous
experience with the application. And limited experience with the
programming language. I did not step through the code with a debugger.
>> I said its one way to get used to the structure and flow of
>> applications which is what he wants. Also, I do think a debugger can
>> give real insight into how C works in the real world : results of
>> operators there for you to see with no overhead of printfs which some
>> favor.
>
> The printf's are portable. The printf's work without manual
>intervention .

No they dont : you have to insert them in the code.


yes, but you don't have to keep on inserting them. Debuggers are
generally manual.
<snip>
I meant me pointing out they are useless in most server based apps or
message driven GUI apps.
there are alternatives to printf(). I usually use some sort of logger.
For both
servers and GUIs. That 750kloc application has both.

Its rare that I find someone wanting their printfs to be
portable in a system process or a an X gui or a Win 32 winproc : they
dont work. Home grown or system supplied logging libraries possibly :
but can you really analyse them at run time? I cant : I like to step
through and see the flow of the app to get a feel for how the systems
heart is beating.


ok I'm not saying you are wrong. I'm just pointing out that not
everyone
works and learns the way you do. I don't single step debuggers to
examine other people's applications


Thats fine Nick : I dont expect you too - but you seem to have strong
reasons for making a point against it whereas I see *only* benefits.


ok, we disagree. What's wrong with *reading* the code. UML? Source
browsers?

> The printfs work without having to understand an additional tool.
>
>>> But it *still* sounds bizzare to me
>>
>> What does?


using a debugger to examine existing applications


We wont get into the pissing contest of who has worked on more
apps/platforms etc but I find it a good teaching tool to get people up
to speed with an app and its internal data structures : modify on the
fly, symbol tables etc. Cant do that with a print out or printfs.


I have *never* had any desire to do these things. Find the bug. Fix
the bug. Why would you want to modify things on-the-fly?!

>> Are we talking about the same thing? Do you doubt that
>> watching other, well written apps work is beneficial to a newbie?


*examining* existing applications and other examples, yes.
*stepping* existing applications and other examples, no.


for me "examining" is "stepping" : but obviously with some
strategically placed break points and a few retunr to callers etc :)


"examine", to me, means to study the source code. A good source
browser can be handy.

>> It
>> seems fairly clear to me that it can only help. Its how the entire
>> Open SW system works : people learning by doing and picking up on
>> other peoples work.


right. BUT NOT IN A DEBUGGER


Really : in a debugger. Do you really advocate printfs over a debugger
in a huge code base?


:-)

How do you map data values to their equivalent
constants? To me it sounds incredible. If you hadnt mentioned ddd I
would wonder if we are talking about the same thing.
some constants get dumped as numbers. Some enums are already wrappered
so as to be able to decode themselves (ok I admit this is C++, ...its
only a
*little bit* of a move to the Dark Side. I can stop any time I want).
> You've conflated "learning by doing and picking up on> other peoples work"
> with "watching ... apps work" and that with stepping through an application
> using a debugger. I think that's misleading.

Really? Seems pretty straightforward to me and also how close on 100% of
Universities teach coding at some stage or other :


really? *all* universities encourage the use of stepping?
Do you have statistics?


Maybe stepping is the key word here : it does not mean every line. It
means strategically placed break points and data analysis at those
points. It is an art.


and *all* universities teach it? Its a long time since I was at
university.

Yorkshire Man 2:
"Symbolic debuggers! You were lucky we 'ad t'punch t' cards with ar
teeth!"
Could you go back and *read* what I and other posters have actually
been saying?


I did. Some people seem to think that a debugger is just for finding
bugs : it is not. It is also useful for examining runtime trends. Far
more useful than hard to decipher printfs, especially in a non console mode.


but you have to know where to put the breaks. And that means you must
at
least partially understand the application. To do that I'd read the
code...
adding modules to existing systems.


yes! absoloutly!
Maybe I'm a bit slow today but I'm not seeing the
subtleties of the point you are making here :


well you don't "add to an existing module" by using a debugger


Of course you do. You use it to examine the data flow between the
system and your module.


well I add to an existing module with a Text Editor. I'm not being
funny
here we *really* seem to be missing each others point.

I REALLY don't use a debugger to add code to an existing module.
the user is looking for
a way to learn how to structure applications and build them himself.


yes yes
I fail to see how analysing existing, successful apps can be anything
other than beneficial. It doesnt take away the donkey work of learning
the lanugage basics, but it can make text book "science" much more
accessible and "real". I cant imagine becoming a programmer without
such practice, guidance and "practical training". Its the same in all
walks of life.


I think I'll give up here. My point wasn't that important. Just trying
to
make the point that different people do thinks in different ways. Linux

is not the only platform. Not everyone uses debuggers the way you do


Nobody said it was : you came flying in with that.


riight
The OP had
expressed an intrest in Linux and the fact that it comes with free
industry strength compilers and debuggers as well as hundreds of rock
solid C apps complete with build packages makes it a good bet for
someone to learn how to structure and analyse an application in
C. Windows can not compete with that IMO.
it's a perfectly good development platform though. Look Linux is ok.
Windows is ok. But two posters had encouraged the OP to move to
Linux. I'm not sure its such an open and shut decsision. You can
write crap non-portable code on Linux as well.
(some people only use them when they suspect a compiler error). A


If there is a compile error, you wont be using a debugger.


well compiler bugs are about as rare as hens teeth. But why not? The
debugger would show you that the program flow or calculation results
did not follow the source code. All my tools are broken if the source
code does not represent what the machine is doing.

To be honest I can't remember the last time I had a bug caused by a
compiler error
newbie should be aware there are different ways to do things and not
lock themselves into a particular approach too early.


A newbie needs to examine other peoples stuff : especially when
adding/fixing bugs. Approaches vary, but it can never hurt to get down
and dirty to be sure.

A newbie certainly shouldnt dedicate his life to printf()'s : they
simply do not work in a lot of environments, are inflexible, and only
show the data that you WANT to see, not the data you SHOULD see. This
is where a debuggers "locals" view etc comes in. You see alllocal
data. Not what someone thinks they need to see.
Maybe I'll even get my debugger out and step through a program
sometime to see if it brings me any insights. Maybe you should try
a "debugger free day" and try and see what you have to do to manage
without. Try reasoning about the program. Consider invariants and
post/pre conditions. Try adding asserts etc.


If you recall I did mention that a home brew logging system is
prefential to printf :


where did the words "homebrew logging system" appear in the paragraph
above? I did write a fairly blunt paragraph here. And then thought
better of it.
Do you know what an invarient is? Design by contract?

I have nothing against them and have
implemented many with various backend report generators to examine the
data.
good!
A debugger isnt the only tool : and I never said it was. What it
can do is allow you to see the flow of an application while watching
live data, allow you to modify that data
never felt the need. Not since compilers got fast enough to run during
the day.
and to examine and ensure
data typing is consistant from skillful use of register/pointer/memory
examinations : it is why they exist.
you examine registers? On a deeply embedded system, ok. But a server?
no way is the One True Way


And no where did I say it was. The whole crux here is you doubting
that stepping an existing app can help a user understand it : after
many, many and varied projects on various platforms in various
languages I find it incredulous how you could doubt this would be
beneficial. In order to even put in these printfs() you need some
understanding of whats going : that does not come from a print out all
the time. It does not some from a func spec which is not always
there. It does not come from holistic overview : it comes from
stepping through and examining what is going on. From finding out when
and why certain modules are called. From knowing what that little bit
of bit fiddling results in, from forcing a function call at runtime in
order to test a different calling parameter. The list goes on. Of
course none of this is "the only way" : but its a good way and one
thats been used a lot for years.


I'd say the same went (in spades) for stepping. You've got to know
where
to step. There's source code, case tools, source browsers, source code.
I've even resorted to grep to find callers of functions.
Do you need a debugger for a ten line string rversal func? Maybe not :
but I'll tell you a little secret, I'd still use one to test it
rigorously before handing it in to a system for an integration
test. Total extra effort? About 5 minutes.
I'd write unit test. Also five minutes work and more likely to give
proper
coverage.
I realise that there is a core here who seem to think a debugger is
almost evil : I sometimes question if they have used a real
debugger on a real system in the real world where programmers are
cycled on and off projects and people want to optimise their "up to
speed" figures.
normally I don't get into what I work on, but yes I do work on projects

where people get cycled on and off. I'm one of the cycled. It's a real
system. In the real world. Real people pay real money for the
facilities
it provides. And there is a requirement for more performance.

I'm not accusing you of it, but sometimes people seem to spend way
too much time hunched over a debugger when a bit of thought might
save them some time.
I realise that according to some posters some projects
get by without a debugger : I've never had the pleasure of such a
project/system.
"A desk is a dangerous place from which to view the world" - LeCarre.


"there is nothing as practical as a good theory" Lewin

--
Nick Keighley

Mar 11 '06 #18
On 2006-03-11, Nick Keighley <ni************ ******@hotmail. com> wrote:
Richard G. Riley wrote:
"Nick"poste d the following on 2006-03-11:
> Richard G. Riley wrote:
>> "Chris"post ed the following on 2006-03-10:
>> > Richard G. Riley wrote:
>> >> "Nick"poste d the following on 2006-03-10: >> >>> I thought you were implying Linux was better because the *debugger* was
>> >
>> >> There is no "the debugger" : although gdb is prevalent in Linux -
>> >> albeit with several front ends.
>
> "debugger" / "debuggers" whatever. I've used ddd.
ddd is a front end to gdb.


I know

>> >>> better. I've never stepped through an existing application (that wasn't
>> >>> broken)
>> >>> with a debugger. If you say it's a good way to learn C, who am I to
>> >>> argue.
>
> I stress that I talking about "stepping through an application". I have
> *no*
> objection to examining existing code. One way to learn is to look at
> good
> examples (and sometimes at bad).


And how can stepping through an app be bad? Were you never put onto a
new project with a code base of several hundred thousand lines of code
and told to isolate some relatively bugs to get you familiar with the
code base?


about a year ago I was put on 750 kloc application. I had no previous
experience with the application. And limited experience with the
programming language. I did not step through the code with a

debugger.

Your choice. I would have. Especially when I modified the code. But
again you are offering no evidence to suggest that stepping through an
app is "crazy" or "bizarre" as you originally claimed.
>> >> I said its one way to get used to the structure and flow of
>> >> applications which is what he wants. Also, I do think a debugger can
>> >> give real insight into how C works in the real world : results of
>> >> operators there for you to see with no overhead of printfs which some
>> >> favor.
>> >
>> > The printf's are portable. The printf's work without manual
>> >intervention .
>>
>> No they dont : you have to insert them in the code.
>
> yes, but you don't have to keep on inserting them. Debuggers are
> generally manual.
<snip>
I meant me pointing out they are useless in most server based apps or
message driven GUI apps.
there are alternatives to printf(). I usually use some sort of logger.
For both
servers and GUIs. That 750kloc application has both.


Fine. But often loggers affect the app. And again, you only see what
you are told you can see.. : a debugger lets you see what you want to
see when you want to see it. Being able to see the data greatly
simplifies understanding an application and I cant expect anyone to
dispute that. But someone will ... :-;

>> Its rare that I find someone wanting their printfs to be
>> portable in a system process or a an X gui or a Win 32 winproc : they
>> dont work. Home grown or system supplied logging libraries possibly :
>> but can you really analyse them at run time? I cant : I like to step
>> through and see the flow of the app to get a feel for how the systems
>> heart is beating.
>
> ok I'm not saying you are wrong. I'm just pointing out that not
> everyone
> works and learns the way you do. I don't single step debuggers to
> examine other people's applications
Thats fine Nick : I dont expect you too - but you seem to have strong
reasons for making a point against it whereas I see *only* benefits.


ok, we disagree. What's wrong with *reading* the code. UML? Source
browsers?


Because not all code is readable? Because not all code can be properly
deciphered from reading? Because you dont know what data is coming up
from those functions 40 deep? Becuase its plagues with missplaced
casts?

You dont know what branch conditions are going to be taken based on HW
port values? There are numerous reasons.


>> > The printfs work without having to understand an additional tool.
>> >
>> >>> But it *still* sounds bizzare to me
>> >>
>> >> What does?
>
> using a debugger to examine existing applications
We wont get into the pissing contest of who has worked on more
apps/platforms etc but I find it a good teaching tool to get people up
to speed with an app and its internal data structures : modify on the
fly, symbol tables etc. Cant do that with a print out or printfs.


I have *never* had any desire to do these things. Find the bug. Fix
the bug. Why would you want to modify things on-the-fly?!


Modify data to test or force a state. Its a basic of debugger use : you can
force your hand to avoid having to wait for a certain random data
suite to trigger the bug.

e.g someone says I'm getting a divide by zero somewhere near func().

go to func in debugger, force a zero into the divisor and see why the
checks arent stopping it. Simple example.

>> >> Are we talking about the same thing? Do you doubt that
>> >> watching other, well written apps work is beneficial to a newbie?
>
> *examining* existing applications and other examples, yes.
> *stepping* existing applications and other examples, no.
for me "examining" is "stepping" : but obviously with some
strategically placed break points and a few retunr to callers etc :)


"examine", to me, means to study the source code. A good source
browser can be handy.


A good debugger is that too.
>> >> It
>> >> seems fairly clear to me that it can only help. Its how the entire
>> >> Open SW system works : people learning by doing and picking up on
>> >> other peoples work.
>
> right. BUT NOT IN A DEBUGGER
Really : in a debugger. Do you really advocate printfs over a debugger
in a huge code base?


:-)

How do you map data values to their equivalent
constants? To me it sounds incredible. If you hadnt mentioned ddd I
would wonder if we are talking about the same thing.


some constants get dumped as numbers. Some enums are already wrappered
so as to be able to decode themselves (ok I admit this is C++, ...its
only a
*little bit* of a move to the Dark Side. I can stop any time I want).


I'm not good at remembering what 0xefecda means. I prefer something in
the debugger like "WM_GETFOCU S" or some such.
>> > You've conflated "learning by doing and picking up on> other peoples work"
>> > with "watching ... apps work" and that with stepping through an application
>> > using a debugger. I think that's misleading.
>>
>> Really? Seems pretty straightforward to me and also how close on 100% of
>> Universities teach coding at some stage or other :
>
> really? *all* universities encourage the use of stepping?
> Do you have statistics?


Maybe stepping is the key word here : it does not mean every line. It
means strategically placed break points and data analysis at those
points. It is an art.


and *all* universities teach it? Its a long time since I was at
university.


me too.
Yorkshire Man 2:
"Symbolic debuggers! You were lucky we 'ad t'punch t' cards with ar
teeth!"

:)
> Could you go back and *read* what I and other posters have actually
> been saying?


I did. Some people seem to think that a debugger is just for finding
bugs : it is not. It is also useful for examining runtime trends. Far
more useful than hard to decipher printfs, especially in a non console mode.


but you have to know where to put the breaks. And that means you must
at
least partially understand the application. To do that I'd read the
code...


So do I: of course. But i also analyse the flow at the same time : a
debugger does let you read the code you know :-;
>> adding modules to existing systems.
>
> yes! absoloutly!
>
>> Maybe I'm a bit slow today but I'm not seeing the
>> subtleties of the point you are making here :
>
> well you don't "add to an existing module" by using a debugger
Of course you do. You use it to examine the data flow between the
system and your module.


well I add to an existing module with a Text Editor. I'm not being
funny
here we *really* seem to be missing each others point.


No you dont. You use a text editor to create the symbolic equivalent
which is then compiled & linked into the bigger app. The debugger can then be
used to force data between your interfaces and the legacy very easily
for the purposes of quick integration testing. Yes, there are other
ways too.
I REALLY don't use a debugger to add code to an existing module.

No. Nor do I. I use it, frequently, to monitor the addition. No one
here is suggesting the debugger is a compiler & linker & editor. It is
for me part of the process. Not for all, but we're heading back down
that well covered track again :)
>> the user is looking for
>> a way to learn how to structure applications and build them himself.
>
> yes yes
>
>> I fail to see how analysing existing, successful apps can be anything
>> other than beneficial. It doesnt take away the donkey work of learning
>> the lanugage basics, but it can make text book "science" much more
>> accessible and "real". I cant imagine becoming a programmer without
>> such practice, guidance and "practical training". Its the same in all
>> walks of life.
>
> I think I'll give up here. My point wasn't that important. Just trying
> to
> make the point that different people do thinks in different ways. Linux
>
> is not the only platform. Not everyone uses debuggers the way you do


Nobody said it was : you came flying in with that.


riight


You did. Look at the thread. The OP mentioned Linux : I said it was a
good idea for what he wanted to do : you came in with "hold on hold on
lets not start an OS war here".
The OP had
expressed an intrest in Linux and the fact that it comes with free
industry strength compilers and debuggers as well as hundreds of rock
solid C apps complete with build packages makes it a good bet for
someone to learn how to structure and analyse an application in
C. Windows can not compete with that IMO.
it's a perfectly good development platform though. Look Linux is ok.
Windows is ok. But two posters had encouraged the OP to move to
Linux. I'm not sure its such an open and shut decsision. You can
write crap non-portable code on Linux as well.


But you dont have the facilities to support his learning as well IMO :
remember me mentioning the thousands of apps with source code? No one
is saying Linux is "better", but I would say its better for someone
wanting to get into C programming big time : everything is part of the
base install. For Free. And documented.
> (some people only use them when they suspect a compiler error). A
If there is a compile error, you wont be using a debugger.


well compiler bugs are about as rare as hens teeth. But why not? The
debugger would show you that the program flow or calculation results
did not follow the source code. All my tools are broken if the source
code does not represent what the machine is doing.

To be honest I can't remember the last time I had a bug caused by a
compiler error


Different things. I meant compilation error : sorry.
> newbie should be aware there are different ways to do things and not
> lock themselves into a particular approach too early.
A newbie needs to examine other peoples stuff : especially when
adding/fixing bugs. Approaches vary, but it can never hurt to get down
and dirty to be sure.

A newbie certainly shouldnt dedicate his life to printf()'s : they
simply do not work in a lot of environments, are inflexible, and only
show the data that you WANT to see, not the data you SHOULD see. This
is where a debuggers "locals" view etc comes in. You see alllocal
data. Not what someone thinks they need to see.
> Maybe I'll even get my debugger out and step through a program
> sometime to see if it brings me any insights. Maybe you should try
> a "debugger free day" and try and see what you have to do to manage
> without. Try reasoning about the program. Consider invariants and
> post/pre conditions. Try adding asserts etc.


If you recall I did mention that a home brew logging system is
prefential to printf :


where did the words "homebrew logging system" appear in the paragraph
above? I did write a fairly blunt paragraph here. And then thought
better of it.
Do you know what an invarient is? Design by contract?


I used those words. Its when you wrap whatever underlying logging system is
convenient to you in a fairly generic calling interface : so you could
log to files, text consoles, window systems whatever without changing
the calling code.
I have nothing against them and have
implemented many with various backend report generators to examine the
data.
good!
A debugger isnt the only tool : and I never said it was. What it
can do is allow you to see the flow of an application while watching
live data, allow you to modify that data


never felt the need. Not since compilers got fast enough to run during
the day.


I really dont understand this. What has that got to do with a debugger?
and to examine and ensure
data typing is consistant from skillful use of register/pointer/memory
examinations : it is why they exist.


you examine registers? On a deeply embedded system, ok. But a
server?
I also mentioned memory and pointers. And yes I do. Very useful in
debugging big C systems.
> no way is the One True Way
>
And no where did I say it was. The whole crux here is you doubting
that stepping an existing app can help a user understand it : after
many, many and varied projects on various platforms in various
languages I find it incredulous how you could doubt this would be
beneficial. In order to even put in these printfs() you need some
understanding of whats going : that does not come from a print out all
the time. It does not some from a func spec which is not always
there. It does not come from holistic overview : it comes from
stepping through and examining what is going on. From finding out when
and why certain modules are called. From knowing what that little bit
of bit fiddling results in, from forcing a function call at runtime in
order to test a different calling parameter. The list goes on. Of
course none of this is "the only way" : but its a good way and one
thats been used a lot for years.


I'd say the same went (in spades) for stepping. You've got to know
where
to step. There's source code, case tools, source browsers, source code.
I've even resorted to grep to find callers of functions.


grep is ok : if I dont have a decent IDE I use something like emacs
tags. I have used grep in about 15 years :)
Do you need a debugger for a ten line string rversal func? Maybe not :
but I'll tell you a little secret, I'd still use one to test it
rigorously before handing it in to a system for an integration
test. Total extra effort? About 5 minutes.


I'd write unit test. Also five minutes work and more likely to give
proper
coverage.
I realise that there is a core here who seem to think a debugger is
almost evil : I sometimes question if they have used a real
debugger on a real system in the real world where programmers are
cycled on and off projects and people want to optimise their "up to
speed" figures.


normally I don't get into what I work on, but yes I do work on projects

where people get cycled on and off. I'm one of the cycled. It's a real
system. In the real world. Real people pay real money for the
facilities
it provides. And there is a requirement for more performance.

I'm not accusing you of it, but sometimes people seem to spend way
too much time hunched over a debugger when a bit of thought might
save them some time.


No doubt. And equally the opposite applies : in my experience more so.
I realise that according to some posters some projects
get by without a debugger : I've never had the pleasure of such a
project/system.
>> "A desk is a dangerous place from which to view the world" - LeCarre.
>
> "there is nothing as practical as a good theory" Lewin


Mar 11 '06 #19
"Nick Keighley" <ni************ ******@hotmail. com> writes:
Richard G. Riley wrote:
"Nick"poste d the following on 2006-03-11:
> Richard G. Riley wrote:
>> "Chris"post ed the following on 2006-03-10:
>> > Richard G. Riley wrote:
>> >> "Nick"poste d the following on 2006-03-10: >> >>> I thought you were implying Linux was better because the
>> >>> *debugger* was
>> >
>> >> There is no "the debugger" : although gdb is prevalent in Linux -
>> >> albeit with several front ends.
>
> "debugger" / "debuggers" whatever. I've used ddd.


ddd is a front end to gdb.


I know
>> >>> better. I've never stepped through an existing application
>> >>> (that wasn't broken) with a debugger. If you say it's a good
>> >>> way to learn C, who am I to argue.
>
> I stress that I talking about "stepping through an application". I have
> *no*
> objection to examining existing code. One way to learn is to look at
> good
> examples (and sometimes at bad).


And how can stepping through an app be bad? Were you never put onto a
new project with a code base of several hundred thousand lines of code
and told to isolate some relatively bugs to get you familiar with the
code base?


about a year ago I was put on 750 kloc application. I had no previous
experience with the application. And limited experience with the
programming language. I did not step through the code with a debugger.

[...]

If I might summarize:

Richard G. Riley really likes debuggers. Not everyone else likes them
as much as Richard does.

I believe that covers all the relevant points.

Next?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 11 '06 #20

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

Similar topics

5
2162
by: Ron Stephens | last post by:
The newly rechristened Python Learning Foundation is a web site dedicated to the assistance of people learning the Python programming language. Features include: 1. Daily lists of new and recent Python-related web articles, Sourceforge projects, and Vaults of Parnassus listings. These are generated using Hans Nowak's Python web spider, mygale.py, and are automatically updated each day. (You can visit Han's interesting blog at <a href =...
29
3531
by: Jhon smith | last post by:
Hi,all,I was just wondering if I am likly to have any problems trying to learn C from older books,I have some from the late 80`s,mid/late 90`s. I am using Dev-C++ on the pc windows platform,But I have noticed small differnces in the books such as,int main(),main(void),fprintf,and others,just wondering if these older books are still worth trying to learn from as Im on a very tight budget and can`t really afford any thing else,or are they...
4
2069
by: Christian Blackburn | last post by:
Hi Gang, I saw this for sale online: Microsoft Visual Basic.NET Deluxe Learning Edition Version 2003. I'm wondering is the CD that's bundled with the learning edition just a digitized version of the book or is it an interactive tutorial? Thanks, Christian Blackburn
1
9690
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
7
1599
by: Max | last post by:
On monday I start a semester course in Python (the alternative was Java). I was looking through the course outline and noticed the following: 1) UserDict is used. This is deprecated, right? 2) There is no mention of list comprehensions, but map and filter are taught early and then revisited later. I don't think this is good: list comprehensions are, IMO, one of Python's great features, Psyco prefers them, they're more pythonic, and map...
36
2578
by: utab | last post by:
Dear, I have experince in C( numerical projects, like engineering problems, scientific applications) I have the basic notion of C++ also, I have read Accelerated C++ until Chapter 7, however it seems that it discusses the std and the other part of the language with your own abstractions. Is that better to read a book first on the basic concepts of C++ language (but not the C part) that gives the basics as if the reader is a beginner...
2
1261
by: bokiteam | last post by:
Hi All, Here is my idea to save learning time - Personal learning book. What we really need is somebody really familiar our learning experience, and then takes the example to teach us. Save the learning time. For example, a person David who understands JAVA, VB, C programming, he doesn't want to pay too much time to study a C# programming book. If
78
4299
by: arnuld | last post by:
hai all, i am standing on a "crossroad to C++". I am here in front of you as i have a problem. i will be brief. Please do not think: "arnuld is sick", i am really struggling & doing hard-work to become a Modern C++ Programmer & i am feeling as if i am standing on a crossroad. i am asking because every time i made a decision on my own, in my past, i always ran into huge wastage of time, money & effort. that is why i am posting it here:
0
1571
by: LK~ICT | last post by:
Sri Lanka rural e-learning project seeks corporate support Dec 04, 2007 (LBO) - A Sri Lankan e-learning initiative for rural students is seeking corporate sector support to expand and cover 400 computer centers around the island, its designers said. The Shilpa Sayura project initiated by eFusion, a local software company, is a learning tool for rural students who do not have the necessary number of teachers and lack resources to...
16
1779
by: John Salerno | last post by:
Just something that crosses my mind every time I delve into "Learning Python" each night. Does anyone see any value in learning Python when you don't need to for school, work, or any other reason? I mean, sure, there's value in learning anything at any time, but for something like a programming language, I can't help but feel that I will be mostly unable to use what I learn simply because I have no reason to use it. The *process* of...
0
9964
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
11112
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...
1
11295
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10659
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
8218
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
6079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6298
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4908
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
3
3506
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.