
Ask HN: Clojure as a first progamming language? - Towelie
Hey everyone,<p>Thanks for taking the time to read. I’m interested in trying out Clojure for my first programming language--at least, the first programming language in which I intend to commit myself to becoming proficient. This might make more sense if I give a bit of background on my situation.<p>I have minimal experience (a couple college courses) with Java and C++, and I’ve tinkered with HTML, PHP, et al. on my own time. For a while, I’ve been intent on picking a language to learn for web application development, since got the startup itch. But being the person I am, I had to survey all the possible options first, since this is my first programming language we’re talking about. That wouldn’t matter to a lot of people, and maybe it shouldn’t to anyone, but I feel there’s a chance an experienced programmer has a certain connection with his/her "native" programming language, and if so, I want to choose a language worthy of that--none of this Java/C++ nonsense.<p>So after a few months of general web information gathering, I found and became intrigued by the ideas and concepts behind the Lisp family of languages. Being a math guy myself, I felt Lisp might be a more natural fit for my mind, that I might have a stronger natural connection with the language than I would with anything else.
That said, of all the Lisps, I’m leaning toward Clojure at the moment due to its many features which make it far more ideal than most Lisps for say, web applications--which are what I intend to code once I’ve achieved the level of skill necessary.<p>With all that in mind, what do the readers of HN think about choosing Clojure for a first language? Are there any reasons I may want to consider going in a different direction? How necessary is it to be proficient with, for example, Common Lisp or Scheme, before picking up Clojure, for somebody whose mind hasn’t been molded to think in terms of C or Python or Java or whatever?<p>Thanks again for reading. I appreciate any and all responses.
======
mechanical_fish
_I feel there’s a chance an experienced programmer has a certain connection
with his/her "native" programming language_

Sure, you will tend know more about the language that you have worked with the
most, which in turn tends to be the one you prefer. But that need have nothing
to do with the language you learn first.

A very large number of the programmers you will meet today learned programming
via something like C64 or Applesoft BASIC, or (at best) Turbo Pascal. These
languages were not exactly Lisp. In those days, BASIC only had global
variables. Our growth was not stunted. The idea that learning BASIC stunts
your growth was a load of crap at the time, and it remains a load of crap.

If you have the startup itch and want to teach yourself good habits, here's my
advice: Don't dither, and don't pick up habits that encourage dithering. Like
fretting too much about your language of choice. If you actually plan to build
web software, take up Ruby, Python, or even PHP. You know, something normal.
Something which features lots of libraries and blogs and books and colleagues
and infrastructure.

And learn Lisp too. At the same time. Start with SICP, which involves starting
with Scheme. Another useful Lisp to tinker with: emacs Lisp.

Eventually you will learn at least four languages, so don't worry too much
about which comes first.

~~~
swannodette
Ruby and Python and PHP all built their success because they were once the
experimental non-normal choice. Argument holds no water.

And I'm sorry bad programming habits will stunt your growth (speaking from
personal experience).

Learn the most expressive language you can that's still practical for your
goal. Learn the language that you will find most fun and exciting - libraries
be damned (Clojure has a ton of them anyway).

~~~
mechanical_fish
_Ruby and Python and PHP all built their success because they were once the
experimental non-normal choice._

Yes, and back when they were new, they weren't what beginners learned. When
PHP was new, beginning programmers with an eye on the Web learned Perl, Java,
or even C, because they had larger communities and better documentation,
libraries, and books.

As a beginner it isn't your job to push the envelope of platform design.
Unless your primary goal in learning programming is to tinker without
necessarily shipping anything.

And, yes, bad programming habits are bad. Unfortunately, avoiding bad habits
isn't as simple as choosing one language over another. You can write bad code
in any language -- indeed, expressive languages let you explore the _really
complicated_ corners of the bad-code phase space -- and you will write bad
code, until you've had practice. One good way to get that practice is to pick
a language where there's a lot of well-written existing code and documentation
and style guides and Stack Overflow comments to read over. See above.

------
JimmyL
If you want to learn a language from the perspective of getting something done
(in the startup webapp sphere), go for Python/Django or Ruby/Rails - they both
have mature, well-established communities with plenty of documentation and
available libraries.

