View Full Version : Programming/C++ help
krypto_wizard
January 11th, 2006, 12:41 AM
Hello Ubuntu Lovers,
I am new to the world of linux but I am loving it. I also love programming. I know basic C++. I can frame login and write simple programs fairly easily.
I dont have experience writing big programs or even libraries.
I always wonder what does it take to reach that coding level. I am still in inphancy. Can please somebody guide me how to become a good coder from an avg coder ? How to proceed to build big programs . What does it take to write libraries.
My dream job is to someday write/contribute to the development of Ubuntu. I am 19 right now but want to mature fast.
Ubuntians, I need your help. Thanks.
healychan
January 11th, 2006, 01:05 AM
My dream job is to someday write/contribute to the development of Ubuntu. I am 19 right now but want to mature fast.
You need to learn C if you want to contribute to Linux.
Read the book "The C programming language". This book is written by the founder of C, Dennus M.Ritchie. It is a well known C book. Best ever!!
healychan
January 11th, 2006, 01:08 AM
Sorry about that but I erase my post already
LordHunter317
January 11th, 2006, 01:09 AM
You need to learn C if you want to contribute to Linux.No, you don't. Such statements are simply ludicrous.
If you want to learn how to become a better programmer in general, read Structure and Interpretation of Computer Programs available for free online. It'll teach you the basis of computer science.
If you want to learn how to become a better C++ programmer, then read Effective C++, More Effective C++, and Effective STL all by Scott Myers. These will be good books to keep around later.
LordHunter317
January 11th, 2006, 01:13 AM
I still have the copy in my box. But I cannot upload to the forum because it is too big.
I also have some reference books for C. Also in PDF format.
Please give me your e-mail if you want a copy.Reported for attempted piracy. The book is copyrighted.
healychan
January 11th, 2006, 01:32 AM
Reported for attempted piracy. The book is copyrighted.
Oh.....really. But why it is free to download?? My tutor also encourage me and my classmate to download it.
LordHunter317
January 11th, 2006, 01:38 AM
The C Programming Language (http://cm.bell-labs.com/cm/cs/cbook/) by Brian W. Kernighan and Dennis M. Ritchie is very much a copyrighted work, and as the offical page shows, only availabe in hardcopy form. IF you found it online anywhere, it's a pirated copy. 30 seconds of Google can confirm this.
healychan
January 11th, 2006, 01:58 AM
The C Programming Language (http://cm.bell-labs.com/cm/cs/cbook/) by Brian W. Kernighan and Dennis M. Ritchie is very much a copyrighted work, and as the offical page shows, only availabe in hardcopy form. IF you found it online anywhere, it's a pirated copy. 30 seconds of Google can confirm this.
Surely you are right, the book is copyrighted. I regret what I have done:( .
But I really don't understand why my tutor allows this happen. He should knows the copyright issues. I am going to ask him and see what he says.
healychan
January 11th, 2006, 02:13 AM
No, you don't. Such statements are simply ludicrous.
When I said read the C book to be a programmer, surely things won't be that simple. Well I mean, how can people start programming without knowing the syntax??? And C indeed is a programming language still widely use. Once you master C, any other language become simple. That's why I suggest him to learn C.
You may not agree with me but so do I.:rolleyes:
LordHunter317
January 11th, 2006, 02:16 AM
When I said read the C book to be a programmer, surely things won't be that simple.That's not what you said though. That's not what I was responding to. You said, "You have to know C to program in Linux," which is purely nonsense.
If you want to learn C, your book recommendation is fine. This issue is why you suggested he should learn it; it's not a reason at all.
Once you master C, any other language become simple. That's why I suggest him to learn C.No, it doesn't. C is lacking in concepts found in most other languages, and won't even really prepare you syntatically for other langauges (and understanding syntax is a tiny part of what a programming must be capable of).
Jengu
January 11th, 2006, 02:27 AM
Once you master C, any other language become simple.
That's a myth. Learn C. You think other languages will be easy. Now try Python and it'll turn your world upside down. Then take a look at Lisp, seems really strange. Jump to Java to try a pure OOP language. Totally screw your brain learning Haskell.
Usually, if the language is worth learning, it's significantly different from the other languages out there, but prior experience can help.
The best thing you can do is:
Read and write code.
I always recommend Python as a starter language. Besides being easier to learn for a new programmer than C, it also has all sorts of libraries available that can let you do cool stuff that you can see right away. To make anything significant in C you have to already have a fairly good grasp of the language, even to use libraries. It also has an interpreter so you can type stuff in and see what it does right away without having to write miniprograms to test stuff and print the results for you.
This is a pretty good doc:
http://www.catb.org/~esr/faqs/hacker-howto.html
krypto_wizard
January 11th, 2006, 02:30 AM
What programming language is good. I want to write a simulator for p2p programs, which would simulate bittorrent files exchange. Thats a daunting task for me as of now but I want to accomplish it.
Please help
That's not what you said though. That's not what I was responding to. You said, "You have to know C to program in Linux," which is purely nonsense.
If you want to learn C, your book recommendation is fine. This issue is why you suggested he should learn it; it's not a reason at all.
No, it doesn't. C is lacking in concepts found in most other languages, and won't even really prepare you syntatically for other langauges (and understanding syntax is a tiny part of what a programming must be capable of).
healychan
January 11th, 2006, 02:43 AM
TYou said, "You have to know C to program in Linux," which is purely nonsense.
This is what I found on wikipedia
The C programming language is a standardized imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications..........
By 1973, the C language had become powerful enough that most of the Unix kernel, originally written in PDP-11/20 assembly language, was rewritten in C..............
And this is from www.gnu.org
Any Unix-like operating system needs a C library: the library which defines the ``system calls'' and other basic facilities such as open, malloc, printf, exit...
The GNU C library is used as the C library in the GNU system and most systems with the Linux kernel.
I believe it proves that C is important to Linux. I didn't mean C is all, but surely it will help.
C is lacking in concepts found in most other languages
As far as I know, at least C++, Java and Perl share similar syntax with C.
LordHunter317
January 11th, 2006, 02:54 AM
This is what I found on wikipediaNon-sequitur by irrelevance. VMS is written in a combination of VAX macro and a language called BLISS, but I don't know either and it didn't hinder me from coding there.
Origin of a platform and the original languages used to develop on it have nothing to do with it's development now.
And this is from www.gnu.orgActually, one doens't have a C-library to do that. Any language where you can directly write machien code would do; C is just a common choice because it's easy to do such activities and easy to interface to other languages.
And it's the last part that's important: because it's trivial to interface to other languages, it's easy to never have to know C to be a productive programmer.
The only thing in Linux you have to know C for is kernel programming, because the kernel doesn't support anything else and likely never will (ignoring machine-language).
I believe it proves that C is important to Linux.That's not what you said originally, and for lots of things today, it's irrelevant to many programmers.
I didn't mean C is all, but surely it will help.Not especially. Language simply isn't a big deal these days; nearly all languages provide you with what you need for most tasks.
healychan
January 11th, 2006, 02:54 AM
That's a myth. Learn C. You think other languages will be easy. Now try Python and it'll turn your world upside down. Then take a look at Lisp, seems really strange..........
I always recommend Python as a starter language.
This may be true. But the reason that Python is so different from C is Python is more like a script language. I know that at least C++, Java and Perl share similar syntax with C. And my experience told me that I found it easier to learn PHP, shell script, Perl, Java, even Javascript after I learn C.
My starting language is C++, my experience may be so different from you. And that also explain why I fancy the C family more than others;)
LordHunter317
January 11th, 2006, 02:55 AM
As far as I know, at least C++, Java and Perl share similar syntax with C.And as I already said, syntax is irrelevant. I'm talking about concepts like: Meaningful object-oriented programming Functional constructs Real references Real type safety Dynamic Binding Polymorphism Real Macro languageThe list goes on and on.
LordHunter317
January 11th, 2006, 02:56 AM
This may be true. But the reason that Python is so different from C is Python is more like a script language.No, that has nothing to do with anything. It's a strawman.
Javascript looks awfully like C, and it's a scripting language, so clearly being principally scripted vs. compiled doesn't mean a thing.
And my experience told me that I found it easier to learn PHP, shell script, Perl, Java, even Javascript after I learn C.I doubt it. If your chief concern is syntax, then you've missed the point of being a programmer.
healychan
January 11th, 2006, 03:04 AM
The only thing in Linux you have to know C for is kernel programming, because the kernel doesn't support anything else and likely never will (ignoring machine-language).
Kernel is the core bit, the heart of Linux. Isn't it ??
To : LordHunter317
Talking with you feel so good and I learn many new stuff.;)
Thanks for your advice
LordHunter317
January 11th, 2006, 03:05 AM
Kernel is the core bit, the heart of Linux. Isn't it ??Yes, but the number of programmers who have the ability or the need to do kernel-level programming is small, so it's worthless to acquire C soley because of this.
thumper
January 11th, 2006, 04:38 AM
Sometimes I think it is useful to get extra opinions. This thread got quite long quite quickly...
krypto_wizard - what to learn depends on what you want to help with.
If you want to do kernel hacking or assist with existing gnome apps, learn C.
If you want to help with existing KDE apps, learn C++.
Writing new apps you have almost a free choice as most languages provide bindings for QT(KDE) and GTK(gnome).
Console style apps and you are equally free - if not more so - to choose your implementation language.
I also suggest python to new people. I'd love to get more people learning C++, but it is considered "hard" by many.
krypto_wizard
January 11th, 2006, 11:11 AM
I have a good understanding of C, pointer, structures, classes. The intricate things in C++ like Polymorphism, OVerloading is something I am really not good at. I was thiking that you can always get away without using these concepts. Is this the case ??? I mean I safely ignores using inheritance, virtual functions because I thought thats confusing me and I can get away without using that. May be Since I am coding at the primitve level I might not be needing them.
Any comments are appreciated. I would love to master c++. The fact that I know lot of concepts in C++ already and have programmed decent in C....can somebody suggest some real good book for C++ where I can grasp those difficult concepts and start using them.
I want to write a simulator for my class project which is to simulate bittorrent filesharing system. Some people advised Ruby, Python. But I guess there will be some learning curve in that.
All your help is appreciated.
Thanks
LordHunter317
January 11th, 2006, 11:29 AM
I have a good understanding of C, pointer, structures, classes.Then you understand C, not C++. You should read Accelerated C++ by Koenig, et al. It's a very good tutorial on the C++ language and is used as an academic text by many institutions.
The intricate things in C++ like Polymorphism, OVerloading is something I am really not good at. I was thiking that you can always get away without using these concepts. Is this the case ???You can, but you're effectively just writing C. And, abstractions without these sorts of things are much harder to write. They were introduced for a reason.
I want to write a simulator for my class project which is to simulate bittorrent filesharing system.What kind of simulator? I'm confused as what there is to simulate here that can't be done in probably better ways.
krypto_wizard
January 11th, 2006, 11:34 AM
I have taken a networks course in which I have to show a demo how bittorrent swarming is good distributed computing concept. The simulator is a discrete even simulator and would mimic a real world tracker and peers and exchange of file parts among themselves. Since I have to now use an object oriented progrmaming because its gonna be a big project ...I am making efforts to get started. Any tips are more than welcome. I will try to grab the book by Koeing et al.
Thanks
Then you understand C, not C++. You should read Accelerated C++ by Koenig, et al. It's a very good tutorial on the C++ language and is used as an academic text by many institutions.
You can, but you're effectively just writing C. And, abstractions without these sorts of things are much harder to write. They were introduced for a reason.
What kind of simulator? I'm confused as what there is to simulate here that can't be done in probably better ways.
Thirsteh
January 11th, 2006, 11:35 AM
C is fine for small, practical things. When your project reaches about 50,000 lines however, you're gonna start regretting you didn't utilize inheritance, polymorphism, and the like, C++ basically.
LordHunter317
January 11th, 2006, 11:37 AM
C is fine for small, practical things. When your project reaches about 50,000 lines however, you're gonna start regretting you didn't utilize inheritance, polymorphism, and the like, C++ basically.You should tell the developers of every major OS kernel on the planet that one.
enderv
January 11th, 2006, 11:44 AM
C is fine for small, practical things.
Do you imply that C++ is good for large, impractical things? ;)
You can write small, practical (and quick) things in C++ too - but these days I tend to write them in Python (and/or Ruby).
The write/compile/debug cycle is just so much faster...
I like Java, because I think it has one of the best/most productive GUIs so far (IntelliJ's IDEA - I got people swearing by emacs to switch to it :) ).
I like Python, because writing elegant programs in it is easy.
I dislike C++ (even though I have to use it now and then), for a number of reason - in general way too much rope to hang yourself on if you're not too careful.
V.
Thirsteh
January 11th, 2006, 11:54 AM
Do you imply that C++ is good for large, impractical things? ;)
You can write small, practical (and quick) things in C++ too - but these days I tend to write them in Python (and/or Ruby).
The write/compile/debug cycle is just so much faster...
I like Java, because I think it has one of the best/most productive GUIs so far (IntelliJ's IDEA - I got people swearing by emacs to switch to it :) ).
I like Python, because writing elegant programs in it is easy.
I dislike C++ (even though I have to use it now and then), for a number of reason - in general way too much rope to hang yourself on if you're not too careful.
V.
Sorry for not being bulletproof there. Let me rephrase:
C is sufficient for small programs.
I am not suggesting C++ is good or bad at anything else, just saying that utilizing features of C++ is usually harder for a newcomer than C, so if they're going to write a small app anyway, C will suffice.
Thirsteh
January 11th, 2006, 11:55 AM
You should tell the developers of every major OS kernel on the planet that one.
I don't see the fun in this one? Or was it not a joke? :rolleyes:
LordHunter317
January 11th, 2006, 12:01 PM
It wasn't a joke. C is used for huge projects, and for something like a kernel, it's simplicity is an actual advantage, not a disadvantage.
This is the problem with generalizations: I can think of lots of projects and situations where a "simple" lanaguage is a good thing, even if the code is very large.
thumper
January 11th, 2006, 12:18 PM
Then you understand C, not C++. You should read Accelerated C++ by Koenig, et al. It's a very good tutorial on the C++ language and is used as an academic text by many institutions.
Seconded.
I recommend this book as the book to learn C++ from.
krypto_wizard
January 11th, 2006, 01:01 PM
Whats the learning curve for Ruby or python if you know C well ?
Seconded.
I recommend this book as the book to learn C++ from.
krypto_wizard
January 11th, 2006, 03:30 PM
is g++ a good compiler. I generally get lot of errors while they run just fine in turboC++. Any suggestions ?
thumper
January 11th, 2006, 07:07 PM
g++ is a very good compiler. You are probably getting a lot of errors as g++ is more standards conformant - which means you should end up writing more portable code.
Python is pretty quick to pick up if you already have an understanding of programming. I do find that I write a lot of classes in python, but that is probably more my background. You can write python without understanding OO but it was designed to be an object oriented language.
I have only looked briefly at ruby and got put off by the warts. Admittingly when I first looked at python I got put off by the "whitespace matters" - which just seems strange for a C++ person.
Have a go at python and I don't think you will be disappointed.
revdev
January 12th, 2006, 02:29 AM
When I decided that I wanted to make the switch from PHP and writing web applications to ... you know... REAL programming, I didn't want to try C++, because I had tried to learn it before and was completely overwhelmed with how difficult it was (granted I was only 12.... my dad's a programmer so he tried to raise me into one). My father recommended Java.
I've since started learning it, and I find it fairly simple. The only difficult thing is wrapping your head around some of the OO concepts like inheritance, polymorphism, etc. However, Head First Java (http://www.amazon.com/gp/product/0596009208/qid=1137046410/sr=8-1/ref=pd_bbs_1/104-1926855-6982355?n=507846&s=books&v=glance) really makes it a lot simpler, even though it's kind of similar to a "For Dummies..." book (lots of graphics and sidebar content, etc.).
Also, you don't have to change any code to make it cross-platform.*
*- I am a Beginner/Intermediate though, so don't flame me if there are features that do require os-specific code, and I know that there are other languages that are the same way. Don't waste your time pointing out my errors.
krypto_wizard
January 12th, 2006, 01:19 PM
I have started off with python..lets see how it goes. I have to practice more for writnig the code. Do you have large community that is using python. Also, is there a good library support for it.
Thanks
g++ is a very good compiler. You are probably getting a lot of errors as g++ is more standards conformant - which means you should end up writing more portable code.
Python is pretty quick to pick up if you already have an understanding of programming. I do find that I write a lot of classes in python, but that is probably more my background. You can write python without understanding OO but it was designed to be an object oriented language.
I have only looked briefly at ruby and got put off by the warts. Admittingly when I first looked at python I got put off by the "whitespace matters" - which just seems strange for a C++ person.
Have a go at python and I don't think you will be disappointed.
rolfotto
January 12th, 2006, 08:49 PM
Here is some advice from Eric S. Raymond:
http://www.catb.org/~esr/faqs/hacker-howto.html
And Paul Graham has some interesting articles to read, on a variety of subjects:
http://www.paulgraham.com/articles.html
Both of them (and I) recommend learning several languages. ESR has his list of five languages including Lisp, and Paul Graham considers that there are two 'pure' philosophies of programming: C and Lisp. With the other languages falling in the middle, usually starting near C and moving toward Lisp.
So I suggest to you, since you know C already, is to learn lisp. Here is a good book:
http://www.cs.cmu.edu/~dst/LispBook/index.html
And here is a good reference sheet beyond that first book, Practical Common Lisp being a good second book:
http://www.franz.com/newtolisp/
Then learn some other languages like ESR recommends. Or go on and write programs that push the edge. Learning languages isn't just for the language's sake, but some people get stuck in a paradigm of one language, and tend to limit their thinking to that. C and Lisp are good opposites. But there will be others - Haskell, etcetera.
And remember, Lisp also has a good Object-oriented system in CLOS if you want to learn about OO. But then, remember OO isn't all that. There are other models out there.
Hello Ubuntu Lovers,
I am new to the world of linux but I am loving it. I also love programming. I know basic C++. I can frame login and write simple programs fairly easily.
I dont have experience writing big programs or even libraries.
I always wonder what does it take to reach that coding level. I am still in inphancy. Can please somebody guide me how to become a good coder from an avg coder ? How to proceed to build big programs . What does it take to write libraries.
My dream job is to someday write/contribute to the development of Ubuntu. I am 19 right now but want to mature fast.
Ubuntians, I need your help. Thanks.
krypto_wizard
January 14th, 2006, 12:15 AM
Couple of them indeed were really good articles.
I have started off with Python and lets see how I make progress. I want to learn some robust programming language and stick to it. I have had association with C and a very little with Java and C++. Many people have suggested that Python is one the better programming languages around and very easy to use and learning curve is not much if you have progrmmed before in some other language.
Guys, If you can give any tips for python that will be greatly appreciated.
Thanks
Here is some advice from Eric S. Raymond:
http://www.catb.org/~esr/faqs/hacker-howto.html
And Paul Graham has some interesting articles to read, on a variety of subjects:
http://www.paulgraham.com/articles.html
Both of them (and I) recommend learning several languages. ESR has his list of five languages including Lisp, and Paul Graham considers that there are two 'pure' philosophies of programming: C and Lisp. With the other languages falling in the middle, usually starting near C and moving toward Lisp.
So I suggest to you, since you know C already, is to learn lisp. Here is a good book:
http://www.cs.cmu.edu/~dst/LispBook/index.html
And here is a good reference sheet beyond that first book, Practical Common Lisp being a good second book:
http://www.franz.com/newtolisp/
Then learn some other languages like ESR recommends. Or go on and write programs that push the edge. Learning languages isn't just for the language's sake, but some people get stuck in a paradigm of one language, and tend to limit their thinking to that. C and Lisp are good opposites. But there will be others - Haskell, etcetera.
And remember, Lisp also has a good Object-oriented system in CLOS if you want to learn about OO. But then, remember OO isn't all that. There are other models out there.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.