LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2009, 08:05 AM   #1
JH9235
LQ Newbie
 
Registered: Apr 2009
Distribution: Ubuntu & Anubis
Posts: 1

Rep: Reputation: 0
1st programming language for a total begginner?


I am quite new to linux and want to learn proggramming, I do not know any windows proggramming either and want something easy to start of with, what can I use? I mainly want to write games

Last edited by JH9235; 06-21-2009 at 08:55 AM. Reason: Adding more detail
 
Old 06-21-2009, 08:15 AM   #2
bannock
LQ Newbie
 
Registered: Jun 2009
Location: Toronto
Distribution: Ubuntu, Fedora
Posts: 24

Rep: Reputation: 18
Python is modern and popular, and it encourages good programming style. I might start with that.
 
Old 06-21-2009, 08:26 AM   #3
fpmurphy
Member
 
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 299

Rep: Reputation: 62
Ruby would be a another good choice as it is a pure OO language.
 
Old 06-21-2009, 08:41 AM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
A lot depends on what you want to do with programming later.

I think the clear best language for major programming projects is C++. A well chosen subset of C++ could be a great first language for a beginning programmer. Unfortunately, I don't know of any tutorials or other materials for beginning programmers that use a well chosen subset of C++. A large or poorly chosen subset of C++ can make things very hard for a beginning programmer.

Without knowing more details of your needs, I would suggest learning Java first.

Java is easier to learn than C++ and I think the available tutorials are better. For many purposes, it is the best language by itself. But it might also be a good way to prepare to learn C++. It has a very similar syntax and conceptual structure to C++.

I have a very low opinion of Python. I think it encourages bad programming style. I know every significant project in Python that I have ever needed to enhance or correct has been unreadable badly structured garbage.

I think Java and C++ go a little too far in the direction of object encapsulation (making you centralize the definition of an object). But Python goes much too far in the opposite direction. That is often very convenient when you need to slap a program together in a hurry to get something simple done. It is a nightmare when you need to maintain code someone else wrote or grow that program you slapped together into something more complex.

You can write well structured maintainable code even in assembler, so someone certainly could do so in Python. I've just never seen it done.
 
Old 06-21-2009, 08:46 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by JH9235 View Post
I am quite new to linux and want to learn proggramming, I do not know any windows proggramming either and want something easy to start of with, what can I use?
Welcome to LQ!!

What kind of programming? e.g. do you want to write games? utility scripts? kernel programming?

I am not a programmer, so take some salt with this...I would learn C first, since it is the most restrictive and teaches some discipline. Then, as you learn "easier" languages such as Python, it will be-----easier. But it all depends on what you want to do.
 
Old 06-21-2009, 10:24 AM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
@JH9235: It's generally better to just reply to questions rather than editing your original post. Otherwise it makes it look like folks are asking about things you've already answered.

Anyway - games? I haven't tried it out, but I hear Lua is popular in that domain.
 
Old 06-21-2009, 02:10 PM   #7
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
If you want good performance for cpu intensive games, C++ is the best choice, but you probably need some more advice on the key inner loops.

C++ does nothing that stops you from writing code at least as efficient as C, but C++ does make it easier for a beginner to misunderstand the performance cost of various constructs and write code much less efficient than C without knowing why.

If the game is not CPU intensive, Java is much easier. There is better documentation for the portable graphics packages and you don't need to worry about memory leaks. In projects such as games and compilers, object lifetimes tend not to fit the basic flow of the code, so efficiently avoiding memory leaks can become a serious complication in C++ programming. Java takes care of all that for you (but in doing so, causes unpredictable stalls in cpu intensive games). Java also is significantly lower performance than well written C++. For non cpu intensive games, Java is just easier.
 
Old 06-21-2009, 02:29 PM   #8
noctilucent
Member
 
Registered: Jun 2009
Distribution: slackware
Posts: 123

Rep: Reputation: 34
My opinion is that before you worry about game programming and what language would be best fit for the job [if such a thing exists in the first place] you should focus on being able to write smaller programs with simpler functions. I believe "Hello, world!" in a compiled language would be a good place to start. My suggestion: C.
 
Old 06-21-2009, 02:33 PM   #9
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
Well, johnsfine, I guess our views on C++ and Java are somewhat perpendicular. I sincerely think that C++ is too big for anybody to understand/master completely and is, essentially, an incomprehensible monstrocity, trying to be everything at once. Different people writing in different subsets of it, have hard time understanding each other...
Java is little better. It's too restrinctive, it encorages thinking like "which class does that?" instead of "how would I program that?", it's slow and resource-hungry.

I'd go with pixellany. C is the perfect language to start learning programming. And in expanding your skills with this language you'll be able to write clear and efficient code for a project of any size (Linux kernel is one example).

Good Luck.
 