Clojure seems quite cool, but it's a relatively new language and, especially
when compared to the other two platforms mentioned above, it lacks the wealth
of institutional knowledge about delivering good webapps that forms a
significant portion of the value of Rails or Django.

Clojure is the exciting new thing you blog about. Rails or Django is what you
used to write the blog itself.

~~~
kunley
Your last thought is quite opinionated. The other approach is to write the
actual code (in whatever you want) instead of blogging ;P

~~~
locopati
There's something to be said for starting with a language that has great
library support. While one approach to learning is to write from scratch,
another is to read existing code and be able to build what you want to build
using parts that are already there (less likelihood of losing your enthusiasm
out of frustration too). Clojure does have Java library support, but it's
native library support doesn't match that of Python or Ruby or Java.

~~~
kunley
Yeah of course decent amount of good quality libs is crucial for learning,
because you can see how idiomatic code is written.

For me, Clojure has enough. YMMV.

------
lkuty
This is a good idea I think. I would consider learning Java, the basics, with
Clojure. At the same time because you will have to regularly make use of the
huge Java library. So it's a good idea to know about classes, objects, basic
syntax and primitive types. Of course you will put the focus on Clojure. I
also recommend SICP and Scheme. Scheme, in its R5RS form, is a really good
pedagogical programming language. I learned it at school and it was a really
good experience. One that forever changes the way you think about programming.
But I didn't get that at the time, only later :) You can do the SICP exercises
with Clojure instead of Scheme. I would avoid digging into C++ or Common Lisp
now. Those are quite complex. Keep CL for later, and forget about C++ :) Next
get deeper into Java and start to learn a "scripting" language like Ruby,
Python or Perl. All in all, I think it is really important to grasp different
programming paradigms: functional (Lisp, Haskell, ML, Erlang, ...), logic with
Prolog, procedural/OO with Java (can get you a job :-), distributed (Erlang)
... There are a lot of other interesting languages out there but it is a good
start: Clojure + Java.

------
kunley
I'd say something a bit different that most responses, well I guess it's worth
taking your time.

Choose language which seems most natural to _think_ in. It's really important.

For example, many people just don't have that wires in brain which cause them
to see everything as objects, so all that OO & design patterns stuff seems
missing the point. But others love it and use this approach naturally!

You just want to avoid the situation when after a first-time crush on some
programming paradigm "wow how is it powerful" there comes realization that
writing anything in it is a boring and misplaced experience. Just switch to
another paradigm instead.

And don't be lured by the current popularity of some web frameworks, tools or
whatever. They come and go. Your language of choice -- given that it's
actively developed and not only an academic experiment -- will have them
sooner or later. In the meantime you will expand your mind with the language
you really like. It's worth.

------
patrickdlogan
Clojure has a simple functional language foundation that should be good for
learning as a first language. The biggest impediment may be the lack of a
tutorial from a beginner's perspective, that focuses on that foundation. Using
most material for Clojure a beginner will soon be exposed to features probably
beyond their understanding.

------
fp
I think Clojure is not a simple language. The reason is, that you have to
learn about 1) Lisp, 2) Clojure's approach to concurrency (immutable data
structures + reference types) and 3) the JVM. These are all fairly complex
systems on their own. The combination of them is what makes Clojure
interesting, and, in my opinion, you can't leave one out and still have a
great language.

Depending on your knowledge, this may make it a bad choice as a first language
because it's so much to learn at once. You could be better off, to start by
learning something more similar to what you already know (possibly
Python/Django or Ruby/Rails for web programming).

That said, Clojure is learnable, of course. It may just take more time. If it
feels right to you, then go for it. Enthusiasm about the tools will help your
learning. And either way, it's not like you are making a mistake.

~~~
swannodette
Clojure's beauty is in that it _is_ simple. It's also a language where it's
completely unnecessary to have to understand all the parts at once. I coded in
it for 6 months and never used a single concurrency primitive.

That said, JVM stuff does present a challenge but not more than the various
non-sensical annoyances I've experience with every programming language. Two
other real difficulties is lazy-sequences and less than ideal error-reporting.

lazy-sequences is like learning pointers- tough and then you get it. error-
reporting is a symptom of early days. This issue is offset somewhat by
Clojure's FP sensibilities.

~~~
eru
Lazy-sequences may also help to prepare you for a completely lazy language.

