Ask HN: Clojure as a first progamming language?
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.
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.
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.
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?
Thanks again for reading. I appreciate any and all responses.
21 comments
[ 5.9 ms ] story [ 59.8 ms ] threadDepending 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.
Quick question: regarding learning about the JVM, are you aware of any good resources, especially any which look at it from a Clojure perspective?
2) You don't have to use the concurrency stuff if you are just learning programming. The whole point of STM is that it takes care of the concurrency and transactions for the programmer. This is like saying garbage collection is more difficult than hand allocating memory because the system that implements it is more complicated.
3) Huh? I mean, if you want to use Java libraries you have to learn a bit of the java idiom (.... camelCase), as well as the library that you want to use, but there is no demand that you become intimately acquainted with the JVM any more that you become intimately acquainted with the specific implementation details of python or ruby.
I'm not sure if your post is FUD or genuine ignorance of Clojure (or both).
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.
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.
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).
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.
The language you feel most comfortable in does colour your thinking. (Or vice versa?) So just don't stop learning languages.
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.
For me, Clojure has enough. YMMV.
Clojure also has an extremely rich _core_ library of functionality - a lot of things that would simply be more work in Python or even Ruby can be expressed more succinctly in Clojure (yes I know Haskellers won't be impressed ;)
As far as communities I've found #clojure IRC orders of magnitudes more helpful than #django or #python (and both those channels aren't bad).
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.