You are not logged in.

#1 2010-04-16 15:36:50

A Future Pilot
Member
Registered: 2008-10-17
Posts: 111

[Solved] What language to learn?

OK, I'm sure there are a whole bunch of these threads out there, but I couldn't find one off-hand that really answered my question. I quite possible just didn't look hard enough, so if you know of a thread just link it for me :-)

Anyway so I wanna learn to program for two reasons:

1. Security. Call me paranoid but I want to be able to build the most secure system out there. (I know that's serious undertaking, which I'm fine with. I've got about 5 years or so at least! :-)

2. Hacking. The good kind. I want to get involved in an Open Source project, or start my own. Basically what language are most Open Source programs written in. (I can almost guarantee myself that that is a really noob question, but hey! I'm a noob so it's ok :-)

I'm thinking starting out with Python, then learning some C or C++

Any suggestions would be great!

Thanks!

Last edited by A Future Pilot (2010-04-19 21:11:53)

Offline

#2 2010-04-16 16:05:12

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 453
Website

Re: [Solved] What language to learn?

I'd say what you intend to do (Python then C++) sounds good to me.  It's actually pretty much what I did (except I learned Java while learning Python).  Honestly though, I know some people who started off with C++, others who started with Perl, so it's entirely up to you what you start with.  Whatever you do decide to do though, C/C++ seems to be what's used predominantly in open-source projects (not exclusively, but most of the source code I've looked at was one or the other), so learning one of those would definitely be useful.  I also recommend getting comfortable with Bash files, for those quick "gotta automate this" type scripts, since I find them quicker to write than writing a C++ or Python script to do the same.

If you're looking for tips on where to start, the Python website has good documentation/tutorial type stuff, and cplusplus.com offers a similar tutorial/documentation section.  As for Bash, you should be able to learn by doing.  If you have trouble deciding on stuff to code, there are plenty of websites that pose programming challenges (Euler Project, C Programming Challenges, etc.).

Hope that helps!

Last edited by lswest (2010-04-16 16:05:51)


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

#3 2010-04-16 16:27:20

A Future Pilot
Member
Registered: 2008-10-17
Posts: 111

Re: [Solved] What language to learn?

OK, thank you! That's what I'll do then :-)

Offline

#4 2010-04-16 16:52:58

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: [Solved] What language to learn?

I second that, Python is a good language to start learning. When you are comfortable with it try another...

Offline

#5 2010-04-16 17:06:56

Gbak
Member
Registered: 2010-02-27
Posts: 73

Re: [Solved] What language to learn?

Ruby seems a nice choice as well.

Offline

#6 2010-04-16 18:05:48

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,441
Website

Re: [Solved] What language to learn?

A Future Pilot wrote:

Call me paranoid but I want to be able to build the most secure system out there.

What does "build a system" mean and how does it relate to programming?

As for contributing to a open source software project, this is the best advice I have heard so far:

Buy a copy of Scott Meyers' book "Effective C++". Make sure you get the third edition: http://www.aristeia.com/

His book is divided into fifty-five "items," each of which is a specific, concrete piece of advice as to how to improve C++ code.

Find an application that looks like it could use some love by browsing the bug reports.

Start by just getting that program just to build, then read the first of Meyers' items. Go through the program's entire source code while applying the advice of that item wherever it would be appropriate.

When you're done applying the first item, do the same for the second. Lather, rinse, repeat.

It will seem at first that to apply all fifty-five items would be a Herculean effort, but you will soon find that your work goes faster and faster as you grow more and more familiar with your program's source. At some point you will find yourself able to apply several items simultaneously. It really won't take that long at all.

When you're done with the fifty-fifth, do the same with Meyers' book "More Effective C++", then after that, "Effective STL".

I did this very same thing with my own program back in 2000 (but with the second edition). Not only did I fix a whole bunch of bugs and memory leaks, I mark that effort as the moment of my transition from Clueless C++ Newbie to Masterful C++ Wizard.

(paraphrased from http://www.freelists.org/post/haiku-dev … -to-help,4)

This advice is very specific, but I think it can be applied to different languages and different sources of learning as well.

Offline

#7 2010-04-16 18:11:31

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,170

Re: [Solved] What language to learn?

^ seems like excellent advice. Great post.

Offline

#8 2010-04-16 18:29:53

axel668
Member
Registered: 2009-08-15
Posts: 168

Re: [Solved] What language to learn?

C++ ... once you know C++, you can program ANYTHING


"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila."
(Mitch Ratcliffe)

Offline

#9 2010-04-16 19:47:11

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 453
Website

Re: [Solved] What language to learn?

Thanks to drcouzelis for the book title, I hadn't heard of that one before!

To the OP: I'm glad you found my advice useful!  I agree though with the post before mine that knowing C++ opens a lot of doors, but I don't think it's the best language to jump into, probably better to start with something like Python (as was suggested above).


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

#10 2010-04-16 20:28:08

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: [Solved] What language to learn?

YMMV, but I started with Python and then started to grok and prefer C. Just about everything in the FOSS world seems to be written in C - it's essentially the lowest-level and most portable of languages. I mean portable in that you can port a C library to another language with relative ease - for example, as a Python module - but generally not the other way around.

One of the few exceptions would be the kernel, where some stuff is written in assembly. But don't let that worry you. tongue

Also - even I, a hardcore C zealot, will occasionally write stuff in Python if it's not worth my time and effort to use C. For example, things get hairy really fast when you start doing complex data structures or major string parsing. On the other hand you can do some seriously moby stuff with pointers.

Last edited by Peasantoid (2010-04-16 20:55:04)

Offline

#11 2010-04-16 20:52:42

A Future Pilot
Member
Registered: 2008-10-17
Posts: 111

Re: [Solved] What language to learn?

Thanks everyone for all y'alls suggestions!

And by "build a system" I mean like editing the kernel or whatever. Like whatever language the actually OS is written in :-)

Offline

#12 2010-04-16 23:03:35

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: [Solved] What language to learn?

Lua and/or C.

Lua is small and easy to comprehend all of it, but at the same time still very powerful. Combined with the C API, which is very nice (way nicer than Pythons from what I hear, not just from lua enthusiasts but actual Python programmers as well >.>), it is possible to do much more than what it can just by itself. It is also very fast (especially if you tune your application to use C in bottle necks). It has awesome documentation, and the best IRC support channel I have been to. Sorry, #archlinux, as good as you are, you do not match them...#lua (or #haskell for that matter, but in #lua you can get a lot more 1on1 attention) is extremely helpful and very friendly, unlike #archlinux which is just helpful, but they insult you the whole time you are being helped....

I think it would be a good language to learn programming on, even if you do not end up using it that much (but I think it is likely you will fall in love with it if you actually use it, most of the people who hate on Lua have no idea what it is capable of or how it works, they are just sheeple), it will still give you a good footing. For C I highly recommend getting K&R. If you can do C and understand pointers ;D you are pretty well set for any imperative language...I am not sure I would recommend learning C first, but if you can handle that you are good to go.... smile

I learned C first, then C++, then Lua, then got a bit more familiar with C again, then Fortran 95. Somewhere in there there was a mix of trying Python, Ruby, Falcon, and Haskell. Haskell is pretty cool but is a completely different mindset than imperative languages. I like best the combination of Lua and C, close to a tie with Haskell, followed distantly by C++, which I actually hate now, despite years of using it (or maybe because of?). If you insist on C++ Bruce Eckel's Thinking in C++ series is pretty good. It is free online on his website, which is down, but I bet you could find it elsewhere. I have it on my computer somewhere too if memory serves.

The first edition of Programming in Lua, written by the lead developer, is available online at lua.org

The reference manual is excellent and covers the specifics of syntax semantics, etc. and available functions and documentation.

The kernel and a lot (all?) of coreutils is C.

Offline

#13 2010-04-17 12:11:15

CrazyPandar
Member
Registered: 2010-04-15
Posts: 10

Re: [Solved] What language to learn?

Linux kernel is mostly coded with C and a little assembly language.
Gnome is mostly coded with C too.
You can see C is poweful.
But C is very difficult to learn. It's going to be a painful journey.

Offline

#14 2010-04-17 12:22:07

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,441
Website

Re: [Solved] What language to learn?

CrazyPandar wrote:

But C is very difficult to learn.

I don't think C is very difficult to learn. But, the problem is, if you look at something like the source code for GNOME, you are not seeing just "C". Instead, you are seeing many many many different library calls (such all calls to GTK, Gconf...). In my opinion, learning to program in C is the easy part. Learning how to use a library (or, in GNOME's case, MANY libraries) is the hard part. Unfortunately, in practice, C is a little bit useless without a library. sad

