4 ms·
Adopting a new programming language
- arms 12y agoTo the author's points of committing and staying idiomatic, I'd recommend rewriting an existing application in your new language of choice. It doesn't need to be a 1:1 port, but by porting over the basic/foundational pieces, you really learn a lot about a new language and its idioms. For me, it's a much more concrete way of learning a new language.
- klaaspieter 12y agoIt's definitely a good way to get started with learning, but you have to be even more careful that you're not just copying patterns from one app to another. I had this experience when I started working on Karma's Android app. I basically started out by copying the entire iOS architecture to Java. It helped me get started quickly without having to make too many hard decisions early on, but I did have to rewrite some things after I became more experienced and learned there was a better, more Android idiomatic, way of doing it. The thing that helped me the most is that I became part of the community. Some of them explained to me why I was wrong and then taught me a better approach.
- arms 12y ago"you have to be even more careful that you're not just copying patterns from one app to another" Absolutely. I hope my post didn't convey the opposite. The way I see it is that the designers of the language know more than the (new) developers using it, so it pays to rewrite existing applications in the way in which the language designers intended.
- ryanyogan 12y agoI think this is a great way to learn the ins and outs of a language once you have gotten past the basic syntax differences. Going from say Ruby to GO / Clojure there is a big mental paradigm shift on how to solve a problem, so taking an existing code base in which you have a good grasp on the domain knowledge absolutely helps. I find looking for [insert language] Koans or trying some Project Euler challenges to be very effective as well. My opinion on the idioms, best design practices, etc... when learning a new language may differ. I almost always feel like some people just understand everything and I am always running to catch up. It turns out no one was born to think in base2 and these individuals just spend a lot of time reading the docs, hacking around on small apps and really taking the time to understand not the how but the why. So I often have to convince myself, you will get there too it just takes time and practice. Rarely does anyone learn a new language in a weekend and put out top notch, idiomatic code, and if you do come work for me so I can sit back on the beach all day. No one picks up a guitar and shreds out Eruption from Eddie on day one, they play some basic Nirvana chords.
- Zikes 12y agoMy "Hello, world" for this is to create a personal URL shortener. If an adequate third-party library for it exists I will use redis as the backend, otherwise I'll use a hash that I'll write to a file when new entries are added and load when the application starts.
- ryanyogan 12y agoThat's a pretty cool idea, at a base, create something useful and force yourself to look through the standard library. I am learning GO right now and I am blown away with what comes out of the box.
- Zikes 12y agoMe too! I was shocked to have my Go url shortener come in several lines shorter than node.js one, and it felt much cleaner. I was pretty much sold at that point.
- abecedarius 12y agoYes, there's a lot of friction when I try to write a new program at the same time I learn a new language: designing a new program is also a learning process.
- hyperliner 12y agoMaybe another way of saying "Staying Idiomatic" is "What made you great before won't this time." I had to do a C++ project a while back and got my hands on "Advanced C++ Programming Styles and Idioms" by James Coplien through a friend's recommendation. Best thing I ever did to really understand the soul of the language. I am sure there is such "soul identifying" book for each language. What would those books be? If you know of one, reply here. I'd love to know them (Go, Haskell). Not just books that show you the syntax, but which show you the soul.
- bitpew 12y agoThanks for the "Advanced C++" tip. "Eloquent Ruby" did the same for me when i was looking into ruby. "Effective Java" is a similar book for Java.
- ryanyogan 12y agoIf you want an amazing book on Design Patterns for ruby, http://www.amazon.com/Practical-Object-Oriented-Design-Ruby-Addison-Wesley/dp/0321721330 http://www.amazon.com/Practical-Object-Oriented-Design-Ruby-...
- klaaspieter 12y agoYes. I believe such a book exists (or should at least) for every language as well. Effective Java — http://www.amazon.com/Effective-Java-Edition-Joshua-Bloch/dp/0321356683 http://www.amazon.com/Effective-Java-Edition-Joshua-Bloch/dp... POODR (Ruby) — http://www.poodr.com/ http://www.poodr.com/ Javascript the good parts — http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742 http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockfor... There is of course also the gang of 4 language agnostic classic on design patterns http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 http://www.amazon.com/Design-Patterns-Elements-Reusable-Obje...
- tel 12y agoRichard Bird's Pearls of Functional Algorithm Design is probably close for Haskell. http://www.amazon.com/gp/aw/d/0521513383?pc_redir=1404313638&robot_redir=1 http://www.amazon.com/gp/aw/d/0521513383?pc_redir=1404313638...
- peaton 12y agoI definitely agree. Furthermore, I think being multi-lingual in terms of spoken languages also helps understanding and being open to new paradigms and idioms. And this works both ways. After spending a semester programming in Scheme, I was much more open to the idioms and syntax of Chinese. I think this effect is super exciting and not discussed enough.
- ChikkaChiChi 12y agoI think learning the frameworks isn't nearly as important as trying to learn the standard library. If you start to rely on frameworks, it's entirely possible you'll bypass some pretty spectacular features built right in to your new language.
- klaaspieter 12y agoWhen I said framework I meant standard library. The most important thing to learn is not the syntax of the language but the standard library. They know everything the language can do and will most likely use all of it's features somewhere. Thanks for clearing it up, I think standard library is a better term :)
- Zelphyr 12y agoMUCH better term! :) I'd submit that learning a framework will actually do you a disservice as far as learning a new language goes.
- breadbox 12y agoCached version: http://webcache.googleusercontent.com/search?q=cache:sT1c5m_RsBgJ:www.annema.me/adopting-a-new-programming-language+&cd=1&hl=en&ct=clnk&gl=us http://webcache.googleusercontent.com/search?q=cache:sT1c5m_...
- klaaspieter 12y agoThank you. My blog is rather old and still runs on app engine. First time I ever hit the free quota. Should be up again.