LinuxQuestions.org
Visit Jeremy's Blog.
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 09-13-2009, 07:25 PM   #1
kcaz
LQ Newbie
 
Registered: Aug 2009
Posts: 18

Rep: Reputation: 0
What is C++ good for?


So I've been programming for a while now, and I want a change of course.

I was looking into a few things, Linux programming being one of them. I was doing a bit of game programming, but I didn't like that very much, I want to make a difference. I know a whole bunch of languages, but I want to try something new.

I know C++ is a very powerful language, but I don't know what to do with it. When I first learned it, I derived to Objective-C to tried and make an iPhone game (which worked great).

So what else can it be used for besides games? I know Linux is written in it. Any suggestions on where to start besides games?

Thanks for reading this,
~Kcaz
 
Old 09-13-2009, 09:01 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Programming should be the tool, not the inspiration. If you can't think of anything that needs programming, go outside and get some exercise! Life is too short to spend more time on a computer than you need to.
Kevin Barry
 
Old 09-13-2009, 10:16 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,130

Rep: Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454Reputation: 6454
Quote:
Originally Posted by kcaz View Post
So I've been programming for a while now, and I want a change of course.

I was looking into a few things, Linux programming being one of them. I was doing a bit of game programming, but I didn't like that very much, I want to make a difference. I know a whole bunch of languages, but I want to try something new.

I know C++ is a very powerful language, but I don't know what to do with it. When I first learned it, I derived to Objective-C to tried and make an iPhone game (which worked great).

So what else can it be used for besides games? I know Linux is written in it. Any suggestions on where to start besides games?

Thanks for reading this,
~Kcaz

You've already said operating systems and games. Most desktop environments are built in it, along with good parts of Windows, most databases, and probably a gazillion tools that I've never even heard of.

You can write ANYTHING with it, just like you can write any kind of program with just about any kind of language. If you want to learn it, go for it...never hurts to learn more and pick up new skills. It will change the way you program, knowing different methods, best practices, etc., and probably improve whatever you write.

But, you do sound like a student. The best advice I can give, is to view the computer (and languages), as tools, nothing more. Pick the one that is best suited to solve whatever problem you have, and use it well.
 
Old 09-14-2009, 02:29 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
First a clarification: Linux is written in C not C++.

But with C++ you can do virtually anything but as has already been stated it is better to have a problem and then find the best language to solve it. Even if you just want to learn C++ it's best to have a project in mind.
 
Old 09-14-2009, 08:30 AM   #5
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Quote:
Originally Posted by graemef View Post
with C++ you can do virtually anything
I wanted to add something to that statement. But it doesn't need it.

Quote:
but as has already been stated it is better to have a problem and then find the best language to solve it.
Sort of like an author saying he would select one language if he were writing poetry, but a different language if he were writing a mystery novel. That is possible, but it isn't common nor particularly effective.

Many programming languages are over specialized. There are problems they are good at (half the solution may be already built in) and a much wider range of problems they are very bad at.

I think a good programmer will ultimately be more effective using C++ for almost everything than using whatever language happens to half solve the problem before you start for the limited range of problems that have some specialized language. (A less skilled programmer working on a narrower range of problems might have a more legitimate need for a narrower language).

If you want to learn C++, there is no reason to reject projects that happen to have narrow languages that would make them easier. Most things a beginning C++ programmer could do in C++ could be done at least as easily in some other language. You need to be an advanced programmer before you work on projects where C++ is the only appropriate language. As a beginner, you should work on projects where C++ is just appropriate, not even most appropriate.

Quote:
Even if you just want to learn C++ it's best to have a project in mind.
If the point is learning C++, then the point is learning C++, the project isn't the point.

Depending on your level of imagination or motivation, you might think of a project or you might look for and use some tutorials. If your level of motivation is high and imagination/knowledge is the limiting factor (as the first post seems to imply) then find an interesting open source project:

If it were me, I'd pick some C++ open source tool I actually use and which I think is lacking some feature I care about. Then I'd get the source code and try to figure out where/how the related features are implemented, then add the feature I want.

