As I consider taking the plunge and pick up a beginner's C book (any recommendations?), I'd like to hear thoughts on this. In what specific ways would you say C can expands programming horizons?
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop";
$nysus = $PM . $MCF;
Click here if you love Perl Monks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How does learning C benefit a programmer?
by Masem (Monsignor) on Jul 29, 2001 at 01:17 UTC | |
Then one day, the entire concept of pointers clicked. The rest of C was (practically) a breeze to learn after that. Then came C++, and I had the same sticking-point with regards to references, but I shortly learned that these were just glorified pointers. Particularly in relationship to what was passed to functions and was mutable in those. Since that point, I've not had a problem with any other language that is "low-level" enough to have access to memory locations directly. Has this helped me for a language like perl? Certainly; while you don't really have direct access to memory, references are very important in achieving fast communication between subroutines. Once you see this, building complex programs is rather simple (though of course there's probably more that people need to tackle from that point in regards to what perl can do).
-----------------------------------------------------
| [reply] |
Re: How does learning C benefit a programmer?
by bikeNomad (Priest) on Jul 29, 2001 at 02:30 UTC | |
Some reasons you might want to learn some other (different kind of) language first:
Other sources of good ideas? Object-oriented languages, functional languages, parallel processing languages, distributed-system languages, database languages. Oldies but goodies like Smalltalk and Lisp will have more information available on the 'net, generally. | [reply] |
(tye)Re: How does learning C benefit a programmer?
by tye (Sage) on Jul 29, 2001 at 01:41 UTC | |
C is like a glorified, portable assembly language. It nearly forces you to understand memory allocation, memory addressing (pointers), and other low-level stuff. I've seen people program C without understanding such, but not do it well. Perl is very much like C in a lot of ways but it is very unlike C in this regard. The next item (update: after Perl w/ C) I'd probably add to the list would be some "functional" programming language. - tye (but my friends call me "Tye") | [reply] |
by nysus (Parson) on Jul 29, 2001 at 01:52 UTC | |
Can you be a bit more explicit? I'm assuming you mean there is little or no value in learning C and it would be better to learn something like Python or Java instead. Would this be accurate?
$PM = "Perl Monk's"; | [reply] |
by Nitsuj (Hermit) on Jul 29, 2001 at 21:23 UTC | |
There are several main catagories of languages. you will usually hear of functional, logical, and object oriented languages on the internet. There are many other types that you will hear of in more serious practice, such as assembly and procedural. You will not gain the benefits of learning C from learning Python or Java. They do not offer many of the things that you would learn from C, however, Java is a good intro language for object oriented programming, you might consider learning that before learning C++. What he meant by learning a "functional" language is learning a language that enforces it's own functionality. One such langauge is LISP. It doesn't mean that your programs in LISP will function properly, but rather that they will always be experessed in terms of a function, in the mathematical sense. (+ 2 3) would be a logical line of lisp that returns 5. So you could say (+ (+ 2 3) 2) and get 7. All of the commands in lisp work this way, but it gets a lot harders to understand without properly writing it all out from here on out. Rather than programming procedurally, as in. $x =5; print $x; Your programs ALWAYS take on a functional feel to them. Most collegiate computer science programs strongly encourage their students to learn a functional language at some point in time. I remember my first brushes with them as kind of stressful for most of the students, but that it was greatly rewarding to master LISP. One fun "first lesson" in LISP that I would recommend is to download GIMP and try making some drawings using it. While this is a good intro lesson, I would hardly stop my training in LISP here, as it would be sorely lacking, (especially since LISP is a popular language for AI, and this is not even a common application). Anyway, that's the rundown on functional languages. Good luck in your pursuit of enlightenment! UPDATE I almost suggested ML, or perhaps SCHEME, but decided Lisp was the most common among them. hding's post on learning functional programming in ML reminds me of "quilt ML" from my programming languages textbook sophomore year! Just Another Perl Backpacker | [reply] |
by hding (Chaplain) on Jul 29, 2001 at 22:23 UTC | |
Re: How does learning C benefit a programmer?
by RhetTbull (Curate) on Jul 29, 2001 at 01:58 UTC | |
The book I most recommend for someone who already programs but wants to learn C is Kernighan and Ritchie's The C Programming Language. Kernighan and Ritchie invented C (and did a fair amount of the original Unix OS I believe). | [reply] |
Re: How does learning C benefit a programmer?
by coreolyn (Parson) on Jul 29, 2001 at 01:55 UTC | |
Currently I'm plowing through a Java book. The CD that ships with it is a 'C' tutorial. The author spends the intro and the first chapter saying if you don't know the basics of 'C' basics do the CD before reading the book. In this case because Java structure and syntax is a type of 'C++' language for dummies. (Of course I've heard some say that 'C' is assembly programming for dummies.)
In the case of Perl 'C' is one of the building blocks of the language many terms and structures are laced throughout the language. If your comfortable with Perl you probably would be surprised how much 'C' you've already learned.
For me coding = laziness/OperatingSystem, but sometimes you can't be lazy. Sometimes you have to crawl into the damn chip and tell the bit to it's face what to do. Other than assembly, nothing is better for accomplishing this then 'C'. But 'C' is also a pain in the arse. Nothing is done for you, it assumes nothing, and you have to clean up behind it like a kid before toilet trainning.
In the end, if you know 'C', the OS is yours even if you don't need to use it, and you also gain the benefit that all other languages that you will learn have some vague familiarity. coreolyn | [reply] |
Re: How does learning C benefit a programmer?
by virtualsue (Vicar) on Jul 29, 2001 at 02:11 UTC | |
If you still want to learn C, the only book on the subject that I have ever used is the "The C Programming Language" by Brian Kernighan and Dennis Ritchie. Countless people have said over the years that it's a terrible book for beginners, but I never found another C book that I liked better. Since it's a controversial recommendation, you should probably get other opinions before you spend any money. | [reply] |
by pmas (Hermit) on Jul 31, 2001 at 09:33 UTC | |
I recommend learning C as one (important) step in understanding your computer - and C bring you so close to hardware it's scary sometimes... ;)
If you are inclined to learn another language allowing you to do scary trick and gain complete control of the computer, try FORTH. It allows you to do things as no other languages - for the price. It was said only 10% of programmers are able to program reliably in FORTH, but they all can be very good and productive. The way FORTH is build it might run on bare processor without OS (FORTH will be the OS). It has some simple concepts and some extremely powerfull techniques to define new concepts. I newer seen another language allowing to define new control stuctures so easily. Not data structures, control structures. I recommend to learn C assuming it will be just one of other languages which concepts you are willing learn. If you have intention to learn only one more language (after perl you already know), I will have hard time to decide between java (with all the objects and hype and usefullness for your career etc) and maybe VisualBasic. Maybe, if you are interested in Windows platform, VisualBasic might be a good choice. It is farther away from perl than C, and will give you different perspective. Also, it is common script language for all MS Office products, and believe me, you can do a lot of smart things in VisualBasic for MS Word, or for Outlook, if you'll learn MS Office object model.
I believe it is misunderstanding. This book was never intended to be for beginners - I believe it says so in preface. Just the opposite: is is book for programmers experienced in other languages to get quick understanding of common features other languages have common with C, and how they might differ. And book does excellent job solving this problem -- I alway remember how much more enjoyable experience (for a programmer knowing half a dozen different languages) is to learn new language from a book like Kernighan/Ritchie's book. The only exception so far was Camel book -- and also because it it not intended as first programming book for complete novice with no experience of programming whatsoever. pmas | [reply] [d/l] |
Re: How does learning C benefit a programmer?
by hding (Chaplain) on Jul 29, 2001 at 03:17 UTC | |
I've found that it gives me something to fall back on when I can't get parts of my Lisp code to run fast enough. :-) More generally, though, it forces you to deal with things on a more elemental level, closer to what the machine is actually doing (at least for machines such as they are nowdays). C does very little for you compared to other languages (i.e. higher level languages). You get to have all the "fun" of dealing with memory management, pointers, etc. Learning all this has great pedagogical value. :-) It also will give you great appreciation for the people who have written nice things like garbage collectors for you. Of course, it's useful to know. Many OSes are written in C; many available libraries are C libraries. Even if you're not using C directly, there's a decent chance that you might want to interface with such, and so knowing about C can be useful for that. That all said, I can't think of too many times when I'd want to write anything in C. IMHO it's better off to leave it for when you actually (demonstrably) need it. As others have said, Kernighan and Ritchie is the canonical source for learning C | [reply] |
Re: How does learning C benefit a programmer?
by rchiav (Deacon) on Jul 29, 2001 at 19:45 UTC | |
The first thing learning C would do for you is give you a much better appreciation of Perl. You'll quickly learn all the tedious tasks that Perl hides from the programmer, and what really has to hapen when you do a $name = $first . $last. My most common thought when I first started to learn Perl was, "Wait! You can't do it like that!" It was a struggle for me give in to the simplicity you'll find in Perl. And as others have mentioned, you'll learn a lot about memory allocation and management. With Perl, this is one of the things that just happens. With C, you're responsible. Take a look at Why Not Translate Perl to C? for a very brief example. Read the whole thing. It will also give you some insight into the magic that Perl performs.
Hope this helps.. P.S - Take a look at Practical C Programming. My youngest brother (15) wants to learn how to program and I got him this book. He's going to learn C first to appreciate how easy other languages are :) | [reply] [d/l] |
Re: How does learning C benefit a programmer?
by Nitsuj (Hermit) on Jul 29, 2001 at 04:19 UTC | |
C is an excellent language, and it is important for many reasons. Anybody who questions its relevance to perl should download the source distribution and look at its contents... as it is written entirely in C. C introduces many important concepts to programmers, but by no means do I believe that a programmer's training is complete in having mastered it. One important thing is memory addressing. Memory addressing is an important concept. Another is typecasting. While typecasting is important to learn, types are not strongly enforced in C, as in it is not a "strongly typed" language. An example of a strongly typed language is Ada, a popular programming language that was developed for use in embedded systems (and is actually one of the better programming languages known to the world, it often gains criticism for being "clunky" or "awkward," but most Ada programmers would tell you it merely requires you to program correctly). So, what am I saying and how does this relate to you? Learning C is a step in the right direction towards being a better programmer. It opens a realm of possibilities to you that you may never have considered before, such as writing operating systems, device drivers, and even 3D video games. This isn't to say that what you have learned from perl isn't good knowledge, and this isn't to say that you will know how to write an operating system just by knowing how to write C code (far from it), but anybody who hasn't learned C certainly could benefit from it. Just Another Perl Backpacker | [reply] |
Re: How does learning C benefit a programmer?
by japhy (Canon) on Jul 29, 2001 at 03:34 UTC | |
_____________________________________________________ | [reply] |
Re: How does learning C benefit a programmer?
by greywolf (Priest) on Jul 29, 2001 at 08:38 UTC | |
| [reply] |