Learning Languages

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

xepher
Posts: 83
Joined: Tue Mar 09, 2010 1:42 am UTC

Learning Languages

Postby xepher » Thu Feb 24, 2011 6:48 pm UTC

I'm currently a newbie to coding, and I'm taking a class in Java at the time. I've been thinking about when I become adept in my first coding language, and I definitely want to know a larger range of languages.

After learning Java, what other languages should I take that are somewhat related to Java, and other languages related to those, and so on.

User avatar
headprogrammingczar
Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Learning Languages

Postby headprogrammingczar » Thu Feb 24, 2011 7:25 pm UTC

The best next language is probably C. It is syntactically similar to Java, with features that range from "why can't Java have this?" to "wtf why can't the compiler figure this out?".
Python is apparently a good language to learn, but I don't like it much, for a litany of probably-nitpicky reasons.
Perl gets a lot of hate, but I look at it like glue. You can't make a house without it, but you can't make the whole thing with it. It's basically "shell scripting++" and good for those annoying things you would normally do tediously by hand.
Haskell is my current favorite, and it's probably one to save for later, after Python, Ruby, or Lisp. It's incredibly expressive but also tough to learn, due to unusual syntax and "monoids in the category of endofunctors". This tutorial is the easiest to digest.
Ruby is a language I would like to learn, but haven't gotten around to. It's kind of like the best parts of Python and Java smushed together (this metaphor is probably going to get ripped apart).
Lisp is another language I want to really learn someday. It has lots of dialects, and I can't give a good summary of any of them. The big ones I know of are Common Lisp, Scheme, and Clojure (also emacs-lisp, but yuck).

(tl;dr - learn C, then go hog-wild)
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you

User avatar
Yakk
Poster with most posts but no title.
Posts: 11129
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Learning Languages

Postby Yakk » Thu Feb 24, 2011 7:29 pm UTC

Java is an object oriented procedural bytecode programming language with heavy duty "standard" library tendencies.

(Object Oriented) (Procedural) vs (Procedural)
C++ doesn't have the "everything must be an object" fetish of Java.

(Object Oriented) (Procedural) vs (Object Oriented) (non-Procedural)
Languages that are based on message passing, for example.

(Procedural) vs (Functional)
Haskell, Lisp, Scheme, etc. Languages that are designed to control the flow of information and side effects.

(Procedural) vs (Declarative)
Make is the most popular Declarative language. Some UI languages could be described as Declarative.

(Bytecode) vs (Compiled) vs (Interpreted/Scripting)
Java is compiled to bytecode which is then run in a virtual machine. Other languages like C# and Python are somewhat similar.
Many scripting languages exist on a continuum towards Bytecode as speed becomes more important.
Compiled languages (even if Java is compiled, I'm talking about something different) are compiled directly to machine-code for the platform of choice.

(Heavy Duty "standard" Library) vs (Light "standard" Library)
Java programming is often about leveraging the standard library and toolkits. Other languages, like C++, don't consider such libraries to be a core language feature.

I don't know what differences or similarities you are interested in. The best way to learn new concepts is to work on languages that are different, not ones that are similar.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
L4nce0
Posts: 24
Joined: Tue Feb 22, 2011 9:16 pm UTC
Location: Fort Collins Co

Re: Learning Languages

Postby L4nce0 » Thu Feb 24, 2011 10:52 pm UTC

Well it's not really what is "best." There is no "best" language. (hush cpp fans)
I'm trying to not go over your head. It's really easy, but I'd be happy to clear up anything!
It's really more of what do you want to do?

Want to get into web stuff, perhaps python, perl, or php?

How much of a control freak are you?
I want to control EVERYTHING, Assembly..
Err, I don't want register level control, but still pretty damn control obsessed (registers are what holds data, like where in memory your int is..)
C++, you can get into some nasty stuff before you even hit STL containers. (STLs.. The containers are all template classes, allowing you to specify what objects are allowed in the containers. Kinda hard to explain)
Okay, I want control, but like how the computer manages basic resources.. I don't really care to overload operands ( ie ++, +=, etc)
C is good
I want good control over my systems OS
I'm pretty sure C based languages (aka not java) can do that. Though I'd say I'd look into some shell scripting
I just want to write stuff like in Java
.. stick with java =) maybe move onto android if you get bored
I want Java, but I still want control over how operands work
C#
I hate dealing with ints, or all this nitty gritty stuff. I just want to role out prototypes fast
Python, or closely related Perl
I just want an insane challenge, whitespace, brainfuck...

