LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 12-09-2007, 04:34 PM   #1
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Rep: Reputation: 30
Learning C


How do people get to know C so well? I mean, AP computer science covers Java, and doesn't even touch writing to files or allocating memory (maybe a little), or anything truly interesting. Is there some kind of book or online tutorial where I can go from hello world to Linux kernel in C? Do developers start out by looking at other people's source code? Is it a combination of the two?
 
Old 12-09-2007, 05:34 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,590

Rep: Reputation: 188Reputation: 188
Most programmers start out by learning to program their first language through some sort of formal course. Then they usually go to work as a junior programmer working under the direction of an experienced programmer. There they learn that most programming consists of expanding existing software. As they work on existing software under the direction of an experienced programmer they learn how to work as part of a project team and how to program to the project standards so that other people can rework their code in the future.

As to C versus Java, etc. I think that programmers are best off learning to program as low a level a language as possible. Once you learn to program one language then you can learn additional languages much faster than you learned the first one. Learning a new language which is a higher level language than what you already know is much easier than learning a new language which is a lower level language than what you already know . C is by far the best low level language that I have ever seen. The only thing more instructive than learning C is learning assembly. Even so, for a variety of practical reasons C is a better language to start with than assembly.

So, my recommendation as the best way to learn to program is to learn C from a formal, graded course and then work on a project as a junior programmer under the direction of a senior programmer.

------------------
Steve Stites
 
Old 12-09-2007, 05:46 PM   #3
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
Would such a formal graded course be taken at the University level? I'm in high school right now and all we're offered is the aforementioned AP computer science class. And do you mean working as a junior programmer for a company or on a project like something on Sourceforge?
 
Old 12-09-2007, 07:52 PM   #4
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
Quote:
Originally Posted by worldgnat View Post
Would such a formal graded course be taken at the University level? I'm in high school right now and all we're offered is the aforementioned AP computer science class.
absolutely. at universities they tend to put more emphasis on theory, but they usually do have a bunch of practical programming/software development courses. the intro programming courses would be what your looking for likely. when i was in high school we had maybe two computer courses, and they didnt cover much either so im sure your either at the same level or higher.
Quote:
Originally Posted by worldgnat View Post
And do you mean working as a junior programmer for a company or on a project like something on Sourceforge?
junior programmer usually is a job position, ie entry level programmer at a software company. my guess is that they likely focus on the actual programming, ie debugging current code, implementing new features to existing products, etc, rather than designing software. since your question was kind of broad, i think jailbait was just describing the broad and realistic flow of events for an average programmer.

as to contributing something to a project on sourceforge, i wouldnt recommend contributing anything to any project if you dont know the basics of any programming language. if your being taught java, then stick with it for a bit and practice. following some tutorials and try making some console based applications. they can be anything, for example write a scheduler/planner that uses file i/o (ie a database of calendar events, test dates, shifts at a job, with a console front-end). maybe try a simple hangman game, with the list of possible words (ie a dictionary) stored in a file that the program reads from.

after you have the basics down and are comfortable with file i/o, data structures (linked lists, queues, stacks, arrays), you definitely could check out some projects, like the ones on sourceforge, and see if you can contribute to one thats interesting to you, or make your own of course! another good thing to learn (in java especially) would be GUI programming. again, you should work on it after you have a solid foundation of the basics of java.

remember, when your learning the language, some programs/exercises on the tutorials you will see may seem trivial or useless, but do them, because the goal is to practice and learn the language, not to write Halo 4. and remember that when you want to try starting your own project. think of something that you do on your own computer that you wish you didnt have to do, or knew there was a better/faster/more customizable way of doing it and make a program to do it.

Last edited by nadroj; 12-09-2007 at 07:57 PM.
 
Old 12-10-2007, 05:41 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,314

Rep: Reputation: 175Reputation: 175
just keep plugging away.
it's like growing a nice garden. work multiplied by time.
one day you look round and think, "hey it's not bad"

and the good thing is you never stop learning new, interesting stuff.
 
Old 12-10-2007, 12:19 PM   #6
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
I've written a pretty big record keeping application in Java, and I'm working on re-writing it in Python. However I'm writing that application more out of necessity than simply wanting to learn the language.

Can you recommend a good C API? I've gone through the entire AP comp sci course, and I understand Linked List, Array List etc, but I don't know how to convert what I learned in Java to C. For example, as you probably know, for every node in a Java LinkedList you must have an Object pointer pointing to whatever data you're dealing with. Well, as far as I know there is no equivalent to the Object class in C. That confuses me.

I try to take the programming examples/exercises seriously, especially since I learn by re-writing excerpts of the coding examples into my own code.
 
Old 12-10-2007, 01:22 PM   #7
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
well its really good that you seem serious about learning it, and your still in high school. keep that attitude and work ethic up and im sure youll do well.

in java, they use the term 'references' rather than pointers, which is the term used in C. your correct in that C does not have classes, but C++ does, as its an object-oriented programming language and C isnt. in C you could use a struct to represent your node, with 'node*'s to represent links to the other nodes for your linked list, queue, stack, etc.

often times, in good books, they use pseudocode to show the algorithms, data structures, etc. the key of programming is understanding the algorithm, not the actual programming statements. wikipedia as you know is a great resource, and for most algorithms you look up they will give the pseudocode and sometimes language-specific implementations.
 
Old 12-10-2007, 01:25 PM   #8
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,590

Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by worldgnat View Post
Well, as far as I know there is no equivalent to the Object class in C. That confuses me.

C++ is the object oriented version of C.

-----------------
Steve Stites
 
Old 12-10-2007, 02:12 PM   #9
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by jailbait View Post
C++ is the object oriented version of C.
worldgnat means Java's class called Object, which every other class (including user created ones) inherits from. There is indeed no such class in C/C++.

Last edited by Nylex; 12-10-2007 at 02:14 PM.
 
Old 12-10-2007, 02:42 PM   #10
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
There is in Objective-C tho. However, there is a lack of really any other libraries besides the base Object in Linux, discounting GNUstep and its kind.

Last edited by SciYro; 12-10-2007 at 02:44 PM.
 
Old 12-10-2007, 05:39 PM   #11
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
You said "in good books" - what do you consider a good book? I have a "Learn C in 21 days" book, which I know is just an intro, but I thought it might have something detailed (after all it is 21 days as opposed to 24 hours). Unfortunately all it has is basic C syntax (what about that takes 21 days I don't know). Can you recommend any books that would at least get me started for a university programming course?
 
Old 12-10-2007, 06:24 PM   #12
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,590

Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by worldgnat View Post
You said "in good books" - what do you consider a good book? I have a "Learn C in 21 days" book, which I know is just an intro, but I thought it might have something detailed (after all it is 21 days as opposed to 24 hours). Unfortunately all it has is basic C syntax (what about that takes 21 days I don't know). Can you recommend any books that would at least get me started for a university programming course?
There are two types of programming courses. The first is a programming course set up to teach programming to a complete novice. This type of course covers a wide range of subjects well beyond just language syntax. Most of what is taught is also applicable to programming languages other than the one taught in the course. The Java course that you are taking is probably of this type.

The second type of programming course is set up to teach a new language to somebody who already knows how to program. The only essential topics in this type of course is program structure and program syntax. I think that your "Learn C in 21 days" course is of this type. I vaguely remember checking a book out of the library 5 or 6 years ago called "Learn HTML in 21 days". I read the book in a day or 2 and started creating web pages. However novice programmers would not have been able to understand the book because they would be missing a world of concepts that the "Learn HTML in 21 days" book assumed the reader understood.

I think that you need to find a beginning programming book that happens to use C as the example language. Work your way through all of the examples by using the gcc compiler on Linux. Learn to use make files and how to neatly file your source code by version number and so forth. You need to learn how to create modular logic, how to cover every logically possible case, variable formats and conversions, etc., etc., etc. You need an introductory course to take you through these concepts one by one and explain them to you in terms of C syntax and program structure.

-------------------
Steve Stites
 
Old 12-11-2007, 04:17 AM   #13
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,314

Rep: Reputation: 175Reputation: 175
my 3 choices for programming books:

the C programming language - kernighan & ritchie (THE bible)
advanced programming in the unix environment - richard stevens et al. (expensive)
the art of unix programming - eric raymond (good style book)

the third is free here...

http://www.faqs.org/docs/artu/

Last edited by bigearsbilly; 12-11-2007 at 04:19 AM.
 
Old 12-11-2007, 10:44 AM   #14
worldgnat
Member
 
Registered: Oct 2004
Posts: 337

Original Poster
Rep: Reputation: 30
Actually, the course I took was supposedly a "University level" course, but it wasn't nearly as in depth as it needed to be. My work with the aforementioned application allowed me to skip my school's introductory course. I understand the basics of programming, my issue is that that's all I know at the moment. Basic programming comes easily to me, and from a tutorial I can learn to write programs pretty well, but I'm having trouble with the in depth stuff.

Even though the course was an Advanced Placement course, it was not the same kind of university course you have been talking about. We learned how to make our own Linked Lists, how to use "Big - O" notation to some extent, and how to memorize Java classes. The problem is that this class was sort of like teaching a person how to use a Windows machine, and telling them they know how to use a computer. Then you give them a Linux machine and they're totally confused.

I think maybe I didn't describe my knowledge as well as I should have, but knowing Java doesn't seem like a very huge accomplishment when I see the guys working at OpenMoko who port an application to the Neo1793 platform because they have a few extra minutes and they think it'll look cool. Practically, all Java seems useful for is data processing, which is the problem I ran into with my application. I need to be able to access devices through the serial port, and that's not possible with Java unless your using Windows. This is why I had to switch to Python and, subsequently, why my skills in Java are starting to feel inadequate.

I'll see if I can find some of those books.
 
Old 12-11-2007, 12:39 PM   #15
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
Quote:
Originally Posted by worldgnat View Post
The problem is that this class was sort of like teaching a person how to use a Windows machine, and telling them they know how to use a computer. Then you give them a Linux machine and they're totally confused.
what you want is not a programming course then, but an algorithms & data structures course. learn the methods of programming, not the tools.
Quote:
Originally Posted by worldgnat View Post
Practically, all Java seems useful for is data processing, which is the problem I ran into with my application. I need to be able to access devices through the serial port, and that's not possible with Java unless your using Windows.
every programming language has its ups and downs, but i think java has much more to it than data processing. also, java cant access the serial port on any non-windows machine? i would doubt that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hi i am just learning dustinmarie LinuxQuestions.org Member Intro 1 01-18-2006 08:16 PM
About learning C dludenar Fedora 3 10-04-2005 10:27 AM
Learning C/C++ Debian-Gnu-B Linux - Software 12 01-28-2004 04:20 PM
Learning as I go. Curious LinuxQuestions.org Member Intro 1 09-25-2003 01:07 AM
learning how much mb? nakkaya Linux - General 4 02-27-2003 11:04 AM


All times are GMT -5. The time now is 08:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration