I am trying to diversify my programming knowledge. I learned Java in College and worked with it a little at work. Now I am working with ruby. I am finding that working with different languages can mean very big shifts in my mindset. I have probably spent more time changing my mind set then actually learning the new syntax. What I am wondering is what skills can I learn/develop that will make the transition to different languages easier?

  • Please provide one skill and allow the community to vote which on is best.
+29  A: 

Learn design patterns. These patterns are applicable to all languages, and make it easier to think about complex problems.

They're really only applicable to OO languages like Java and C++.
Bill the Lizard
Pretty much all languages these days are OO, the only one that comes to the top of my head otherwise is C. And you can even do OO in C if you want, it's just a little more work.
I think there are still patterns in non-OO languages, even if they aren't listed in the book. There are patterns in all aspects of life, and learning how to translate a problem that you don't know how to solve into one that you do know how to solve makes all the difference.
Uhh... how are design patterns only OO? The concept surely isn't.
Christopher Alexander baby!
Scott Alan Miller
I'm talking about the ones in the GoF book. They're all extremely OO.
Bill the Lizard
I second Paul Graham about these: patterns are a symptom that something is missing in the language, though I'm not as convinced of his statement that all of them are implicit in LISP.
Joe Pineda
I do not agree that Patterns indicate something is missing. I view them more as Best Practices. You have a problem, and a Pattern can give you the common sollution, making it easier for the maintainer to read the code a few years hence.
If you read the book Head First Patterns at the very last page (almost:) they state one should be carefull applying patterns. Only use a pattern when the problem fits naturally. I have seen code where the goal seemed to be to use patterns. That is not good, nor readable.
I have seen implementations of the mvc pattern in a procedural way. I know that's just one, but there must be other implementations of other design patterns in a procedural way :)
+20  A: 

I think it's important to understand the concept of pointers, and memory in general, even if you use strictly memory-managed languages. It gives you a bit more insight into how things are working under the hood and may just let you solve a problem when the memory manager of your runtime is fallible.

Bob King
I agree. Even if you don't need to think about memory management, it will help you to understand why things work when you know how they work.
+16  A: 

Read other people's code. As much of it as you can.

I know it's not quite what you were asking, but it's the single most helpful thing I've done to pick up the conventions of a particular language.

+1  A: 

Ditto on the design patterns. Probably the most important thing I can think of in addition to those already mentioned, know your hardware. If you understand the architecture of your environment, the rest should follow naturally.

Oh, and no matter what language you use, be disciplined in your testing.

Add a comment to the appropriate answer instead of posting another answer.
Brad Gilbert

Once you learn "how" to program, changing languages is as easy as learning the new languages syntax. This means knowing the fundamentals like control flow, data structures, classes (if applicable), exceptions (if applicable), etc.

This is only applicable as long as you're trying to learn another language within the same paradigm. After BASIC, C didn't come that different. C++ (with OO) was a change, though not as radical as learning ProLog, which was a revelation to me, a totally different world in all regards.
Joe Pineda
+14  A: 

Focus on the paradigms and not on the languages and libraries.

  • procedural/imperative programming
  • declarative programming
  • object oriented programmming
    • class based
    • prototype based
  • functional programming
  • logic programming
  • rule based programming
  • etc
+8  A: 

I agree with many of the other posts here, but one of the best skills to practice is (in a bit of circular logic) learning new languages.

Because there aren't that many different programming paradigms, you'll find that you'll have most of the mindsets down with just a handful of languages. If you had gone from Java to C# (or even VB.NET) you would have spent most of your effort learning syntax because Java has already taught you the "mindset" for those languages.

In addition, learning a few mindsets actually makes it easier to learn more mindsets. You'll start to see the similarities between languages (they all compile down to the same instruction set, after all) and what looks like different mindsets today will look like variations on a theme tomorrow.

+1  A: 

Learn to provide helpful and meaningful comments. not only it is a useful skill on its own but it will also help you to write the project documentation in future so you'll be investing in your career.

This skill have many applications in the daily live of developer:

the said comment; svn commit notes; remote communication with the customer; defects reports ...the list could go on

Ilya Kochetov
+4  A: 

Learn how to write code in a way that doesn't even need commenting :)


Design. Standard, ordinary, everywhere design. It's applicable, its different and yet it directly applies so much of the time.

Scott Alan Miller

Music and painting (and other arts) do great things for changing the way that your mind works and expanding your capacity for other things.

Scott Alan Miller
+2  A: 

Debugging. Specifically, dividing and conquering a problem that doesn't make sense until you've narrowed it down to something you can research. This is definitely useful when learning a new language because problems won't be as immediately obvious.


Understand how your operating system works.

+5  A: 

Study different approaches to problem solving. Deduction, Induction, Predicate Logic, and so on. Typically you'll see an entire family of languages derived around a certain type of problem solving.

+4  A: 

As others have said, study languages that has different view on how to solve a problem. Grab one language for Object oriented, one for procedural, for logical, functional, etc.

Also, learn some programming concepts like closure, coroutine, multiple dispatch and other programming paradigms. Then see how these concepts are implemented in different programing languages.

+1  A: 

See if you can find a good example program (more complicated than Hello World) and pick a feature it provides.

Walk through the source code (with an editor or IDE, not with a debugger) from the start of the process to the end, and see if you understand what it does.

