ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Its a good idea to have an understanding of C, as nearly everything is written in C 'under the hood' eg OS's (apart from some assembler), DB's, higher level tools/langs eg Apache, Java, Perl, Python, PHP etc.
It highly depends on what you want to program. C is, in my opinion, definitely the most universal language, equally suited for embedded applications (in your washing machine, TV, ABS, electronic injection etc ....) as for 'normal' computers.
I'm going to side with PerpetualNewbie on this one with concerns to the Scheme half of his suggestion.
I don't use Scheme though, I use Common Lisp. Both languages are practically identical, but from what I've seen of Scheme, the whole dev. group tries to keep it as "pure" to the original Lisp form as possible.
Common Lisp has capabilities of everything imaginable: exception handling, object-oriented stuffs, hi-level and low-level programming techniques, you can easily bind to C/C++ libraries for inclusion of extended functionalities (think for use of ncurses, Gtk, Qt, etc.), variable linking (ie. "pointers"). It even is used heavily (along with Scheme) in the mathematical and AI (artificial intelligence) scenes.
The only thing to not try and conquer with this language when you first start out, though, is Lisp's macros. They are not like C-style macros in the least.
My favourite thing about Lisp is its almost "impulsive" way of writing. Because everything in the language is treated as a list, a lot of pre-planning time can be cut down; inline "LAMBDA" functions (for when it doesn't seem appropriate to define a completely new function that will only be called from the same spot in the code), namely.
If you decide you would like to try learning Common Lisp, it runs much like Python - in a shell, or in Lisp terms, a REPL (Read-Eval-Print Loop). My REPL of choice is clisp. As for a text editor, Emacs is recommended (as it was written mostly in Lisp and because it's the only editor I've seen so far that gets Lisp-style indentations right).
Best is very subjective. A better question would be, "What is a good programming language to learn for the type of applications I want to develop?"
If you want to master all aspects of software design, I suggest the following:
1. C and Assembly (for high performance or low level code).
2. At least one dynamically typed scripting language like Python, Ruby, Perl, or PHP.
3. At least one language with object oriented support like Java, C++, or Objective C. (Python, Ruby, and Perl all support Object Oriented Programming too.)
4. At least one language that supports purely functional programming like Lisp, Scheme (which is a subset of Lisp), Erlang, Haskell, or ML.
I've been reading that functional languages are the future, because they are ideally suited to writing programs that make efficient use of multiple processors and skilled functional language developers can write complex, bug free programs incredibly quickly. But I've been writing C, C++, and Java for 6 years and to be honest, I'm having a hell of a time understanding Haskell, Scheme, and Erlang concepts and code.
Where were you reading this business about functional languages being the future? I would very much like to read this article.
I'm more than likely going to either get flamed like no other (or PM'd to death) for saying this, but I don't like this whole, grandiose push towards OOP. I find C-based OOP languages (C++ excepted) to be far too easy to learn, far too similar and seem to be a bit big for their britches; multi-paradigm languages are another deal, though (Python, Lisp, etc.). Suddenly little 20-year-old, snot-nosed punks are turning up in the IT programming world requesting guruesque statuses just because they can hack out Java faster than anyone else they know. Funny story (which I won't get too far into), I actually had been asked, recently, if I would like to join forces with some OOP-mercenaries for a simple database application using MsDB. They didn't think I would be a decent fit though, as I only knew Java (and not C# - which isn't the case now) at the time, and did not possess intricate knowledge of Microsoft-SQL-based databasing techniques. Pff. It's not as though it's that hard to learn.
This is what's happening at my university as we speak; it's very frustrating, especially for my friends who started in C++ and had to start back at square one with Java the next semester (naturally being expected to catch up an entire semester's worth). Fortunately I was a year ahead of the Java tide.
I'd love to see these rumblings about functional programming too, I love Scheme quite a bit and would like to have some firepower against all the fad-language supporters
Best is very subjective. A better question would be, "What is a good programming language to learn for the type of applications I want to develop?"
If you want to master all aspects of software design, I suggest the following:
1. C and Assembly (for high performance or low level code).
2. At least one dynamically typed scripting language like Python, Ruby, Perl, or PHP.
3. At least one language with object oriented support like Java, C++, or Objective C. (Python, Ruby, and Perl all support Object Oriented Programming too.)
4. At least one language that supports purely functional programming like Lisp, Scheme (which is a subset of Lisp), Erlang, Haskell, or ML.
I've been reading that functional languages are the future, because they are ideally suited to writing programs that make efficient use of multiple processors and skilled functional language developers can write complex, bug free programs incredibly quickly. But I've been writing C, C++, and Java for 6 years and to be honest, I'm having a hell of a time understanding Haskell, Scheme, and Erlang concepts and code.
I can't let a post like this slip by without saying "Good for you!" -- everyone should read this one again because it is very much on the right track in terms of pragmatic language analysis.
One thing though: technically speaking, the only functional language you list that's "purely functional" is Haskell, because the others all have ways that side effects can "leak out" into other code, for example, methods for setting global state.
But anyway, it is true that functional concepts can be difficult to learn once you're knee-deep in your typical popular programming language. It's more mathematical, the idea that a lot of code reuse comes from (for example) composing functions to get the desired result. But in the end, as you say, it makes writing the code a lot easier. I think, generally, you have to be a bit more clever when working with functional languages, to really get their worth out of them. And the multi-processor benefits are well worth it. How many CPUs do you have? It doesn't matter with a language like Erlang; because of the way it works, it could scale infinitely if you write your code right. (And note that "right" is much easier in Erlang than, say, C++.)
In fact, the only thing I can add to this is a logical programming language like Prolog. That's even a different paradigm that will throw you on your head for a while, but there are certain classifications of problems for which it is ideally suited. And you might be surprised the kinds of problems which it makes quick work out of! See here - http://www.cs.kuleuven.be/~dtai/ppcbook/ - for a few examples.
It's a pretty easy read, if you're at least familiar with C and C++.
A longer and more complex paper is the relatively well known "Why Functional Programming Matters" written by John Hughes in the 1980s (no, not the same John Hughes who directed 16 Candles and The Breakfast Club ). http://www.md.chalmers.se/~rjmh/Papers/whyfp.pdf
I'm not an expert on the software industry, economics, or programming. So it's possible I'm dead wrong here. But the idea is worth examining. Functional programs let you express very complicated ideas very quickly. I'm just learning Haskell, but there are programs that would take me 150 lines in C that I can write in 5 or 10 lines of Haskell.
[EDIT] I encountered Sweeney's paper about a year or two back on Slashdot, and after I read it I did a Google search on Haskell. That's where I found Hughes' paper.
With so many programming languages out there, I find it a bit overwhelming choosing one to learn. Can anyone give me some suggestions given that I would like to program on windows and linux.
Usually, this is determined by the application. Yes, you could code AJAX in assembly language, but this neither is this the best use for hand-coded assembly language, nor is it the best use of your time. You should study all languages (& the uses of languages...) in order to help answer this question for yourself. Assuming you are a student, most university Computer Science departments will offer a course in language comparison for exactly this reason. Many universities require that students majoring in Computer Science take this course.
One of the things you will learn in such a course is that labeling languages as general purpose is in many cases wishful thinking. No language does everything well, but some languages do more things better than others.
You have implicitly stated one criteria you may be looking for -- portability across Windows & Linux. My suggestion (as others have already stated here...) is to go with Python which is a higher-level dynamic language similar to Java (although Java is not a dynamically typed language...). Although C & C++ are universal when it comes to Unix & systems-level programming, you have not indicated that you intend to focus on lower-level details. Programming in C & C++ requires a deeper understanding of what is going on, & you will be able to complete tasks faster in Python without being required to know all the tedious details of what is going on at a lower level.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.