113

I know that learning a language, you can simply buy a book, follow the examples, and whenever possible try the exercises. But what I'm really looking is how to master the language once you've learned it.

Now I know that experience is one major factor, but what about learning the internals of the language, what is the underlying structure, etc.

There are articles out there saying read this book, read that book, make this game and that game. But to me this doesn't mean to master a language. I want to be able to read other people's code and understand it, no matter how hard that is. To understand when to use a function and when another, etc etc.

The list could go on and on but I believe I've made the point. :)

And finally, take whatever language as an example if needed, though best would be if C was taken as an example.

Zelda
  • 2,741
cprogcr
  • 661

14 Answers14

170

I have to answer, "All of the above." People argue about whether coding is an art, a craft, an engineering discipline, or a branch of mathematics, and I think it's fairest to say it's some of each. As such, the more techniques you bring to mastery of the language, the better. Here is a partial list:

  • Use the language all day, every day. Usually this means being full-time employed in the language.

  • Read all you can about the language. Especially, "best practices" and idioms.

  • Join a users group to talk with others about the language and what they do with it.

  • Work with other people's code! There is no faster way to learn what not to do in a language than to have to clean up after someone who did something awful.

  • Support the code you write - every bug becomes a tour of your worst decisions!

  • Study computer science and languages in general

  • Learn a very different language. A great compliment to C would be a functional language like Lisp. This will turn the way you think about your procedural language inside out.

  • Learn to use the frameworks and APIs available for that language.

  • Take the time to do your own experiments with the language. SICP is not applicable to C, but the attitude of learning a language by testing its limits is a very productive one.

  • Read the history of the language to learn why it was made the way it is.

  • Attend conferences to hear the language authors speak, or to hear what industry leaders are doing with the language.

  • Take a class in the language.

  • Teach the language to others (thanks to Bryan Oakley)

In summary, do everything you can think of. There is no way to know everything about most languages. Every learning technique you use brings an additional perspective to your understanding.

GlenPeterson
  • 14,950
55

10,000 hours of practice is what it takes.

Read "Teach Yourself Programming in Ten Years"

Key points from above:

  • Get interested in programming, and do some because it is fun. Make sure that it keeps being enough fun so that you will be willing to put in your ten years/10,000 hours.
  • Program. The best kind of learning is learning by doing.
  • Talk with other programmers; read other programs.
vartec
  • 20,846
39

NEVER consider yourself the master of the whole language until you have implemented a better language than that. Which means, to learn how a particular language works from beneath, get a book that teaches you the compiler/interpreter concepts of the language. For example:

  • C: The LCC Compiler book

  • C++: The Design and Evolution of C++(And then go on build your own C++ compiler or atleast understand the implementation of one using the GNU C++ Compiler code)

  • Java: Get "Inside JVM" and get the javac source code. "java"'s .C code is also helpful

  • Python: CPython implementation.

  • ObjectiveC: Almost any material from Apple about the internals of ObjC runtime env and compiler source codes is going to help you.

  • Lisp: SICP Book (teaches you Scheme and a basic interpreter-compiler for lisp like language) : Lisp in Small Pieces(another good book).

Dason
  • 103
13

Try using the language for something it wasn't intended to be used for. Write a device driver in Python, or a matrix manipulation library in COBOL. I think one of the best ways to master a language is to really push it, trying to make its strengths overcome its weaknesses.

TMN
  • 11,383
11

I'll make it easy on you. You'll never master a language. Period. If you think you have, then you very obviously have not. There's no mountain top you suddenly reach and say "Well, now, I've fully mastered that language. What now?" Even seasoned programmers who've been working with the same language for decades will tell you that sometimes they still run across new ideas, processes, practices, etc. The true goal is to master your conceptual understanding of a language or languages. The ability to learn new concepts and the speed with which you can adopt new or changed features in the language is far more important than rote knowledge of every keyword and syntax. Stop worrying about "mastering" a language, and simply worry about continually improving and refining the quality and efficiency of your code. That's what "masters" do.

Chris Pratt
  • 6,402
6

You already know the answer to this

  • You have to use the language. A lot. To solve as diverse a range of problems as possible
  • You have to read (and, ideally, work with) other peoples code, preferably ones who have a degree of mastery (i.e. a deep understanding of at least some aspect of the language). By extension, if you can talk to people about solving problems with the language then so much the better.

It comes down to hard work and determination and for all that you may never get there.

Think of where we get the term from - to become a Master Craftsman you had to be an apprentice and then a journeyman and only them might you have the chance to become a master. Along the way you would be taught and you would practice and you would observe and question others at their craft and (hopefully) learn from them.

There's no magic bullet...

Murph
  • 7,843
2

There is no substitute for experience. In order to master something, you have to do/use it, at lot, for many different things.

So go ahead and use that language for exercises (like Project Euler) and personal projects, stuff you actually need, or stuff you just think is interesting. Write a game, write a webapp, write a parser, whatever you like. And at every step, strive to understand what you're doing rather than just pasting together code or following instructions.

I want to be able to read other people's code and understand it, no matter how hard that is.

That is something you can do right away once you've understood the basic syntax. Just take some code and take the time to figue it out in detail. Look up stuff you don't understand, or ask specific questions on places like Stack Overflow.

2

Start by reading and understanding what is SDLC (aka, Software development life-cycle) . It is an iterative process that involves self-improvement, learning, **practicing, practicing...**

enter image description here

That would open your horizons on what areas do you need to learn or improve. There are several core software engineering books that you would also find very useful to read once you build couple of applications on your own.

In addition, once you would feel confident with an OOP language, you may start learning design patterns, and Head First Design patterns is really good book to consider. I love this book.

Yusubov
  • 21,498
2

On the high level side of the problem, learn about architecture: how to organize your projects, what's its structure. Don't just let them grow randomly.

On the middle level, learn different techniques and paradigms. The more diverse tools you have in your repertoire, the more power to you. If you only have studied java, python and ruby, you've been exposed just to a very little portion of the programming space. Learn imperative and functional programming, learn prolog and J. The idea is not to "master" hundred languages, but to learn about different ways of solving the same problems.

On the low level side of the problem, one thing that could be help you to be a better programmer (in fact better at whatever you do) is to have a good mental model of the platform. For example, you can learn how C control structures work and know the most common libraries, but if you don't have a mental model of how pointers and memory work, then you'll have troubles with moderately complex expressions.

1

May I make a couple of suggestions?

First if you can find a mentor to discuss your use of the language with, and to get the best tips and tricks, and to answer when one technique is better than another.

Secondly, practice as much as possible and try the language out to the max! I used to work in a team, that would (as a matter of fun) pick out a verb or other piece of the programming language from the manual each day. It was a mark of honour if you could work it into your coding that day. This meant the whole programming team needed to look at and understand the (sometimes) obscure term in order to understand and use it effectively. Some days we failed, but that team was fun to work in and really technically switched on!!

0

Programming languages reflect the ideas behind the programming paradigms that were developed targeting general-purpose software development or for developing special-purpose software. For example, a program language like Java represents the object-oriented program paradigm, but AspectJ (an extension of Java) is used to program according to aspect-oriented programming.

Given this short introduction, in order to really master a language, buying and reading a book by itself wouldn't be much helpful. You'd need to understand the environment in which you can program using the desired language, learn about the paradigm, and more importantly build a meaningful application using the language. Building a small application that can give you a taste of various tools provided by the language is a really helpful learning approach.

I have seen people coming from the pure C community without learning anything about object-orientation and struggle in learning Java or objective-c. I also have seen people struggle with programming user interfaces when they haven't really gone through understanding of user interface elements, event-driven programming, etc...

I hope this helps!

hsnm
  • 117
0

I would add two items to Glen's list

  • Try to solved hard problem that others have e.g. give answers on SO
  • Read language designers blogs/book. That's the best resource of deep knowledge. You would know what's the design decision behind reason X.
Lukasz Madon
  • 1,496
  • 13
  • 22
0

To build on what @TMN said. I've had great success in learning languages by writing the same program in a different language.

For example writing a program that reads in a CSV file, parses the text and then writes it back to a second CSV with the columns in reverse order.

Like this,

Column1,Column2,Column3

to

Column3,Column2,Column1

This will get you a basic understanding or the language. Then see what else you can do. Maybe allow for value substitution or reordering or reading from the command-line. Make it as complex as you want.

Also I think what @GlenPeterson said about,

Learn a very different language. A great compliment to C would be a functional language like Lisp. This will turn the way you think about your procedural language inside out.

Is a great Idea. I'd suggest a language like Haskell because in the latest versions you can program using all four programming paradigms of OO, procedural, logical or functional. Even though it's actually a functional language you can with some effort implement the other paradigms which would be a good learning experience.

Great language to play around with.

Dan
  • 155
0

You cant learn a language from the book. All you need is practice and practice . Don't think You can learn a language from that particular book or that particular source .Just think programming language is same as human language .You cant simply learn English or French by reading a particular book.All you need is using it in day to day life. Code from scratch , extend its functionality try to build something that will make you little bit satisfied.And if you are thinking mastering a language as knowing whole language and using each element of programming language in practical coding ..YOU CAN'T. Or even if you can it might take 10-15 years.

sumit
  • 1