I am a senior computer science major and I am required to do a self study on a specific language of my choice. I am currently familiar with C++, Java, VB, PHP, and Silverlight. I would not consider myself a master of any of these languages but I have a functioning knowledge. Should I keep broadening my knowledge of different languages or work on mastering a specific language?
views:
853answers:
25I would suggest a different language entirely, something like: Haskell, Clojure, Scala, Erlang, Lua, Scheme, F#. Any of those will broaden your experience a lot.
If you want to pick up a new language, I suggest F# as it will be very different from what you already know, and with all the attention it is getting from Microsoft (plus it has access to the .NET libraries) it has a good chance of making it in the real world.
Lisp. It is one of those languages that changes the way you view programming. It did for me anyways.
I would suggest Lisp or Scheme. It's very different from what you'd be used to, and I found that it forces you to think about the logic of what you're trying to do very differently than languages with more... "mainstream" syntax. Definitely go with something different from your current set, though. Lua is a personal favorite of mine (and will work very well with your C++ knowledge if you need an embedded scripting language at some point), and Python is useful for a whole ton of things.
All the languages you mentioned are basically object-oriented and procedural. Learning a functional language (like Haskell, Scheme, or F#) or a "hybrid" language (Python, Ruby) is what I would recommend to broaden your horizons.
The specific techniques you might learn — how to add up a list or perform input and output in Haskell or Ruby — may not be relevant to you in the long run, but they help open your eyes as to how things "ought" to be done. I feel that implementing the same algorithm in multiple languages is really helpful for exposing what's essential to the problem and what's cruft specific to the language, and may be helpful for building abstractions to brush away the cruft wherever you are.
In addition, functional programming, especially in a pure language, teaches important lessons about how to design programs. Specifically, the lack of side effects can transform a clumsy loop with variables and output happening left and right into a clean tail recursion with strictly defined invariants and a simple, usable return value.
Have a look at some of these excellent questions and answers, should help:
http://stackoverflow.com/questions/169946/choosing-a-new-language
http://stackoverflow.com/questions/146840/which-language-should-students-start-with
http://stackoverflow.com/questions/145104/what-coding-languages-should-a-web-developer-know
http://stackoverflow.com/questions/153286/what-to-learn-first
And if BNF grammars float your boat:
http://stackoverflow.com/questions/334479/repository-of-bnf-grammars
These are good suggestions. My fear was that I would spend all semester learning syntax and not broadening my understanding of programming concepts.
You need to try something that makes you think differently, not just a new syntax for the same object-oriented or procedural ideas.
I suggest either a functional language (like Haskell or lisp) or a language that encourages parallel programming (like Erlang).
It is important to note that you don't need a pure language to get the benefit, so learning Python or Ruby to do functional programming can be as good as Haskell or Lisp. A benefit to picking Python would be that the syntax is not too different from C, but it includes a lot of ideas from various Paradigms.
<soapbox>
Take a Look at D. As some people pointed out you should try something that declarative/functional and while D is an OO & imperative language it is also making a major effort to support a functional style inside of that. Also It's compile time template system ends up being a functional system in it's own right
</soapbox>
Forth might be a good choice, but hard to find examples on ... I think your question goes along with those of the type, "What programming language should I choose for project X?"
Python or Lisp.
Lisp is like a million years old, still relevant, and very different from the languages you've listed.
Python is a clean, powerful, and fun language, which sees heavy use at google.
why not try something just for the fun of it
"A Box, Darkly: Obfuscation, Weird Languages, and Code Aesthetics"
You need to know - One procedural language (C, Pascal) One OO Object (Java? C#? C++?) One functional language (List?) One scripting language (Perl?)
Blockquote These are good suggestions. My fear was that I would spend all semester learning syntax and not broadening my understanding of programming concepts.
Lisp hardly has any syntax, it's more wrapping your head around how it works. It's definitely beneficial if you want to expand your knowledge and drastically change how you view programming.
Considering in your list you don't have any functional programming language Haskell would be a good addition.
I think groovy would be an excellent candidate. You know java, on which groovy is based, so the learning curve won't be so hard. By learning some of the things the groovy developers did, it will help you to better understand some of the strengths and weaknesses of java.
So, not only do you learn a new language, you will likely learn more about a language you already know. Plus, it has a very clean implementation of closures which (arguably) is an important concept to grasp.
If you are studying a language for the sake of learning how a language came about and has evolved over time (ie: more for the cultural and historical benefit than from a technical standpoint), Tcl would make a good language to learn. It has been around a long time, has evolved along with the computer industry, and is still relevant today (popularity may be waning, but it's still a good choice for many situations). Learning why those things are true (or not) about the language might be beneficial in the long run.
I agree with everyone who's saying that a functional language would be a very good choice, and would help to broaden your understanding of how to approach problems. I'll go further, though, and strongly encourage you to try a language in the ML family (such as SML/OCaml). The type inference and pattern-matching features of these langauges will give you an entirely different understanding of typing and type-safety than what you'll have gotten with Java or the other languages you've mentioned. (I've seen several mentions of F# and Haskell -- both of these should do type inference, but unfortunately I don't know enough about them (yet) to say whether they do pattern-matching...)
I'm going to suggest the unpoopular and suggest that you pick a flavor SQl and learn it. Getting thoroughly familar with how to query databases will stand you in good stead even if you end up using some object-oriented thing that creates the sql for you. Really being able to query databases is something far to few college graduates can adequately do.
And keep in mind these wise words of Alan Perlis
A language that doesn't affect the way you think about programming, is not worth knowing
You may find answers from a similar question I asked helpful: Fun programming languages.
I was asking more in terms of languages that wouldn't have any useful purpose to me, but a lot of them would be useful for you.
SCHEME
There isn't much syntax. Scheme/Lisp syntax is basically parse trees. A lot of people who got stuck on the syntax of C/C++ and even Basic go on raving about how Lisp/Scheme/Haskell/Whatever rekindled their love of programming language (I know, grand sweeping generalization, go Google around and you will see what I mean).
Lisp is good because it is a new paradigm on programming for you. You learned imperative languages (object oriented are often considered part of this family) and now you can learn functional. You will also be doing quite a bit with recursion which is a good technique to practice. It will also help you to understand how some recursive processes are iterative and others are recursive. The best thing is writing a LISP interpreter in LISP is pretty easy.
The true power of Lisp is macros. In order to realize something similar in many other programming languages, you need to write code generators. Macros are the reason LISP has no syntax as well.
The only reason I recommend Scheme is because of that book. It is a very enlightening book, but you need to do the exercises to get the value out of it. Even after the first chapter I already found myself breaking down functions into more functional units in my C#/VB/VBA code. Basically this book emphasizes abstraction which is important for any programming language.
You don't learn Scheme because you will use it. You learn it because it will be a great language to change the way you think about programming, give you new tools, and drive home concepts that you use in other languages.
Although many languages either are LISPlike or are evolving to become more LISPLIKE (see Ruby/Perl/Python/Javascript). Even in C++ I would say some of the STL uses concepts from LISP (like abstracting away algorithms).
But it doesn't have to be SCHEME. Common LISP, Haskell, ML, OCAML, etc. will all serve similar purposes. But you will appreciate this book I think :)
Also the other reason to learn LISP is XML. Basically both LISP/SCHEME and XML have a treelike syntax.
(add (get-item a) b c) in LISP/SCHEME
<add>
<get-item>
<a />
</get-item>
<b />
<c />
</add>
By the way add and get-item are just functions I made up as an example.
Don't let yourself graduate without learning something about a functional language. If you are more or less on your own, Scheme is a good choice, or if you are ambitious, Haskell.
More on which functional language should be your first at What would be a good functional language to pick up?