Tuesday, July 13, 2010

Tips on choosing a programming language to learn

If you’re interested in learning a new programming language, here are five questions that will help you pick the one that best suits your needs.

———————————————————————————–

I’m often asked: How do you pick which programming language to use in your development work? It’s a fair question, particularly for people with little or no experience in the development field. The great temptation is for me to just say, “use XYZ language.” Instead, I think it is better to explain how to think about choosing the language with which to work.

When you’re thinking about which programming language to learn, you need to ask yourself the following five questions in order to come up with the right decision for your needs.

Why am I learning a programming language? If your goal is to learn to program, look for languages that teach basic principles such as Lisp (or Scheme) or possibly Ruby or Smalltalk. There are a number of excellent languages that are specifically designed to teach programming at a fundamental language. You’ll want to bypass most of the mainstream development languages in favor of one of these educational languages, and look for one with an associated workbook, textbook, or other training materials that will effectively tutor you.

If you’re trying to become a better programmer, one of these educational languages will greatly benefit you as well. Alternatively, you can try one of the nonmainstream languages, especially if it uses a different paradigm than what you’re using now.

If you’re building a career, then you need to base your decision on market forces. Look at job ads that appeal to you (the type of work, the location, the pay, the experience level needed, etc.). Keep track of what languages (and other skills) those ads mention as the primary skill(s) and that is what you need to learn. If you think that you’ll be miserable in that language or environment, then you might need to reevaluate your career goals.

If you just want to have fun or build personal apps, then learn whatever you want!

How do I plan to learn the programming language? Your plan of attack and style of learning will affect your programming language choices. For instance, if you learn best in a face-to-face classroom setting, you need to make sure that classes exist for what you want to learn. For many nonmainstream languages, even the book choices are poor.

No matter what, you’ll want to make sure that you feel comfortable in the online communities for that language. Consider these questions: How do they treat newcomers? Do a lot of questions go unanswered? Is there a good mechanism for turning questions into better documentation?

On that note, is the documentation any good? A poorly documented programming language will force you to count on the community, and an unhelpful community can sink you pretty quickly.

What toolset, libraries, and frameworks support the programming language? Some people really like working in a specialized IDE; others are perfectly happy in a basic text editor. Whatever your style is, make sure that the tools are available to support it. Even if you like a plain text editor, for example, you’ll probably want to make sure that it supports formatting and coloring for your language. Along the same lines, you’ll want to make sure that the language’s libraries and frameworks support your intended applications. As an example, if you plan on working on scientific applications, you’ll want to check out the math libraries to ensure that you won’t spend a lot of time implementing the basics of your math routines.

What do I plan on building? If you have a particular kind of application in mind, it will influence what kind of programming language you choose to learn. Some programming languages are better suited for some applications than others. For example, if you’re working on a Web application, you’ll want to make sure that your language of choice has the capability to be used in those applications and is designed for that scenario. On a server using the CGI model, virtually any language can be used for development, but you’ll quickly discover that some languages are better than others.

Part of this comes down to toolsets, frameworks, and libraries (having to handle HTTP connections by hand is a chore regardless of the language you’re using), but the programming language plays a large role in things as well; many development languages have succeeded because of one small feature or a few features that made a particular type of development much easier.

Look at applications that are similar to what you’re building, and try to find out what language those developers are using and why they chose those languages. This will give you insight into what programming languages you should learn.

Am I willing to take the road less travelled? There is the possibility of using a less mainstream programming language. For personal development, this is not a problem, but many development environments view nonmainstream languages as a risk; specializing in one of these languages can restrict your job choices, or your boss may not be willing to allow you to work on a project in that language.

All the same, there is a great deal of value in learning programming languages that aren’t as popular. For one thing, you may find yourself on the path to becoming a highly paid specialist consultant. In addition, every language you learn will teach you new things about programming, even if you don’t use the language in your day-to-day work.

Conclusion Learning a new programming language can be a very rewarding experience, but it is important to not waste your time, either. Picking the right programming language for your needs is not always easy, and chances are, any language you learn will have some things that you dislike about it. But with these tips, you should make better decisions about which programming language will meet your needs and goals.

What criteria would you give to a new programmer to help them pick out a language
Strategies for learning programming languages - what works and what doesn't
Learning another programming language can be a great way to help take your development career to the next level. Justin James tells which techniques for learning programming languages have and have not worked for him.

——————————————————————————————–

In my recent post10 tips to go from a beginner to intermediate developer, my #1 tip is to learn another language. Since I’ve had a lot of experience learning programming languages, I want to share what techniques have and have not worked for me.

For the record, we ran a poll in August 2008 asking how you learned to program. From the 4,716 readers who took the poll, 45% used a mix of various learning techniques; 35% were self taught; 20% learned in school; and only 1% were taught by a friend of family member.

Shoot from the hip Sometimes you have no choice but to jump right in feet first into a new language with no preparation; sometimes we get so excited about a new language that we do the same thing — even when it isn’t necessary. In my experience, this is one of the worst ways to learn a language. You often end up with some bad habits that may take a long time to unlearn, and you actually spend more time learning like this than you would with a more disciplined approach.

The funny thing is the first time I tried this approach, it worked out fairly well. The HTML 2 spec had just come out, and I was learning HTML. It was a different world then; HTML could not do much, and it was fairly easy to deal with provided you had low expectations.

My next attempt with this technique did not work out as well. I was running an online store, and the software was written in Perl. I learned Perl’s syntax in about 30 minutes, but it took approximately six months of intense work later on to feel like I had learned it well enough to live without having the documentation open in another window all day long. Luckily for me, I did not have to do much in the system.

This experience set the tone for years to come. I convinced myself that 30 minutes to learn syntax was “good enough,” and any learning beyond that amount of time was just memorization that could be replaced by handy documentation. Later on, I discovered that what made me so successful in Perl (and unsuccessful in Java) was that I was doing enough work with it to learn the paradigm of the language — its strengths, weaknesses, etc. I made a lot of messes until I gained that kind of knowledge.

Learn with human help I learned my first programming languages — BASIC, COBOL, Scheme, and Pascal — in high school from an instructor. We were gently eased into a language, taking baby steps and doing projects of increasing complexity, until we had enough knowledge to write a full-fledged application from top to bottom.

This was a great way to learn, particularly for the first few languages because those languages shaped my thinking for a while. Unfortunately, there are three issues with it for a working developer:

It might take longer than you have to learn the language.
No school or facility offers a class to teach just one programming language.
It might be too expensive.

If you have a good instructor and a good workbook of appropriate exercises, this is the best way to learn your first few languages, but it is unrealistic to use it once your formal education is complete. (Maybe this is a possible business idea for a reader?)

Study the language before touching it Another strategy I’ve used is to study a language in-depth before trying to write any code in it. You can watch online tutorials, read books, study source code, or whatever strikes your fancy, but no matter what, the learning should be at least partially structured (such as reading a quality book). The idea is to seed your mind with a lot of ideas so that when you start to write code (while you may not consciously remember everything you learned), the concepts are kicking around deep down and helping you out.

A technique I haven’t tried but I know people who have is to essentially craft your own learning program. By putting together a disciplined program for yourself instead of doing research first and then trying to write code, you can create appropriate “assignments” for yourself during natural breakpoints in your study session.

I used this technique the first time I had to learn a language on my own. It was my college summer break, and I had the good sense to contact the CS department to find out what language the Data Structures class was in instead of assuming that it was in Pascal like the previous class. The Data Structures class used C, and students were responsible for learning C on their own. I bought a book that said it would walk me through learning C (I seem to recall the phrase “24 hours” in the title), and I read it about a month before classes began.

While the language is fairly simple, C requires a ton of work to use it safely and well. I didn’t touch C until the second week of class, but when I did, I understood it enough to do everything necessary. I breezed through the class and watched most of my classmates struggle; their problems weren’t with the concepts taught in class but rather with trying to learn C with the “shoot from the hip” strategy.

I’m currently using this strategy to learn Ruby (I know… I’ve been saying this for nearly six months). I still have not touched any code, but I’m almost finished reading a book on the subject. And you know what? I feel like I already know Ruby better than C# and probably VB.NET. My knowledge of VB.NET and C# were learned without any discipline or rigor, and there are gaps in my knowledge. I see things all of the time that have me scratching my head because I know enough to do my daily work, but my knowledge probably only entails a small subset of the languages’ capabilities. I know that I am not as good in those languages as I could be because of these gaps.

Though I don’t think I’ll get to use Ruby any time soon for actual work (.NET implementations do not seem ready for prime time yet, and we’re a VB6 and .NET shop), I’m glad for this experience. From now on, I intend to use this strategy for any new language I learn — except for something I just need to stumble through to make a few minor changes.

What are your experiences with learning new languages? What methods have or have not worked for you? Like me, did certain strategies work in some situations but not in others? Share your experiences in the discussion — you just might help a fellow developer.

No comments:

Post a Comment