Most Useful Linux Related Programming Language(s)

Pyroflea

Distinguished
Mar 18, 2007
2,156
0
19,960
I want to learn a new programming language, just for something to do. I'm building a Linux rig pretty quick here, so what's a good language to learn? I want something that's not brutally complicated, but is still useful. Thanks :)
 

MrLinux

Distinguished
Dec 28, 2007
1,036
0
19,310
It kinda depends on what you already know, and if you want to stick to open source tools...

C & C++ are the main programming languages, and always usefull.
Perl & Python (scripring) are always usefull.
Java has been around for a long time and just keeps gong.
PHP (5 or 6) is well worth knowing, if you know C++ you'll find it big-time easy to learn PHP; learning MySQL will compliment it very well; PHP 6 will probably be a much sought after skill in a year or two.

C# (& Mono) I'm in two minds about, there's a lot of need for C# programmers; but MS holds all the patents and could let loose the Dogs of Law at any moment...
 
I'd say that C++, Perl, and even Java fit the description "brutally complicated" (for beginners at any rate). I'd go with C or PHP. But it's kinda difficult to be sure without knowing what languages you already program in. C will provide a good foundation for many other languages; on the other hand it's much easier to do useful things like database access with PHP.
 

randomizer

Champion
Moderator
C# is dead easy on Windows because of .NET, but I'm not sure how complete the Mono project (open source implementation of the .NET framework) is. Never really looked at it. Not needing to worry about managing memory, or spending 30 minutes just programming a blank form is nice. C# is all about a trade-off of Rapid Application Development with the power of C++.

PHP is pretty easy but debugging it can be a pain. The errors aren't exactly descriptive, and since PHP is interpreted rather than compiled, if you have a bug inside a program loop, you could end up with a very... interesting looking web page, filled with countless identical errors. :lol:
 

linux_0

Splendid
http://www.perl.com/pub/a/2000/10/begperl1.html

Perl is the Swiss Army chainsaw of scripting languages: powerful and adaptable.

#!/usr/local/bin/perl
print "Hi there!\n";

O'Reilly's Perl.com is a great place to get started. O'Reilly also publishes some very nice Perl and other computer books :)


If you have the right mindset you can teach yourself Perl and probably PHP in a few days by just playing around with examples from various sites :)

The same is true for C although C is much harder to master.

Scripting languages get you up and running fast and rather easily compared to most compiled languages.

With C# you are beholden to Microsoft, they may decide to shut you down or sue you any time they feel like it.
 

randomizer

Champion
Moderator
Microsoft seem to be fairly lenient with open source versions of their proprietary stuff. Look at ReactOS for example. It's only in alpha stages I know, but it is meant to be an open source version of Windows. I wonder if M$ will just wait until the projects mature alot before suing, like Rambus :p
 

linux_0

Splendid
Microsoft just got done beating up on TomTom over a very old and probably invalid FAT patent, I wouldn't want to take any chances.

They have also been attacking Linux for many years by proxy via SCO.
 

Pyroflea

Distinguished
Mar 18, 2007
2,156
0
19,960
Thanks for all the feedback guys. I guess I should have probably included what I've already done :)

HTML, CSS, JavaScript (Not really programming, but it's similar)
Visual Basic
C++

I've done a bit of each, but do not fully know them (I'm not sure anybody does:p). I get the idea of how they work though, I just lack the experience.
 

linux_0

Splendid
Since your know some HTML, CSS, JavaScript and C++ already branch out to PHP and Perl :)

Then circle around and pickup some good old C.

Understanding what you know and don't know leads to true wisdom.

:)

 

Pyroflea

Distinguished
Mar 18, 2007
2,156
0
19,960


I started reading that Perl website you sent me, I like what I've seen so far :) I'll also check out PHP. :)
 

linux_0

Splendid
Perl and PHP are similar so once you learn a bit of Perl it's much easier to pick up PHP and vice versa.

Perl also helps you learn shell.

Another great advantage of Perl and PHP is that they are cross platform, they will run on many different operating systems and architectures with no changes or very minimal changes.

Since they are interpreted you don't have to recompile your code either.

Great stuff :)
 

Pyroflea

Distinguished
Mar 18, 2007
2,156
0
19,960
What program do you use to write Perl in? As well as other programming languages in Linux. On windows I just use Visual Studio for most things, but this is a bit of a different ball game.

Also, when writing programs, is there any way to make the programs compatible on most platforms? Or does that depend on which language you're using?
 

linux_0

Splendid
Any editor :)

gedit, kedit, eclipse, kdevelop, Vi, emacs.

Some of these editors have syntax highlighting and other nice features.

Perl itself runs on almost anything and your code is mostly portable.

cpan.org has a bazillion modules you can use :)
 

Zorak

Distinguished
Mar 20, 2006
505
0
18,990
I'd say C is probably the be-all end-all for Linux. I mean, C was created for the purpose of writing the original implementation of Unix back in the '60's, so C is VERY MUCH ingrained in the *nix scene. Perl is also a biggie as it lets you rapidly manipulate large sets of data. As I understand it, Perl is pretty much the go-to language for any kind of complex string manipulation. PHP might be a good thing to pick up for Linux if you want to do any web stuff as it is part of the heart and soul of LAMP (Linux, Apache, MySQL, and PHP).

If you are interested in Kernel development or OS development in general, then C is an absolute MUST and the assembly language of your target processor should be fairly useful as well.

