112

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.

7
  • 12
    Experience is all it really boils down to. All the theory you're an expert in is useless unless you can apply it practically. Sep 19, 2012 at 14:09
  • 2
    Implement a compiler for this language. Actually, that's my favourite way of trying out any new language. If it sounds a bit too easy and boring, try defining formal language semantics instead, using K framework or something similar.
    – SK-logic
    Sep 19, 2012 at 14:14
  • 6
    "man, potato is dinossaur, car universe". it doesn't matter how much you master a language, if the code is bad and doesn't make sense, it still hard to understand. Sep 19, 2012 at 14:36
  • 2
    I feel like were missing the point a little. Langauges evolve, so there is no mastery of a language, you grow with it, the more you use it the more you have to learn.
    – nycynik
    Sep 19, 2012 at 18:51
  • 3
    Code and read code. Take a random piece of the linux kernel (C Programming) and figure out what a function does.
    – Alex Hart
    Sep 28, 2012 at 12:08

14 Answers 14

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.

8
  • 77
    +5 for Support the code you write - every bug becomes a tour of your worst decisions!
    – Jennifer S
    Sep 19, 2012 at 15:18
  • 8
    +1 solely for the final sentence: Every technique you use to learn brings and additional perspective to your understanding.
    – Izkata
    Sep 19, 2012 at 18:03
  • 1
    @Izkata: OMG, did I write that? I'm actually a native English speaker! I've corrected it. Thanks! Sep 19, 2012 at 18:48
  • 2
    @GlenPeterson ...Actually, I just copied pasted without paying much attention to the sentence being "off". The +1 was indeed for the intent behind it. =P
    – Izkata
    Sep 19, 2012 at 18:55
  • 14
    +1 for "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." - this is probably the most important. It helps you learn how to learn about programming (i.e. what to look for in what situation).
    – naught101
    Sep 20, 2012 at 1:00
56

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.
3
  • 9
    Great title for a book! I can't wait for the sequel, "Teach Yourself to Program Well in 20 Years!" Sep 19, 2012 at 14:12
  • 18
    However, you do have to make sure you're not repeating the same 10 hours 1000 times...
    – Izkata
    Sep 19, 2012 at 17:01
  • 1
    No amount of technical expertise will help someone know what to automate or create a program for. This is like saying - go to the gym and do every fundamental exercise in basketball for ten years, for 1 hour each day. Poof! You are a basketball superstar (master) ... no, it is more than just technical skill. Therefore, I do not consider this an answer to the question, i.e., how to become a master? This might be a part of the solution, but its not the magic potion for mastership. I know - I am not a master!
    – oemb1905
    Nov 27, 2018 at 0:30
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).

9
  • 1
    Now this is what I call an answer. I have already accepted one but this would deserve a "best answer" if it were a little earlier
    – cprogcr
    Sep 19, 2012 at 16:14
  • 2
    You have no idea how much your answer helped. I'm reading about the books you mentioned and they're the kind of thing I need.
    – cprogcr
    Sep 19, 2012 at 16:18
  • hehe I learned from them. Glad to help :-) Sep 19, 2012 at 16:20
  • since you mentioned C as an example, let me give you the names of two more books, as a gift, which I used to master C like the back of my hand): 1. OOC.PDF(freely available online) and 2. Minix Book(although an OS implementers' book, this is what Linus Torvalds read before implementing Linux) Sep 19, 2012 at 16:31
  • 1
    yeah by Andrew Tenenbaum, that's the book. Any edition is good to read. It doesn't tell you how "C" works, but when you see how the C library is implemented to work with an operating system YOU built, you begin to understand C even better! Maybe enough to let you modify it.(And that's where OOC comes in) Sep 19, 2012 at 16:52
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.

2
  • 1
    When I was in college I would decide that I'd "mastered" a language once I wrote Pong in it. This worked quite well until I learned MIPS. I still have nightmares. Sep 19, 2012 at 22:15
  • Website in C can be done?
    – BigSack
    Sep 1, 2013 at 18:27
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.

9
  • 2
    The true goal is to master your conceptual understanding of a language or languages. Exactly. That's what I really meant.
    – cprogcr
    Sep 19, 2012 at 16:15
  • Any programming language is finite. It is built of a finite number of concepts, requires a finite number of idiomatic tricks. Therefore, it is easy to master any language. Of course, one cannot master programming in general, there is always a potential for a further improvement, but the question is specifically about a given language.
    – SK-logic
    Sep 19, 2012 at 16:40
  • SK-logic: programming languages change, and so do their libraries and environments. As a result the way you work with the language changes as well. For example, jQuery changed the way we work with Javascript.
    – orlp
    Sep 19, 2012 at 20:42
  • It's probably true that no one can really master a language like C++, but for somewhat minimalistic ones like Scheme it should be quite possible — as @SK-logic says, it's really the programming, in whatever language, that cannot be mastered, because the field of applications is infinite. Sep 19, 2012 at 21:01
  • 1
    @nightcracker, languages do not "evolve". C99 will always be C99 and won't ever change. C++11 will always remain C++11, even after it is superseded by a next generation language. Environments do "evolve", yes, but jQuery did not introduce any new techniques not known before to the other languages communities. They were new to the narrow Javascript community only.
    – SK-logic
    Sep 19, 2012 at 22:21
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...

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.

2
  • 1
    Thanks. I had already chose answer by the time I read this but will definitely take your advice.
    – cprogcr
    Sep 19, 2012 at 14:19
  • not sure why down-voted, please let me know what needs to be improved.
    – Yusubov
    Sep 19, 2012 at 15:43
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

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
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!

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.
0
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.

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.