What Programming Languages Should You Learn Next? 759
simoniker writes "Over at Dobbs Code Talk, Chris Diggins has been discussing programming languages beyond C++ or Java, suggesting options such as Ruby ('does a great job of showing how powerful a dynamic language can be, and leverages powerful ideas from Smalltalk, Perl, and Lisp') but suggesting Scala as a first choice ('Very accessible to programmers from different backgrounds.') What would your choice be for programmers extending beyond their normal boundaries?"
Re:Wrong Question (Score:3, Informative)
Fortran90\95:
if (x == 1) then
*stuff*
end if
Comment removed (Score:5, Informative)
Re:Going from C to others is a matter of right boo (Score:2, Informative)
PCL is also free at http://gigamonkeys.com/book [gigamonkeys.com] -- I hate to deprive the authors of their royalties, but hey, it's their choice, and helps in making lisp more popular.
Unfortunately, I really can't stand CL's OBNOXIOUSLY-LONG-IDENTIFIERS that other languages often do with syntax. The purported lack of syntax is not a feature when you end up looking like COBOL with more parenthesis (yes that's hyperbole). There are CLOS workalikes available for most Scheme implementations that have all the features you'll ever use from the real deal (and it's not like most CL's have a 100% perfect CLOS). About the only really unique thing that CL brings to the table these days is conditions and restarts.
Re:Verilog (Score:5, Informative)
Re:Verilog (Score:2, Informative)
If you are to learn new languages, I would suggest the following ones to learn the biggest number of different paradigms and features a language can have:
Assembly language (Low level, manual everything)
C (Low level, ALGOL-family structured programming, manual memmory management, pointers)
Scheme (Declarative/functional, has continuations, lazy-evaluation extentions, lambdas, code is data, real macros)
Smalltalk (Not just object oriented, but object centric)
Prolog (Declarative/Logic programming, code is data)
Verilog (No time-flow/full concurrency, emulates/describes hardware)
You could probably replace Scheme and Smalltalk with Erlang, but I don't know Erlang enough to be sure...
Re:Wrong Question (Score:5, Informative)
Logic languages are something different altogether. They provide a framework for defining the rules of a system, then searching for answers which fit the given rules. Logic programming is not useful for general-purpose tasks, but can hugely reduce programming time in tasks which are difficult to solve any other way.
Re:SQL is next for me (Score:2, Informative)
But yes, it is useful to know.
Return to roots? (Score:2, Informative)
Re:Going from C to others is a matter of right boo (Score:3, Informative)
For productivity, any high level language (.Net, Java, whatever has a lot of libraries)
At the command line, Msft PowerShell is powerful.
The libraries available are really the big thing for high productivity.
Re:Wrong Question (Score:4, Informative)
Functional Languages such as LISP are like using one Line programs with calling functions for the parameters to get the data.
For Example (ADD(ADD(1,2),3) would return 6
vs
x=1+2
x=x+3
return x
Functional Languages are actually good with AI where you need to make a Tree (using Lists) relitivly easy to try to figure out all the possibilities that you can do.
Re:Verilog (Score:3, Informative)
Re:Wrong Question (Score:3, Informative)
Logic programming languages have no functions, or even a sense of time or order. The operate purely on truths/facts. In a way they are very similar to databases and database query languages, like SQL, but more powerfull. A program is a set of truths, e.g. facts like John is Adams father, Anna is Adams mother, Laura is Annas mother and rules like a is a mother of b and b is a mother of c implies a is a grandmother of c. You can then ask the program wether things are true, e.g. is Laura Adams grandmother? You can usually modify the fact database, have non-logic programming triggers fire when some things are asked for and generate queries on the fly from within a rule (code is data).
Re:Verilog (Score:5, Informative)
It's not. It's a hardware description language, so can be used in FPGAs, but is equally used for ASIC designs.
Furthermore, an FPGA is NOT a CPU of any kind. It's a configurable logic chip. You could program it as a CPU, but it's not one until you do.
Re:Going from C to others is a matter of right boo (Score:5, Informative)
http://www.paulgraham.com/onlisptext.html [paulgraham.com]
Re:Wrong Question (Score:4, Informative)
That might be why they recommend Scala. It is pretty easy to pick up if you know (for instance) Java, you have an "actors" library that is similar to Erlang concurrency, you gain some knowledge of functional programming (though not as much as from a pure functional language such as Lisp or ML, or so I'm told), you can deploy it on the JVM and interoperate with the huge number of existing Java libraries, and you can use existing IDEs such as Netbeans.
Re:Verilog (Score:3, Informative)
Parent post is uninformed garbage.
Verilog is a hardware description language used to describe blocks of logic and the interconnections between them. It has only the most superficial similarities to a conventional procedural programming language.
FPGAs are the Swiss Army knife of digital logic, a large blob of programmable logic gates that can be configured to perform the function of any digital circuit that can fit within it. They do not normally contain a CPU and those that do use the CPU to supplement the gate array.
Re:Going from C to others is a matter of right boo (Score:5, Informative)
And a powerful macro system. Scheme's is interesting, and you can do most anything with it, but certain things require a great deal of hoop-jumping.
Aside from conditions and restarts, macros seem like the last thing that hasn't sneaked into popular languages yet. For the uninitiated: imagine being able to write a function that, at compile time, takes and returns entire syntax trees. Or imagine if the C preprocessor let you write #defines that were full-fledged functions that had the entire language and runtime available during expansion.
Imagine if C let you hook into the tokenizer and the parser! Why, you could invent your own language for solving your problem, and then solve your problem in that language!
It's worth learning Common Lisp just to play with this stuff.
Re:Python? (Score:3, Informative)
I won't claim it's perfect, but IMHO it comes closest of any language I have tried to just letting me code up my thoughts. In any language, there is a certain amount of stuff you need to do to satisfy the syntax of the language; for example, in most languages you cannot do anything with a variable without declaring it first. Fans of Python sometimes claim that Python code looks like pseudocode, but with the extra advantage that it actually works.
Python has object-oriented features, functional programming features, and good-enough performance. It would be an ideal language for introducing a beginner to programming. When you do something that makes no sense, like trying to add an integer and a string, Python will catch it (Python is strongly typed) and Python will raise an exception. Some languages will magically convert types for you, but this can lead to subtle bugs.
Note that Google has standardized on four languages, and Python is one. (The list: Java, C++, Python, Javascript) Google has hired several important people from the Python community, including Guido van Rossum who created Python and still serves as Benevolent Dictator for Life.
I'm happy because my current job lets me do most of my work in Python, and we are doing cool stuff.
steveha
Lots of reasons to start out with Perl (Score:3, Informative)
* It is easy to learn. Don't listen to what the Python advocates tell you. There are lots of good tutorials out there on the web.
* It introduces you to syntax which is similar to other well-used languages such as C and Java. If you're going to do Perl, you're probably doing CGI, and then moving over to Java and J2EE isn't as hard as learning it from the start.
* If you learn Perl first, then classic shell languages such as bourne shell, korn shell, etc., won't be so cryptic when you need to modify or write one (and you will need to at some point). Many of Perl's built-in variables are the same as what you'll find in those shells.
* Regexes - nearly every language out there has them now, but Perl has for a long time been the leader in regexes. In my opinion, Perl's regex syntax along with the Perl culture itself encourages their broad use. When you learn regexes from Perl and you move to another langauge that has libraries for them (e.g. Java or C#), you'll find support for them but you will also find that long-time developers in those languages won't use them as much. If and when they need to use one, and they know you're into regexes, they will come to you to ask you how to construct them.
* Windows API Support - outside of Microsoft only products, Perl's library of Win32 modules is virtually unmatched by other scripting languages. Although they have them, languages like Python and Ruby don't even come close in this area. This is important because someone starting out with a programming language will often be starting out on Windows, not a *NIX platform. If you are a Windows sysadmin trying to break out of VBScript and move on to better things, then Perl is for you.
* Lots of legacy systems in production today use Perl. I was in a company once that hired some Python biggots, who wanted to convert all the programs written in Perl code to Python (and get paid for it -- har har), but the IT manager wisely kept them in check. Perl is ported to almost every flavor of *NIX out there, and then some, and on many platforms it is part of the default install package. (Sun OS is one that comes to mind.) If you know Perl, you're useful when you come across it.
* Quick and dirty scripts. Sometimes you need something that you can use quickly and throw away. Perl is perfect for one liners executed at the command prompt and for multi-line utilities. Plus, there is instant gratification that comes from creating useful one-liners, kind of like an endorphin rush.
Re:None of the above... (Score:5, Informative)
Re:Verilog (Score:4, Informative)
*shudder* Arrgh.
Javascript is not a nice language. It has all the features you say... but most of them are broken.
Dynamic everything? Yup, it's got that. Except that its primary data structure, the Object (an associative array, basically) coerces all keys into strings. This means that if you try to use another object as a key, it gets coerced into something like "[Object:0x12345678]", and that string is actually what's used... with hilarious results if you actually want to use the keys as anything other than simple hashes. Yes, this happens with numeric keys in arrays, too. And since all the data storage classes share method and data namespaces, which means you can't combine named and numbered items in an array without running the risk of overwriting the array methods.
First-class functions and methods? Yup, it's got that... with some *really weird* semantics when it comes to 'this'. Basically, if I have a function foo(), I can call it in three ways: foo(), object.foo(), or new foo(). Each way, the function gets called. 'this' gets assigned differently in each one. In the first, the current value of 'this' gets propagated into foo(). In the second, foo()'s 'this' gets set to 'object'. Yes, this means that these two lines behave differently:
(The new foo() case is still pretty strange, but at least it's consistent with what you'd expect.)
C-like syntax? Yup, it's got that... but C-like syntax is entirely unsuited for a dynamic language like this, because a C-like syntax implies C-like semantics. Like var. var defines a local variable, right? No, it doesn't, it assigns a new value to the current object context. Which means the value remains valid after it looks like it's gone out of scope. Don't believe me? Open up Firefox's error console (in 'Tools') and try any of these lines:
(The answers are 1, 2 and 4.) If you're used to C, C++, Java, C#, D, or any of the other horde of Algol-based languages, Javascript *lies* to you.
The fact that Javascript has closures is its one redeeming feature, IMO.
The thing about optional semicolons is pretty horrible, too. Try writing a parser for it some time.
If you're interested in dynamic languages, of which Javascript is one, I'd strongly suggest checking out Lua; it's way faster than Javascript, it has all of its features implemented in rather more consistent ways, and is so tiny that one person can understand the entire language (library included) with ease. I do most of my programming in it these days.
(I agree with all your other language choices, BTW; although I'd add Forth to the list as an example of a radically different low-level procedural language, and I'd emphasise Smalltalk more. Smalltalk is a beautiful language. All the shiny new language features people are rediscovering today, Smalltalk had in 1980. Concurrency, dynamicism, polymorphism, extreme programming, closures... it had 'em all. And nobody noticed. It's a shame...)
You might want to check out Io [iolanguage.com].
Re:Wrong Question (Score:2, Informative)
Re:Wrong Question (Score:3, Informative)
Re:Wrong Question (Score:3, Informative)
Re:None of the above... (Score:4, Informative)
Needless to say, this is very memory consuming, and can take a long time. So what you really get to verify is simple models, not your actual application with all its different variables. Also, the tools didn't grok Real World programming languages, so you had to write your model in a language other than the one you would eventually write your application in.
As to the question of whether the tools grok Real World programming languages; the ones I'm thinming of certainly do. Usually they take a Real World programming language and extend it with annotations specifying behaviour, and then verify the actual code against the specification annotations.
That means that you can write Java, annotate your with JML [jmlspecs.org] and have tools like ESC/Java2 [kind.ucd.ie] do verification of the exact Java code you are about to compile against the specifications provided by the annotations. Note that you can get Eclipse plugins to integrate the extended checking right into your Eclipse session.
Alternatively, you can write C# and mark it up according to the extended language Spec# [microsoft.com], and have a theorem prover verifying your C# code against the Spec# verifications (which are just part of the code really) as you go. This is integrated into VisualStudio; you can see an early version of this at work from 2006 here [microsoft.com].
If you're willing to get a little more out there for Real World programming langauges, you also have the otion of using Eiffel with ESpec [yorku.ca] to provide an integrated workbench of theorem proving, automated unit testing, and acceptance testing in one package. There's also the option of going with Ada and using SPARK [praxis-his.com]; in this case you have to use a restricted subset of the full Ada language, but in return SPARK provides real soundness guarantees.
So I guess the answer is: yes, there are real tools that make this sort of approach practical and integrate well with Real World languages.
Re:Best Language to Learn Multithreaded Programmin (Score:3, Informative)
The basic idea is this: in Haskell (or most other functional languages), you know that different function calls will not interfere with each other (everything is thread safe out of the box), so they can be evaluated in parallel. Function evaluations can be parallelized with the infix operator par. The following evaluates "part1" and "part2" in parallel, before storing them together, as a pair:
let result = (part1 `par` part2) `seq` (part1,part2)
No locks, no writing explicitly threadsafe code. I'm sure there are other languages that are good for parallelism, Haskell just happens to be the one I'm learning.
Re:Verilog (Score:3, Informative)
But if you think about it, that doesn't make any sense anyway: the entire point of using a property instead of making the field it aliases public to begin with is that you want to restrict access through the getter and setter. Or in other words, if you could access the address of the field then you could bypass the getter and setter.
If you want to be able to access the field directly, then just make it a public field instead of a property. If you want to access the property of a class you didn't write, then the writer probably had some good reason not to make it a field (i.e. the getter and setter actually check or transform the data) and you should stop trying!
Arc (Score:3, Informative)
Arc [arclanguage.com] looks like a promising new programming language that goes back to the roots of what Lisp should be. It's managed to build a reasonable community in a very short amount of time and there's a lot of buzz.
Re:Wrong Question (Score:3, Informative)