Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   How to program my own code. (http://www.velocityreviews.com/forums/t806797-how-to-program-my-own-code.html)

JoeNapoleon 12-10-2011 12:57 PM

How to program my own code.
 
Why I can not program my own code if I don't look at other's code.
How can I program by myself and not look at the book. Thank you.

Eric Sosman 12-10-2011 01:24 PM

Re: How to program my own code.
 
On 12/10/2011 7:57 AM, JoeNapoleon wrote:
> Why I can not program my own code if I don't look at other's code.
> How can I program by myself and not look at the book. Thank you.


The C language is relatively terse, and a perfectly sensible
"utterance" in C may look like a random string of gibberish to the
unpracticed. When you're just beginning, code like `while(*p++=*q++);'
may be difficult to understand, and it even has a tiny trap that could
lead your understanding astray!

But practice will improve your skill in reading C, and you will
get that practice by reading others' code and reading code in books
(unless you're unlucky enough to read bad books or bad code, of
course; there is unfortunately no shortage of either). In a fairly
short time you will become able to read most C with reasonable ease,
and will only need to open the book in extreme cases. Trust me: This
skill *will* come, and it will come sooner than you imagine if you
read good code frequently.

Another effect is that reading good code will improve your own
writing of code: You will learn what some call C's "idioms" and when
to use them as building blocks in your own constructions. You will
learn how to write more clearly, to communicate your code's intent
to future readers (including yourself in six months' time) who may
be trying to figure out what your code is supposed to do as opposed
to what it actually does ...

So, all I can suggest is that you stick with it. Skill will come
with practice, and you will become more self-sufficient as your skills
improve. Good luck!

--
Eric Sosman
esosman@ieee-dot-org.invalid

Wolfgang.Draxinger 12-16-2011 11:43 AM

Re: How to program my own code.
 
On Sat, 10 Dec 2011 08:24:32 -0500
Eric Sosman <esosman@ieee-dot-org.invalid> wrote:

> But practice will improve your skill in reading C, and you will
> get that practice by reading others' code and reading code in books
> (unless you're unlucky enough to read bad books or bad code, of
> course; there is unfortunately no shortage of either). In a fairly
> short time you will become able to read most C with reasonable ease,
> and will only need to open the book in extreme cases. Trust me: This
> skill *will* come, and it will come sooner than you imagine if you
> read good code frequently.


Just for reference, some of the IMHO best open source C code you can
read for getting the grip of C are the programs by Daniel J. Bernstein,
in particular qmail, djbdns and the underlying libdjb. To
be found here: http://cr.yp.to

Another IMHO very good reference for high quality C are the
dietlibc and libowfat of Felix von Leitner. http://www.fefe.de/dietlibc
http://www.fefe.de/libowfat


Wolfgang


Seebs 12-16-2011 07:50 PM

Re: How to program my own code.
 
On 2011-12-16, Wolfgang.Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de> wrote:
> Just for reference, some of the IMHO best open source C code you can
> read for getting the grip of C are the programs by Daniel J. Bernstein,
> in particular qmail, djbdns and the underlying libdjb. To
> be found here: http://cr.yp.to


I think this marks the first time I've ever heard anyone suggest that
djb's code is good for learning from. Robust in the face of attack, maybe.

A quick browse of some of it does not leave me more impressed than I
used to be.

-s
--
Copyright 2011, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

ralph 12-16-2011 09:14 PM

Re: How to program my own code.
 
On 16 Dec 2011 19:50:54 GMT, Seebs <usenet-nospam@seebs.net> wrote:

>On 2011-12-16, Wolfgang.Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de> wrote:
>> Just for reference, some of the IMHO best open source C code you can
>> read for getting the grip of C are the programs by Daniel J. Bernstein,
>> in particular qmail, djbdns and the underlying libdjb. To
>> be found here: http://cr.yp.to

>
>I think this marks the first time I've ever heard anyone suggest that
>djb's code is good for learning from. Robust in the face of attack, maybe.
>
>A quick browse of some of it does not leave me more impressed than I
>used to be.
>


lol

I always have an amount of respect for anyone that is willing to
publish what they have written, as I have never been able to look back
at code I've written, after as little as six months, without the
occasional wince, slap to the forehead, and a desire to rewrite a bit
of it. <bg>

-ralph

Morris Keesan 12-20-2011 08:27 PM

Re: How to program my own code.
 
On Fri, 16 Dec 2011 06:43:18 -0500, Wolfgang.Draxinger
<Wolfgang.Draxinger@physik.uni-muenchen.de> wrote:

> Just for reference, some of the IMHO best open source C code you can
> read for getting the grip of C are the programs by Daniel J. Bernstein,
> in particular qmail, djbdns and the underlying libdjb. To
> be found here: http://cr.yp.to


I looked at the qmail source in detail, almost 10 years ago, and found
it to be almost unreadable: it had an almost total absence of comments,
and the names of functions and variables were terse beyond reason,
typically one or two characters, whose meaning only became (slightly)
clear after reading the entire body of a function to figure out what it
did. I thought the design of the application was quite nice, but the
code was some of the *worst* I've ever seen.

--
Morris Keesan -- mkeesan@post.harvard.edu


All times are GMT. The time now is 02:28 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.