That way you see how experienced programmers in that language work, and you see real life constructions in code (best practices if you're fortunate).

Reading code tends to be much more difficult than writing code, and real code almost by definition has the most important constructs right there for you to take.


We need to understand your users. Nice designed code that do nothing is way more useless that crappy/uncommented/legacy code that do something useful.

Julien Grenier
+9  A: 

Deliberate style decisions. Having all of your code formatted the same way will make maintenance easier.

Once And Only Once. Try to have each piece of "how to do X" knowledge only represented once. Try to have each piece of information only stored in one place.

Abstraction. A good abstraction is not just an abbreviation for typing. It is a tool to think with, an idea that stands on its own.

Modules. Hide design decisions inside of modules to make changing your mind easier.

Push complexity into data when it will let you simplify the code. Complicated data is better than complicated code. Data is easy to reason about. It sits there. Code is difficult to reason about. It has a dynamic environment and behavior that change while it is executing.

The Unix Way. Small, simple building blocks which can be combined in arbitrary ways are more useful than large, super functional building blocks that can only be used in a couple of ways.

Data Directed Programming. Lots of problems get easier to solve when you handle them by looking up a piece of code (closure, object, function pointer, execution token, whatever) in a data structure and executing it.

Functional programming. Not all problems can or should be solved in a purely functional style (IMHO), but when practical, purely functional code can be easier to write correctly and easier to debug than imperative code. Only introduce mutable state when there is a payoff in increased modularity.

Imperative programming. Learn how to write imperative code. You may need to read old books in order to do this since everyone is all into objects and functions these days, but you will write imperative code, and being good at it matters. Dijkstra wrote quite a bit about how to design an imperative program and how to prove that it does what it should. I highly recommend the book Structured Programming.

Use meaningful identifiers.

Don't be afraid to pull out the big guns when faced with a big problem. It's amazing how often I see someone spend a ton of effort trying to make a small tool do the job of a big tool, because the big tool is "too hard," when using the big tool would actually be much easier.

Don't be afraid to use old fashioned techniques when they fit your problem. I still occasionally use Control/Break processing, a trick that I learned from a Cobol book.

Learn how to type.

Master your text editor.

Master your command shell.

Very nice compilation!
+1  A: 

Informal logic: Try mastering informal logic, at least well enough to have internalized propositional logic but ideally enough to internalize predicate logic, too. Among other things, you'll find yourself able to write decision branches more intelligently.

Things worth mastering in the programming world: OOP: You should have already learned this with Java

Scripting Languages: I'd say the easiest one to learn if you already know Java is probably Python.

Functional Languages: Having already used several of these, I haven't really found much real world application for them. That said, they tend to have beautiful pattern-matching mechanisms. You'll really miss things like SML or OZ if you get used to them and try to write a Java or C++ select statement.

Creating a native GUI: Pick a language, learn to make a native GUI in it. Using C# will make this easier to learn. Using C++/Windows API without VC++ will make it tougher to learn but will give you a better low-level understanding. Using VB6 will make fairies lose their wings. I'd favor C# if your environment allows for it.

Creating a DLL, using it in another language: The easiest way to get around the limitations of your language is to write some of your code in another language.

Learn to use a debugger, and learn how to debug code when you don't have one.

+4  A: 
  • Design Patterns
  • Requirements Gathering
  • Database Principles
  • Networking Principles (Socket programming, HTTP, etc)
  • xUnit Testing
  • How to deal with legacy code.
  • Problem-solving skills -- being objective.
Russell Myers

Learn what it means to write good unittests.

A good unittest (or microtest, as they are sometimes called) has three steps:

  1. Set up preconditions
  2. Exercise code
  3. Assert postconditions

And that's it. It's perfectly natural to have multiple tests per function or method, each of which tests exactly one thing (basic functionality, boundary conditions, etc).

Writing tests like this is massively useful for checking your assumptions about the language, libraries that you depend on, and so forth. Plus, once the tests are written, they stick around to help protect you from future changes, which saves a lot of debugging headaches.


Learn how to write code in a way that doesn't even need commenting :)

...and still comment your code... as much as you can.

You'll know why when you get back to some code you wrote a year ago.

+3  A: 

Always work on your communication skills. Many of those who have a high reputation here have superior writing ability, as they concisely express the concepts behind the answers that they submit.

Like it or not, there will be times when you have to change your vocabulary when you interact with those who do not possess the same technical skill as you have developed. Being able to converse with them and explain complex concepts without relying on the same vernacular that we use at Stackoverflow is so critical.

In respect to technical skills the key areas you'll want to develop or focus on are:

  • Requirements Gathering
  • Database Design
  • Networking and TCP/IP in particular
  • Unix
  • Data Structures
  • Secure Programming
  • Design Patterns
  • Procedural algorithms
David Robbins
+1  A: 

Learn to use as many different languages and frameworks as you practically can. While a lot of the effort will feel wasted ("it's just Lisp with square brackets instead of parens?!"), you'll learn many different approaches for any problem, and this allows you to pick or synthesize the one best suited to whatever environment you're currently working in ("oh, this feels familiar...").

That, and it's fun too. YMMV, but I love having to wrap my brain around new concepts.

+1  A: 

My suggestion would be to learn various ideas on how to solve problems, e.g. divide and conquer or create a data structure with a special property like a heap for HeapSort, as these are what usually will be useful regardless of the language. Even something as simple as "Hello World!" can be useful in getting an initial foot hold into new languages and how they work.

Design patterns are another use of this skill, fwiw.

JB King

You may want to check out Six Essential Language Agnostic Programming Books.

+1  A: 

Learn algorithms