You'll need a little research to find out which of the open source tools you use are written in C++. You'll find several (such as Linux itself and GCC) for which C++ is the only language that fits the internal architecture of the project, but the code was done in C anyway for historical reasons and/or by C fanatics who love to demonstrate how C can be stretched to do all the things that ought to need C++ (yes it can, but doing so creates a major impediment to ongoing maintenance and enhancement of the project vs. using C++).

Last edited by johnsfine; 09-14-2009 at 08:32 AM.
 
Old 09-14-2009, 09:55 AM   #6
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Quote:
I think a good programmer will ultimately be more effective using C++ for almost everything than using whatever language happens to half solve the problem before you start
I think that there are situations where a specialised language is significantly better than C++, possible the most notable example is web development, and there is a quite a bit of that going on these days.
Quote:
If the point is learning C++, then the point is learning C++, the project isn't the point.
Sure but the project can give the learning process some focus and as you suggested it can be adding something to an existing open source project.
 
Old 09-16-2009, 09:03 PM   #7
linuxraja
LQ Newbie
 
Registered: Sep 2009
Posts: 17

Rep: Reputation: 0
Quote:
Originally Posted by kcaz View Post
So I've been programming for a while now, and I want a change of course.

I was looking into a few things, Linux programming being one of them. I was doing a bit of game programming, but I didn't like that very much, I want to make a difference. I know a whole bunch of languages, but I want to try something new.

I know C++ is a very powerful language, but I don't know what to do with it. When I first learned it, I derived to Objective-C to tried and make an iPhone game (which worked great).

So what else can it be used for besides games? I know Linux is written in it. Any suggestions on where to start besides games?

Thanks for reading this,
~Kcaz

Programming is the tool ... Inspiration and ideas are only limited by the sky and your creativity !!!

Go get em tiger ...


// removed spam link

Last edited by crabboy; 11-01-2010 at 08:17 AM.
 
Old 09-18-2009, 03:47 PM   #8
cpp333
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
find an open source c++ project that you like ... start here

http://freshmeat.net/tags/c-2?page=1...91&without=172
 
Old 09-19-2009, 05:04 AM   #9
cppmyths
LQ Newbie
 
Registered: Sep 2009
Posts: 13

Rep: Reputation: 1
This thread was brought to my attention a few days ago and it seems that this myth is infectious, so I give you a reply I made about it.
Quote:
If it were me, I'd pick some C++ open source tool I actually use and which I think is lacking some feature I care about. Then I'd get the source code and try to figure out where/how the related features are implemented, then add the feature I want.
Quote:
Sure but the project can give the learning process some focus and as you suggested it can be adding something to an existing open source project.
Quote:
find an open source c++ project that you like ... start here
This is a myth or as I like to say How not to learn C++.
 
Old 09-19-2009, 07:14 AM   #10
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Quote:
Originally Posted by cppmyths View Post
This thread was brought to my attention a few days ago and it seems that this myth is infectious, so I give you a reply I made about it.
I see you selected a quote from me to disagree with on your page. I'm glad I made a clear statement of the viewpoint you don't like.

Long ago, I learned C starting by making small enhancements to large badly designed projects. It wasn't a choice. Personal computers hadn't been invented yet and the only way for a student to get computer time on a system with a C compiler was to work on an existing project. Even though it wasn't a choice, it worked well as a way to learn C.

I did have the advantage of already being an experienced programmer in many other programming languages, including assembly. I also had the advantage of being motivated and being naturally good at programming. Jumping in at the deep end isn't for everyone.

Much later, I learned C++ and later Java as a professional programmer joining large badly structured projects and making corrections and enhancements. That worked quite well as a way to learn C++ and Java.

Few people get the opportunity to learn C++ or Java that way. Employers usually focus too much on relevant experience and too little on real talent and broad experience. The employer who decided to hire me for a senior C++ programming position when I had no previous experience, knew me and knew lack of "relevant" experience wouldn't matter and made a big exception to their usual hiring policy (and was very happy with the results).

Let me comment on one of your objections to jumping into an open source project:
Quote:
Some use poor programming practices, such that they are like a tangled web.
1) You're too generous. It is most, not some.
2) Most professional programmers spend a lot of time digging into existing projects, full of poor programming practices, in order to make corrections or enhancements. Better programmers often spend an even larger fraction of their timing fixing things others have done badly (it has to be fixed an no one else has the skill).

Interesting projects take multiple people and many of them do shoddy work. If you don't want to be exposed to other people's shoddy work, you're unlikely to be involved in any interesting projects.

If an open source project is such a tangled mess that you can't even find where the interesting things happen (many are) then you picked one that is too hard for a beginner to jump into. Pick a different one. Beyond that, I wouldn't worry about the learning process being contaminated by looking at examples of bad practice. Real programming also involves dealing with lots of examples of bad practice.

Personally, I hate books as a method of learning programming. I'll quote you again:
Quote:
Disclaimer there are some really bad books.
I haven't read enough of them to be sure, but in my limited experience almost all the books are really bad. The kind of person who knows how to write a book and get it published tends not to be the kind of person who knows how to do software engineering.

As an expert, I can skim through a book in the store and accurately judge that it is crap and would do more harm than good to a beginner trying to learn from it. The beginner can't make that judgment before lots of time and money has been wasted.

A functioning open source project implies a clear lower limit on the quality of the software engineering. If it were really really bad the program wouldn't work and no one after the original author would be able to find the places where corrections and enhancements should go. You can easily discover when an open source project is at least better than that.

A book has no lower limit. The ideas may be totally wrong with no possibility of making the jump from theory plus trivial examples up to real software engineering. Most of the books I have looked at are that flawed.

If you want a softer entry to learning C++, I suggest online tutorials rather than books:
1) A tutorial is a fundamentally better approach, because most of "computer science" is actually still a craft not a science. Without the hands on component, you can't learn.
2) Usually a different kind of person writes tutorials than writes books. There are bad tutorials as well, but the odds are much better that a tutorial author, rather than a book author, is one of those "people with real knowledge" you mentioned.

Last edited by johnsfine; 09-19-2009 at 07:16 AM.
 
Old 09-19-2009, 07:21 AM   #11
cppmyths
LQ Newbie
 
Registered: Sep 2009
Posts: 13

Rep: Reputation: 1
OK johnsfine would you care to show me a on-line tutorial and an open source C++ project which you think is suitable for a new comer?
 
Old 09-19-2009, 08:03 AM   #12
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
I'm not a beginner at programming and in many ways I never was. I wrote complicated programs the second day after I read the manual for Basic programming for the first computer (actually timesharing terminal) I ever got near. So judging certain kinds of "bad" in a book, tutorial or open source project may be very easy for me, while judging "good" may be impossible.

Quick analogy: Years ago, I taught several people how to windsurf. I was very good at teaching ordinary people how to windsurf, because I had such a hard time learning myself. If there was a mistake a beginner at windsurfing could make, I had made that mistake, struggled through it (under the instruction of a natural athlete who couldn't understand what was going wrong for me), and learned how to get past it. I easily recognized the same mistakes in my students and knew what to tell them to help them past such mistakes.

I've taught programming to many people and it only works well with natural programming geniuses. Otherwise, I can never guess what will be easy vs. what will be hard. So I repeat things they already understand because I can't tell they understand and I skip things they don't understand because I can't even imagine that someone might fail to understand such things.

I have tried several times (including with one of them now) to teach programming to my sons. It is quite difficult. They aren't comfortable learning from someone who is advanced as I am. They also can't learn from someone who is as terrible at programming as the high school and (for the older two) college computer science instructors they have had, and no one could learn from the books they have been assigned.

I can't get their attention with tutorials that are just C++ programming. It takes C++ programming plus 2D graphics good enough for simple games. It is a big jump from zero to even simple 2D games, so even though I've found and tried some good 2D gaming tutorials, I haven't yet had much teaching success.

All the time I've spent recently looking for and guessing at the quality of C++ tutorials has been focussed on simple 2D gaming. I could recheck some and post some URLs, but I think that isn't a great way for a motivated person to learn C++. I think it just is a way to maybe deal with lack of motivation.

A recent thread at LQ pointed me to
http://projecteuler.net/
I found that very helpful in teaching some C++ to a couple of my sons. The problems are interesting enough to get some attention from my sons (they are at least interested in math) and easy enough to program that it is not at all a leap from zero to doing them. That site is just the problems (not language specific and not a tutorial). A beginner would need to get "boilerplate" from somewhere else, then fill in the functional parts. We used the basic project setup from CodeBlocks to provide the "boilerplate".

I have been more distantly involved as more motivated co workers of mine and friends of my sons have learned C++ programming. They all learned by doing, not from books, certainly not from formal instruction, in some cases using tutorials (but at the moment I don't recall which).

If I come across some good C++ tutorials, I'll try to remember to put URLs back here. But I'm not motivated to do that search now. "Good" open source projects is too much of an individual thing. The motivation is too big a part. What open source tools do you care about? How hard are you willing to try? How naturally talented are you at software? I don't think any purpose is served by some expert researching a list of suggested projects.
 
Old 09-19-2009, 08:37 AM   #13
cppmyths
LQ Newbie
 
Registered: Sep 2009
Posts: 13

Rep: Reputation: 1
Thanks johnsfine for that finely crafted politicians reply
So if I may, I will read between the lines and summarise for other readers.
I do not know of any open source projects or on line tutorials which are good for new comers to the language, yet I just suggest them because other people do.

I must say that I laughed at your first paragraph in the reply
Quote:
I'm not a beginner at programming and in many ways I never was. I wrote complicated programs the second day after I read the manual for Basic programming for the first computer (actually timesharing terminal) I ever got near. So judging certain kinds of "bad" in a book, tutorial or open source project may be very easy for me, while judging "good" may be impossible.
I would say there are two instances of oxymorons there. Firstly that you were never a beginner and secondly that you know bad yet not good. How can you possibly judge bad without knowing what is good?
From your previous reply

Quote:
The kind of person who knows how to write a book and get it published tends not to be the kind of person who knows how to do software engineering.
Dear Sir would you mind qualifying this statement as you yourself state that you have not read enough to be able to judge books, which is something I also find hard to comprehend from a self professed "expert", something you may note I do not profess.

Quote:
I've taught programming to many people and it only works well with natural programming geniuses. Otherwise, I can never guess what will be easy vs. what will be hard.
Are you a teacher John? If so I feel I may have encountered your teaching style before and I was not impressed with it at that time either.

So I open the request to other readers.
Can anybody suggest a good Open Source project or on-line tutorial which they feel is good for new comers to the language?
Please do not be disheartened if you do not know of any, I have been personally looking for sometime to no avail.

Last edited by cppmyths; 09-19-2009 at 08:45 AM.
 
Old 09-19-2009, 10:39 AM   #14
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Quote:
Originally Posted by cppmyths View Post
I would say there are two instances of oxymorons there. Firstly that you were never a beginner
Some people are just naturally good at some things. I know a few natural athletes who learned to windsurf without ever being a beginner. They just got on a windsurf board for the first time and could already do it at what the rest of us call an intermediate level. I think I started programming that same way.

Quote:
secondly that you know bad yet not good. How can you possibly judge bad without knowing what is good?
That's easy. A "good" book presents useful correct information in a way a beginner would understand easily. Almost every C++ book I have looked at presents useless and/or incorrect information and/or presents it so badly you can't understand it even if you already know the material. So if I came across of book that presents correct info in a form I understand, I can't guess whether a beginner would understand it. But most books can be identified as "bad" without reaching that question.

Quote:
you yourself state that you have not read enough to be able to judge books
I must have been unclear. I haven't read enough to be confident of estimates about the entire pool of available books. I have certainly read enough to know a really bad book when I see it and sampled enough books to know that really bad books are at least very common.

Quote:
Are you a teacher John?
As I said, I'm a professional programmer. As the most expert programmer anywhere I have worked, I'm usually involved in a moderate amount of informal teaching to help co workers become more effective programmers. But I haven't done any formal classroom teaching of computer programming since I was in high school myself (when I was paid for classroom teaching of programming for a class of junior high school students and separately for a class of math and science teachers, and also paid for individual tutoring of graduate students).

Quote:
If so I feel I may have encountered your teaching style before
I doubt you can guess what my teaching style has been. I think I have used a few very different teaching styles and I know the styles I have found/used have worked well for those junior high and graduate students I taught long ago as well as for various friends and co workers I have taught informally, and worked badly for those math and science teachers, for teaching my mother, teaching my wife, teaching my sons, and various other co workers.

It doesn't seem to be a field that is often taught well. Those few (not including my sons) who learned programming well in the local school system very much learned programming on their own despite the instructor, rather than learning anything from the instructor. If anyone learns anything in the college programming class one of my sons is now attending, that will be even more clearly despite the efforts of the instructor.

Quote:
So I open the request to other readers.
Can anybody suggest a good Open Source project or on-line tutorial which they feel is good for new comers to the language?
Good request. Someone who actually learned from a tutorial is more qualified to judge it than an expert who just looked at the tutorial.

I learned some of the Java I know and most of the Python and occasionally other things from online tutorials, so I do have some basis for liking on-line tutorials in general.

Re Java, I worked on both professional and a freeware large Java project in which I made key enhancements into existing functioning programs, before I ever had a clue how you would set up a moderate size project from scratch. So I started using Java tutorials to learn how to start from scratch long after I already knew how to enhance existing code. The tutorials I found (off of some obvious link from java.sun.com) were perfect for me, but again I couldn't judge for an ordinary beginner.

I also did enhancements in a giant project in C++ long before I learned how to start from scratch. Since that was MFC (which BTW, I really hate) starting a real project from scratch is a very different skill than enhancing one, so it was quite a while before I picked that up. But I didn't happen to use a tutorial.

Most software engineers never learn how to do decent design of large projects. You aren't going to learn that from books (everything they say is wrong). You aren't going to learn it in a classroom from theorists who have no clue how the real world works. You also probably can't build up to it by doing your own good design of smaller projects. The way the few people who ever learn good large project design learn it is by enhancing existing badly designed large projects and gaining an understanding of why they are wrong and what could have been done instead. That certainly isn't sufficient to become a good large project designer, but it may be necessary.
 
Old 09-19-2009, 11:23 AM   #15
cppmyths
LQ Newbie
 
Registered: Sep 2009
Posts: 13

Rep: Reputation: 1
John I could dispel most of your post with facts about authors, language definitions et al and turn this into a tit for tat yet that would be unproductive and something which I will endeavour not to do; yet I do have to bring to note a point you made.

You did not comment on my summarisation of your previous post, which I can only take to mean you full heartedly agree and blindly submit this misguided advice to new comers but you did make the following comment:
Quote:
Good request. Someone who actually learned from a tutorial is more qualified to judge it than an expert who just looked at the tutorial.
I have to stronger disagree here. How can a novice decide if a tutorial is good? They can judge the style of teaching yet not on its content. An "expert" (personally I would say an experienced user) knows the language, the pitfalls, common mistakes and the damn falsehoods. I would put it you that the "expert" is the best judge of the content, after all it should be an "expert" who wrote the content.

Let me just reiterate my reasons for posting on this forum. It is to dispel the common misconception that Open Source projects are a good method for a new comer to the language to learn it. I would be more than happy to be shown to be incorrect, yet feel this will not happen.

Last edited by cppmyths; 09-19-2009 at 11:29 AM.
 
  


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
Good morning, god day, good afternoon, good night! wumpel LinuxQuestions.org Member Intro 3 10-07-2010 04:57 AM
LXer: IBM Sun acquisition : Good for Unix. Good for Linux. Bad for HP LXer Syndicated Linux News 0 03-18-2009 11:00 AM
A good live distro with a good hardware diagnostic & profiling program? studpenguin General 2 11-25-2008 03:37 AM
Ahat is a good desktop configuration for maximum compatibility and good performance? aerostarlegacy Linux - Hardware 0 12-12-2007 01:39 AM
Good morning, Good evening, Good night. Cheeseboy LinuxQuestions.org Member Intro 2 11-04-2004 09:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:21 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
Open Source Consulting | Domain Registration