What do you think? Do you agree?

Offline

#15 2010-04-17 13:44:09

Sirupsen
Member
From: Denmark
Registered: 2009-11-14
Posts: 26
Website

Re: [Solved] What language to learn?

In my opinion, you should start learning a scripting language, to get into programming. Python or Ruby. Try both a little, and see which one you like best. Ruby has it's elegant syntax, that some people fall for, and the incredible way of handling objects, and meta-programming is just awesome. Also Ruby Gems is just awesome. But I am indeed biased, try out both, by doing some small projects in both.

Moving further from here, I'd refer to DigitalKiwi's post. C and Lua, are awesome languages.

And by any cost, avoid PHP. Please, just avoid it.

Last edited by Sirupsen (2010-04-17 13:45:02)

Offline

#16 2010-04-17 14:50:10

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 987

Re: [Solved] What language to learn?

drcouzelis wrote:
CrazyPandar wrote:

But C is very difficult to learn.

I don't think C is very difficult to learn. But, the problem is, if you look at something like the source code for GNOME, you are not seeing just "C". Instead, you are seeing many many many different library calls (such all calls to GTK, Gconf...). In my opinion, learning to program in C is the easy part. Learning how to use a library (or, in GNOME's case, MANY libraries) is the hard part. Unfortunately, in practice, C is a little bit useless without a library. sad