From what I heard, programming in Python can be pretty fun as you can use it to make prototypes for "real programs" (read: C-programs) really fast. There are decent tools for Python as I understand it (though I haven't used any) and as for its relation to Linux, Gentoo uses it to develop their package manager, so I think that means it carries some importance in the Linux world.

If you want a really handy tool, learn to program in the Shell (various dialects such as bash, ksh, zsh). It is really useful for making tools to automate tasks, and you can then use a cron program to automatically run those tools at a certain time!

If you would like to contribute to the KDE project, your C++ will serve you well. This is just something to keep in mind. It should also be fairly easy to make C++ programs for Linux, unless of course you learned to do C++ using something like visual studio or borland where much of the code is generated for you.

Java: this is a bit of a weird one as it has been in various stages of becoming open source for a while. It is good for making cross platform programs as it is an "interpreted" language (compiled to bytecode which is later interpreted at run time by a virtual machine). Programming in Java will be a bit disorienting if you are a big C/C++ fan as they remove pointers! Java was actually my first "real language" (the BASIC I knew doesn't really count), and though I liked it, after years of C/C++, going back to Java felt a bit like being given a pair of blunt scissors to work with.

As for development environments, if it is an IDE you want Eclipse is a good bet as it has only about 10^9 - 1 plugins for it. If you want to be a little more "hardcore" you can just choose to invoke gcc manually and program in vim and learn to use gdb from the command line (or use ddd, which is a frontend).

For a really awesome editing tool, you should really learn to use vim. I can't emphasize this enough! Once I started using vim, I was able to finish long and tedious editing tasks in a fraction of the time. Case in point being trying to fix code that got mangled by my programming partner's editor. His editor screwed up all the tabs and made our code hard to read. Normally I'd have to go through and fix everything manually, but in vim, all I did was type about 10 keys to combine different commands and it fixed the formatting of the entire file!

Vim is a great editor, and if you'd rather try a graphical version of it, you can install gVim instead, which also has Windows and Mac support. It comes with a bunch of pulldown menus at the top and all the commands in the menus have their keyboard shortcuts listed for a quick reference. Vim is intimidating to learn at first, but after about a week or so of just using it, you will probably never want to go back to notepad or gedit or whatever. If, on the other hand, you don't like vim, I have heard good things about nano/pico, joe, emacs, and gedit is pretty useful as it has tabs and syntax highlighting (like vim).

There are SO MANY free tools for programming on Linux that you are sure to find SOMETHING that you will like. Just try out the different tools we suggested and go nuts!

Just to recap in case you got bored and skipped to the end: C is the heart and soul of Unix, vim is a great editor, Perl/Python/PHP are all good languages to pick up, and Java is weird. I hope this helps!

-Zorak
 

Pyroflea

Distinguished
Mar 18, 2007
2,156
0
19,960
Wow, thanks a lot Zorak! That was a very useful post. I do eventually plan on expanding my C/C++, but it's just somewhat of an intimidating language, so I'd like to learn an easier language just to get the hang of programming again (I used to do a lot but I kind of quit over the last year, just recently restarted). But thanks again, very appreciated.
 

Zorak

Distinguished
Mar 20, 2006
505
0
18,990
Sorry for the double post, but I forgot to mention that LISP is probably a good language to learn eventually as it is very good for making lists of things and it has become widely accepted as the language of choice for AI development. If you would like to widen your programming background and learn functional programming (as opposed to imperative which is like C or object-oriented like Java), then LISP and Haskell are good choices. I have heard that learning these functional programing languages is really good for broadening how you think about programming. Good luck!

--Zorak
 

Zorak

Distinguished
Mar 20, 2006
505
0
18,990
Yeah, if you approach C from the assembly/machine code level, many things about the C language will become painfully obvious. Unfortunately assembly language can be horrendously complex to get into, but if you are interested, you should pick up a copy of this book. This was a book written by one of my favorite teachers, and it makes learning about assembly language and how a CPU works (albeit at a high level) pretty easy as you are learning a theoretical/simplified architecture. Making the jump to C from that solid basis then becomes a relatively trivial step (things like pointers then become pretty easy concepts). Incidentally, by learning this way, you will also be able to understand a bit how a compiler works as you would be able to generate the machine code yourself just by looking at the original C-source!

-Zorak
 

Pyroflea

Distinguished
Mar 18, 2007
2,156
0
19,960
Sorry, but I'm having some issues with navigating that website for some reason (probably because I just rolled out of bed [funny how this is the first place I come when I wake up...]). Do you have to purchase the book, or is it available for free online? Thanks.
 

linux_0

Splendid

Zorak

Distinguished
Mar 20, 2006
505
0
18,990
I had to buy the book when i took his course, but I am sure that you can find it super cheap online or at a used bookstore. I learned from the 2nd edition, and I believe he will be putting out a new edition soon, but the older editions of the book will serve you just as well as the new one. I am sure there are also places online where you can "acquire" a scan of the book, should that be necessary...

Either way, it is an interesting and useful book.

-Zorak
 

Pyroflea

Distinguished
Mar 18, 2007
2,156
0
19,960
I've decided to start learning C; it seems quite useful, and is partially tied in to an upcoming project of mine. I went through This entire tutorial today, and I like C so far. I'm just wanting to expand more on the base that that guide has given me, so does anybody have any suggestions for further reading, be it online or in book form? That would be much appreciated :)

Also, the only thing on that guide I couldn't get to work is the final project. It says to "Compile this program using the alias Cgfx", but I have no clue what that means or how it's done, and I believe that is the reason I am getting errors (even with the copy/pasted code) and it is not compiling. I'm using Code::Blocks for writing the code and GCC as my comiler. Help? :p
 

linux_0

Splendid
Cgfx is a custom alias on drexel.edu's compile server so it won't work on your system.

Also their last example is using a custom graphics library developed at drexel.edu which is not available. You can't use the code in their example without the lib but you can use standard X11 calls instead.

Good luck :)