Personally, I'll use Java if given an option. Second choice is C++ as I have a weird love for streams..


Though again really depends on what you really want to do
Want to automate tasks on your box? shell scripts. Want to quickly write stuff, maybe a bit of internet python perl. Want to control hardware (ie array of LEDs etc.. ok aka PIC microcontrollers) you want assemble, but I'd recommend C ( as most can do both..)

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: Learning Languages

Postby Berengal » Fri Feb 25, 2011 1:09 am UTC

xepher wrote:After learning Java, what other languages should I take that are somewhat related to Java, and other languages related to those, and so on.
You should learn languages that are as unrelated as possible. If you always stay in familiar territory, you'll never get out of the object-oriented procedural mire, both because there's a fuckton of languages there and because you'll soon become bored just memorizing slightly different syntax without ever learning anything really new. Also, programming is a creative process where all real knowledge and ideas exists outside of any language, but you won't see that until you've become familiar with a wide range of different ones. Just as you need to know blue and green in order to know red, you need to understand the objects of smalltalk and ruby, the closures of lisp and javascript, the immutability of haskell and the pointers of c in order to understand the abominations of java. Until then, all you do is go through the motions you've been taught in class without any real ability to reflect on the fundamentals of your language and what impact they have on your programs, whatever that language may be.

It will take quite some time, but in the end it's worth it in my opinion. Once you've learned and internalized five or six languages that are really different from one another you'll notice how you can pick up most new languages in a couple of hours. You'll also notice how ideas from different langauges influence eachother, and you start writing code in java in a way that you would never have thought of if you hadn't learned prolog, but which fits the problem really well and leads to very succinct, self-explaining code. The downside is that you start noticing the flaws of various languages much more easily, and this can be a genuine cause for endless frustration. No language is perfect, so all languages will have these flaws, but for some reason I find that the more popular languages have the most gratuitous flaws, probably because they're of the older variety, or based on those, and because popularity means resistance to change. Also, there's really no good way of learning how to get a development environment set up. In really bad cases, you can spend an entire weekend without getting a good way of compiling and running programs set up, but this is a minor issue in the grand scheme of things.

Don't learn languages based on popularity. If you want to learn C# instead of lisp because it's easier to get a job as a C# programmer than a lisp programmer, you'll be spending time learning a language that brings little new to the table compared to what you already know, but if you instead spent time learning some lisp, you'd learn a lot more, and you'd be able to pick up C# faster than before. Learn languages based on what you don't already know and the extra knowledge will put you in a much better position to compete with others anyway.

When learning a new language, try as best you can to follow the conventions already established. Also understand why the conventions are the way they are. Even if the reason is as simple as an arbitrary choice between otherwise equally good alternatives, at least you'll know those alternatives are, how they differ from each other and what the designers and practitioners of the language value.

Lastly, don't be too disappointed if you just can't "get" a language. There's no shame in dropping it and taking a break, or learning another language, before returning a month or three later.

Functional languages are really different from Java; indeed, Java is perhaps the least functional of all popular languages these days, at least those of the newer school. I'd recommend Haskell just because it's almost diametrically opposed to Java, and thus will cover a lot of new territory really quickly. It has a really steep learning curve, especially when you're coming directly from java. The downside to this should be obvious; it's much easier to become frustrated and give up. To weigh up for this, it has a very good community that's thrives on being helpful and welcomes newcomers. Once you get going however, you'll discover a whole new world of programming akin to learning it for the first time. Haskell also has a type system, unlike most languages I'd recomment, that doesn't suck, unlike the other languages that do have type systems.

If you want a softer start, python is decent, but too similar to java in my opinion. I used it and java interchangeably when I first learned to program, doing all the compulsory coursework in java, but writing any hobby programs in python. I found it to be a less annoying java with some neat features, but it's not very heavy on the new ideas. It has first-class functions, but other languages do them better, and it's dynamic, but other languages leverage that better. It's easy to end up writing java with just a different syntax.

Ruby is also similar to java, but not as much as python. The problem is that it's still similar enough that it doesn't force you into a new mindset, so if you start with that as your second langauge you might still end up writing java. It does closures better than python however, and a quite significant subset of their use will soon feel natural. It also seems to be better at taking advantage of its dynamic nature than python, but I'm not familar enough with larger python programs to know what crazy things they really do there.