What do you think? Do you agree?

My sentiments exactly.  C is actually a very small language, smaller than Python if you consider their respective standard libraries.  Miles simpler than C++ (of which I only know a little).

As for what language to learn?  All of them.  Seriously, start with Python or Perl, use it for a while exclusively, move on.  Use Emacs and learn Lisp.  Snatch up a copy of The C Programming Language and work your way through it -- it's still the best C book I've ever read, although it is written to programmers and not to beginners.  Take some classes and learn Java.  Get a job as a coding peon (they're none too scarce) and learn some Perl.  Start on TAOCP (Knuth) -- it's literally the definitive work on computer science.  Study your init scripts and learn some bash.  Build some CGI applications, some SQL statements, some backup and maintenance scripts.  Get into some of the rarer, more "odd" languages like Erlang or Haskell.  Some C# or VBA would not go amiss, as I was disheartened to learn when I got my first programming job.  MATLAB and LabView are common in engineering.  Even PHP has its place.

Basically you should learn lots of languages.  The skills you learn in one language will make certain problems easier in all of them, and you'll never design the safest system unless you're already a very competent programmer.  5 years is not enough.  I'm thinking 10 to 15 years to acquire the appropriate expertise, and the rest of your lifetime to build and maintain the system.  (I personally have less than 10 years of programming experience all told, so you can take this with a grain of salt.)  I'm not trying to discourage you -- quite the opposite!  But if you want to be a competent programmer you should be continually learning -- it's one of the most dynamic fields out there.

As for what languages to start with, Python and then C sounds like a good starting combination, but you should be a competent Python programmer with fundamental understanding of the hardware side of things before trying to learn C.  Perl may make the transition easier (I didn't learn languages in this order, so consider this merely an educated guess).

Offline

#17 2010-04-17 22:42:11

pickboy87
Member
From: Minnesota
Registered: 2010-02-12
Posts: 84
Website

Re: [Solved] What language to learn?

My 2 cents from a newbie programmer. I've tried to learn some of the "common" languages and always ended up giving up. Java or C or C++ was always too difficult to comprehend or just wouldn't compile right. I ended up going with Python once I heard that a vast majority of it suggest it as a beginners language. It forces you to code 'properly' (correct amount of spaces, proper syntax and what not) and is VERY easy to understand. It's rather simple looking compared to C++ or Java but still very powerful.

I would at the very least take a look at Python and try to learn that (even if just for the VERY basics). The more languages you know, the better. Start with something fairly simple and work your way up.

Offline

#18 2010-04-18 13:00:12

gradgrind
Member
From: Germany
Registered: 2005-10-06
Posts: 921

Re: [Solved] What language to learn?

I would also like to agree with drcouzelis, C is really a very simple language (apart from its unbelievably horrible pointer declaration syntax), but you can't do much with it until you start using libraries, and that's where the learning curve can get very steep. Python has excellent libraries, many of which are integrated and well documented.

Another advantage of script languages for learning is the avoidance of the compilation cycles, this saves a very significant amount of time, which means you learn much more quickly, and receive much more positive feedback. Never underestimate the amount of time you will spend fixing errors, which essentially means, running, fixing something, running again, fixing something else, running again, ,,, and that is just so much faster with interpreted languages (or will someone contradict me here?).

Offline

#19 2010-04-18 18:33:16

ConnorBehan
Trusted User (TU)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,356
Website

Re: [Solved] What language to learn?

I will only contradict you in the case of computationally intensive programs. Like if you're diagonalizing a huge matrix, the program will actually take a few minutes to run with a compiled language. In that case it's best not to use an interpreted language so it doesn't take a few hours.

But yeah, going from a first attempt at writing source code to having a working program is always faster with a scripting language because they are so much more flexible in terms of syntax and you can rerun the program as soon as you fix something.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#20 2010-04-18 21:43:43

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: [Solved] What language to learn?

Python was my love for a long while. But like all other men, I have moved on. I am now getting to know more about Lua.

The advantage of a scripting language for a beginner is that you get an interpreter and instant action. That's all that matters, because the write-compile-run routine gets tiring without Visual Studio.


I need real, proper pen and paper for this.

Offline

#21 2010-04-18 22:39:06

Chimera
Member
From: Run Level 7
Registered: 2010-03-28
Posts: 43

Re: [Solved] What language to learn?

I agree with everyone who recommends python wink. c++ is also a very good follow-up, or c if you're VERY determined. However, I'm surprised nobody has mentioned perl. Perl can be used for...well, everything! Literally. Now, it's as ugly as c, and sometimes even uglier, but it is extremely useful, and is (I'm guessing) probably the scripting language the most OS code has been written in. I mean come on, isn't perl a dependency of the kernel? I think it is.

*edit: my mistake, someone mentioned perl

Last edited by Chimera (2010-04-18 22:41:53)

Offline

#22 2010-04-18 23:31:07

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: [Solved] What language to learn?

Perl is probably the ugliest non-esoteric language I have ever seen (or at least remember seeing). ;_;

And no, it is not a dependency of the kernel.

And a lot of languages can be used for 'everything,' that does not mean they should be, or are even good at it.

Why do people keep recommending C++? It is horrid. D:

Offline

#23 2010-04-19 00:00:54

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,398
Website

Re: [Solved] What language to learn?

Kiwi wrote:

Why do people keep recommending C++? It is horrid. D:

C++ used correctly is not horrid...  C++ used like C is.  tongue

The same actually goes for perl.  I have seen some absolutely unintelligible perl code.  Then I have seen well structured, formatted and documented perl code and thought it was actually something I should look into.


But given the criteria listed in the first post, C is about the only sensible suggestion here.

Offline

#24 2010-04-19 00:18:33

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: [Solved] What language to learn?

It is that using it correctly bit that most people fail at. big_smile

Offline

#25 2010-04-19 01:27:06

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Offline

Board footer

Powered by FluxBB