Old 06-21-2009, 03:08 PM   #10
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Uncle_Theodore View Post
I sincerely think that C++ is too big for anybody to understand/master completely
I don't really disagree with that. C++ is far from a perfect language. I think just as much could be done in a language with significantly fewer special case rules.

I just don't think any other language is as good.

Quote:
trying to be everything at once.
That isn't the problem, nor an accurate assessment. C++ tries to reach very high levels of abstraction without ever forcing you to sacrifice efficiency. That somewhat overreaches the design skills of the people who invented and extended the language. But it still is far narrower than "everything" in a programming language. There is a clearly different niche for Java and Bash and the many more special purpose languages.

As a minor aside, I personally don't like most special purpose languages and would prefer to use C++ instead in most of the situations where special purpose languages tend to get chosen. I think just a few of those special purpose languages are really justified.

Quote:
Different people writing in different subsets of it, have hard time understanding each other...
That is far less of a problem in practice than you might expect in theory. It is much more like English. English is an absurdly over rich language. Most English speakers communicate in tiny subsets of the language. But those tiny subsets mainly overlap. Most of the words that most of us don't know are almost never used.

The bottom line is most C++ programmers have little trouble understanding the code most other C++ programmers write. There are exceptions, of course. The boost libraries are filled with code an ordinary C++ programmer could never decipher. But even if they use boost, they don't need to. They just need to decipher the documentation.

Quote:
C is the perfect language to start learning programming. And in expanding your skills with this language you'll be able to write clear and efficient code for a project of any size (Linux kernel is one example).
I used to think so, when software projects were smaller.

Now, I look at source code in mega projects like gcc that stick with C even though C++ would be much better and I find it disgusting. The code must jump through incredible convolutions to achieve the OO structure that is straightforward in C++. Such projects essentially invent their own language, far harder to learn than C, in many ways harder than C++, and they trick a C compiler into compiling that language.

For a beginner, the flaws in C I/O (especially scanf) and the lack of std::string, make learning C unnecessarily painful.

Last edited by johnsfine; 06-21-2009 at 03:10 PM.
 
Old 06-21-2009, 03:25 PM   #11
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
Thanks for your reply, johnsfine. I would agree that there is a "baby" subset of C++ which is "almost like C, but easier", especially with the standard in and out streams. But still, why use a substitute is the real thing is at least faster? And if one wants to study a language, like English, one wouldn't be satisfied with a pidgin version of it, at some point you would want to master it seriously, and C++ would take a lifetime to learn... Although, it might be a good second language to study, after C.

Also, I would strongly disagree that OOP is a magic bullett for all programming needs. And so, the C code doesn't really tries to achieve the OOP structure, it just does things its own way, which is better sometimes.
 
Old 06-21-2009, 03:52 PM   #12
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Uncle_Theodore View Post
why use a substitute is the real thing is at least faster?
I can almost, but not quite, guess what that would mean without the typo(s).

It is common knowledge, but wrong, that C is more efficient than C++.

Take a giant text file with mixed data types, but very predictable and correct syntax.
Parse it into internal variables in C with scanf and in C++ with C++'s easier I/O.
You'll find the C++ program uses less cpu time.
Then if the input syntax becomes less predictable and/or you need good error diagnostics and recover, scanf becomes hopeless while the C++ I/O just gets a bit harder.

Quote:
if one wants to study a language, like English, one wouldn't be satisfied with a pidgin version of it, at some point you would want to master it seriously
You're ignoring the big gap between "pidgin" and "master". My knowledge of English (the only language I know) is significantly beyond that of a typical native speaker of English, but far short of what ought to be called "master". People whose knowledge of English is far short of my own communicate in it with no trouble and have no need to master it further.

The same can be said of my knowledge of C++ (other than the fact that I do know a lot of other programming languages). I know far more than a typical professional C++ programmer, but less than a "master".

I agree (with what I think is your underlying point) that the fact that an ordinary programmer can master C is a big advantage to C.

The fact that a very skilled and experienced programmer still cannot master C++ is a flaw in C++. It is a manageable situation (as it is in English), but for a programming language it is a flaw. If there were a better language, I would switch.

But on my side of that argument, I don't think you need to learn more English before you can communicate well in English than you would need in a less rich language, and I'm sure you don't need to learn more C++ before you can program well in C++ than you would need to learn before programming well in a lessor language.

Quote:
Also, I would strongly disagree that OOP is a magic bullett for all programming needs.
And I would never make the claim that you are disagreeing with there.

I'm not generally a fan of OOP. The concept is now too popular and too over used. Professional (and open source) programming is filled with OOP fanatics who believe that when your problem doesn't fit OOP, you must have misunderstood the problem.

In the real world, many of the problems don't fit OOP. C++ would be a better language if it were a little more friendly to non OOP situations (you can alway write C style code for non OOP, but that is falling back too far).

But, OOP is very important.
1) It is a great tool when it is the right tool.
2) It is popular enough, it not only will be used when it isn't the right tool, it will be used even when the language (C) doesn't support it.
So the lack of OOP support in C is a big language flaw.

I'm also a big believer in both metaphorical and real "training wheels". For those of us without natural balance and athletic skills, it's real hard to learn how to balance a bike when you don't yet know how to pedal and steer the bike. But its hard to learn how to pedal and steer when you don't yet know how to balance. The training wheels let you learn to pedal and steer before you learn to balance. But once you are good enough to take curves at high speed, those training wheels would be a disaster.

std::string in C++ is nowhere near as discardable as those training wheels, but there is a significant commonality. A lot of really bad C++ code is written because people don't recognize when they need to discard things like std::string. Unlike training wheels, std::string will remain often useful as you write big programs. Like training wheels, std::string better be discarded before you try to go around those metaphorical curves at high speed. Like training wheels, std::string is important to use initially, even if you are training to later go around the curves at high speed.

Compared to C++, C is seriously lacking in training wheels.

Last edited by johnsfine; 06-21-2009 at 04:14 PM.
 
Old 06-21-2009, 04:17 PM   #13
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
OK, let me say it this way. Instead of bashing C++, let me praise C. C is good for studying programming because:

1) It's relatively small and easy to understand. You can get numerous examples of C code illustrating simple concepts online or elsewhere. Understanding basic coding with C is much faster that with, say, C++ or Java, where a simple question like "why do I have to put 'static' in front of 'main'?" or "what exactly is a namespace?" can confuse a beginner right away.

2) Although I/O is not very nice, it's manageable. But aside from that, C is very "close to basics" so to say. It's good for illustrating basic algorithmic concepts, like loops, conditionals and such, and for understanding data representation and memory management. High levels of abstraction lead you away from understanding how the things really are inside your computer. And although it might be good for big projects, it's not good for a beginner.

3) Being simple, C is also extremely powerful. It has the power of the assembly language combined with the ease of use of a high-level one. It also doesn't contain anything "extraneous". If you know C, you can study any other language quickly, because you already know the basic stuff...

Something like that...

I don't see the point of learning C++ "more or less" instead of learning C thoroughly, especially since the latter takes less time...

Last edited by Uncle_Theodore; 06-21-2009 at 04:18 PM.
 
Old 06-21-2009, 04:36 PM   #14
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Uncle_Theodore View Post
OK, let me say it this way. Instead of bashing C++, let me praise C.
Sorry, I can't honestly return the favor.

I've taught C to too many people. Long ago I also supervised professional but beginner C programmers. I've also read too many questions from beginning C programmers online.

An appalling amount of time is wasted misunderstanding the constructs C programmers must use for lack of strings, streams, and vectors.

Quote:
It has the power of the assembly language combined with the ease of use of a high-level one.
C is not that brilliant two way compromise you describe. It is the brilliant three way compromise of the power of assembly, ease of use of high-level, and can be compiled by a compiler that runs on an incredibly under powered computer.

That three way compromise was at the heart of the language design and C reflects all three sides of that compromise.

But the need to run the compiler itself on an under powered computer is long gone.

You might or might not need to run the output of the compiler on the microcomputer in your dishwasher (which is probably just a bit more powerful than the computers that ran early C compilers) but you don't need to run the compiler there.

Last edited by johnsfine; 06-21-2009 at 04:40 PM.
 
Old 06-21-2009, 04:51 PM   #15
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
Quote:
Originally Posted by johnsfine View Post
I've taught C to too many people. Long ago I also supervised professional but beginner C programmers. I've also read too many questions from beginning C programmers online.

An appalling amount of time is wasted misunderstanding the constructs C programmers must use for lack of strings, streams, and vectors.
Well, I've taught CS 101 in Java and C, and although neither course was perfect, the one taught in C was, in my opinion, much more beneficial to the freshmen from the point of clarity and understanding the basics of programming. I can't imagine teaching 101 in C++. That would be a complete disaster...

Strings, streams and vectors are "natural" only to people who think in these terms from the beginning. They are high-level abstractions, they have nothing to do with the machine representation of information. If the student hasn't been exposed to STL, s/he wouldn't need those things to express his/her ideas...

I don't understand your dishwasher argument, though. OK, C code can be compiled on a slow machine, now we don't need it, but it's still not a bad thing, is it? The other two advantages still stand, don't they?

Although, bad Java code can clog your computer in such a way that you'd really wish that it was written in something like C...
 
  


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
What programming language was used to make the 1st Tetris. RHLinuxGUY General 12 01-21-2011 05:49 PM
How Do I Connect To Internet Using Fedora Core 5?? @ Total 1st Timer OwenMelbz Linux - Networking 5 09-24-2006 03:33 PM
1st programming language for GUI Lokken Programming 10 12-25-2005 12:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:31 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