You don't have to know c to understand pointers, but it helps. You should definitely learn it, and you should definitely try to write a larger program in it, but I don't think it should be your first choice for a new language. You can't pretend you're writing in java anymore, which is good, but if you lack experience your attempts at learning c could turn into endless attempts to smoke out bugs that are particularly nasty. (I don't know how, but apparantly I knew how computers worked on a machine level before I learned c. I therefore had to trouble grokking it, and even write some larage (for personal projects) programs without much issue. If you don't know how the machine works however, it's well worth it to learn it early, just maybe not first).
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
L4nce0
Posts: 24
Joined: Tue Feb 22, 2011 9:16 pm UTC
Location: Fort Collins Co

Re: Learning Languages

Postby L4nce0 » Fri Feb 25, 2011 9:17 pm UTC

I would disagree with Berengal. Then again, depends on you. I rather learn a language that will help me get a job, then to learn a language that makes learning first said language easier... Not to say he's wrong. Obviously more interested in the learning then application aspect then me. (They all seem the same to me at this point, to be honest. Change gears, do it in C++, change gears do it in python) That's just a highlight of my first argument, what is it you want to do?

User avatar
Yakk
Poster with most posts but no title.
Posts: 11129
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Learning Languages

Postby Yakk » Fri Feb 25, 2011 9:29 pm UTC

"Get a job" is a laudable goal. But at some point, "get a job" is a problem of scale. You can, right now, "get a job" flipping burgers, or picking garbage up, or maybe as a farm hand.

You want to "get a job" as a computer programmer. But the types of computer programmers are almost as varied as the types of jobs in general.

Suppose you decide "I want to be a foo programmer on application bar". Then you spend the next 4 years ignoring anything about any part of programming and computer science other than foo, and that doesn't apply to problems you imagine you'd run into in application bar. You could then find someone who needs an "application bar" job filled using programming technique/language foo.

But odds are (A) you don't know what techniques are actually needed in application bar, (B) the people doing the hiring don't even know what techniques are needed in application bar, (C) you will be a very narrow programmer, because all you have learned is one programming technique, resisting all others, which limits the kinds of solutions you can engage in, (D) 4 years will have passed, and even if your goals where spot on when you started, by the time you end the techniques and applications out there will have drifted (E) programming is quite often a R&D problem: problems that someone knows the solution to have an application that solves them, so you don't need programmers to do it, so programmers are often working on either researching what other people's solutions where, or coming up with their own solutions, and there are far too many such prior solutions to commit them all to memory, (F) 2-10 years after you get your job, you'll want to move on (or you'll be forcefully moved on), and all you know is your one narrow area of expertise.

Learning Haskell won't get you a Haskell programming job. Learning Haskell will teach you functional programming techniques, which will give you a ridiculous advantage with some of the next-generation techniques that are being added to procedural languages based off of functional programming techniques.

So don't learn Haskell.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
Cleverbeans
Posts: 1378
Joined: Wed Mar 26, 2008 1:16 pm UTC

Re: Learning Languages

Postby Cleverbeans » Fri Feb 25, 2011 10:41 pm UTC

L4nce0 wrote:I rather learn a language that will help me get a job, then to learn a language that makes learning first said language easier... Not to say he's wrong.


At my job this year I had to learn three new languages, C#, Ruby and GDL. I'd have to agree with Berengal as a broad background allows one to more fluidly move between styles and paradigms as required. My co-conspirator had a much more limited background than I did coming mostly from procedural languages like C and Fortran, so when we moved to the Ruby part of the project he really struggled despite some 20 years of experience just because the style was so different than what he was accustomed to seeing. Online examples and certain functional aspects of the language required a lot of playing around before he felt comfortable, and he got snagged on a number of "gotchas" because he hadn't encountered bugs of the "new language" kind like defaulting to pass by reference vs pass by value, or the subtle differences between a Proc, block, and lambda in Ruby. In a few spots he reimplemented map and inject because he simply hadn't familiarized himself with them. I think that's a pretty good arguments for exposure to a broad range of languages.
"Labor is prior to, and independent of, capital. Capital is only the fruit of labor, and could never have existed if labor had not first existed. Labor is the superior of capital, and deserves much the higher consideration." - Abraham Lincoln


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests