Take the 2-minute tour ×

I understand that this question could be answered with a simple sentence and that it may be viewed as subjective, however, I am a young student who is interested in pursuing a career in programming and wondered how long it took some of you to get to the level of experience you are now?.

I ask this because I am currently working on building an application in Java on the Android platform and it bothers me that I am constantly having to look up how to write a certain section of code in my application such as writing to a database, or how the if statement should be structured.

My question really is, how long did it take for you to become experienced enough to actually know exactly how your next line of code was going to look, before you even wrote it?

share|improve this question

closed as primarily opinion-based by Chris, zero323, Eat Å Peach, Pragnesh Chauhan, B... Nov 20 '13 at 4:12


"should" is a terrible concept. You may never be able to type code "from memory" and you may still be a great programmer. Using "should" tends to bias your thinking that there's a goal out there and you're not at that goal. Be very, very careful of imposing "shoulds" on yourself. –  S.Lott Mar 25 '10 at 20:39
I recommend you use a good IDE like Eclipse and keep the Java and Android API reference pages open in a browser. You'll come to find that nothing improves your speed quite like just keeping your references open and bookmarked (paper or electronic). –  Tim Bender Mar 25 '10 at 21:02
There is no such thing as an "if loop"... –  fredoverflow Mar 25 '10 at 23:33
Practice! Lots of it! –  Thorbjørn Ravn Andersen Mar 26 '10 at 3:13
I have to look up the Python string formatting syntax every single time. Doesn't help that there are (at least) two different built in methods, which use various combinations of $, %, {} and () –  kibibu Mar 26 '10 at 5:44

27 Answers 27

up vote 32 down vote accepted

I have been a C++ programmer for the last 20 years. It has taken me that long to get to this expertise level. I'm mostly a Windows programmer, and I keep the msdn website up on one of my monitors all the time.

Doesn't matter how long you've been doing it. You will never know everything from memory. Don't sweat it.

share|improve this answer
Sweat it when you get to an interview and the prospective employer expects you to have some things in memory though. :P –  robault Mar 25 '10 at 20:24
Yeah, but any employer that holds it against me when I don't remember the function parameters for some WINAPI function is an employer I don't want to work with. –  John Dibling Mar 25 '10 at 20:33
Although I used to feel the same way about having the Javadocs site up, Eclipse sort of eliminated that. I occasionally have to reference the docs, but 99% of the time what I need to know is a ctrl-space away. I'd assumed MS tools would have copied this by now. –  Bill K Mar 25 '10 at 21:05
The MS tools have IntelliSense, which does the same thing. truth be told, I use Intellisense -- when it works! -- most of the time and only go to the docs now & then. –  John Dibling Mar 25 '10 at 21:32
There's a big difference between parsing C++ code and Java code though. An intellisense that has to deal with the fact that you can have the word const in 5 different places on the same line of code can't work as well as one that has a "tight" syntax. –  Patrick Mar 25 '10 at 21:51

The speed at which you can quickly recall language syntax, common library functions, and best practice patterns is directly proportional to the amount of time you spend using them.

In other words you will find yourself getting faster the more you do it.

share|improve this answer
Strongly agree with this. Throw in how recently you used that syntax/library/pattern. I started writing C/C++ in notepad and could write complete and correct solutions to my intro classes. After doing Java for 5 years, I definitely couldn't write a C++ Template from memory. But show me a reference or sample and I know it instantly! –  Tim Bender Mar 25 '10 at 20:59
Following along to Tim's comment, even when I haven't used a language in years, I find I can read it still and understand what's going on. The everyday knowledge that would allow me to type it in and create something is rusty because it isn't fresh, but recognizing and reading seems to always be there. –  the Tin Man Mar 25 '10 at 21:40
I find I can read and understand what's going on in any reasonably-designed language, even if I've never seen it before. Experience generalizes, and most modern languages are built very similarly. (There's a reason nobody but Apple uses ObjC--the syntax is needlessly unconventional. I can't begin to guess why Apple uses it.) –  Glenn Maynard Mar 26 '10 at 6:55

I've been programing for almost half of my life and I sill can't always recall simple syntax, let alone entire tracks of code for more complex tasks. If you ask me that's what reference books and Google are for.

A far more important skill to have is the general knowledge of programming in any language, i.e. recursion, looping, object oriented design, working with APIs, error handling etc... Once you have all that down, you can apply it to any language and platform.

share|improve this answer
And Intellisense! –  Igby Largeman Mar 25 '10 at 20:15
Yep, the basics of design and logic will get you anywhere. It can take a long time to learn all of that, a whole career for some. –  robault Mar 25 '10 at 20:21
@robault: unfortunately there are some for whom an entire career is even close to enough... –  Jerry Coffin Mar 25 '10 at 20:41
Being able to recall simple syntax is a pretty fundamental skill. References are for the uncommon stuff. –  Glenn Maynard Mar 26 '10 at 7:10

I can tell you that after 25 years there are lines of code that I don't know how they're exactly going to look like.

Want an example? I'm programming in Java since last century and I can honestly still make a mistake if I were to type hashcode() or hashCode().

Why? Because actually typing such a method name yourself is so last century. Your intention is to override Object's hashCode() method, so you use programming by intention.

You hit Ctrl-O then h and you get a list of the methods starting with an 'h' that you can override. Then you hit enter. As a bonus, the "@Override" gets inserted for you too.

4 keys. 4, to get this:

    public int hashCode() {


And honestly, whether hashCode takes an uppercase 'c' or not... I couldn't care less. This is not what an hashcode is about and my intention is not to know all the inconsistencies languages and API designers came up with. My intention is to override the method that gives back an object's hashcode and my (modern) IDE allows me to get that skeleton in four keypresses, including hitting enter.

Another example: there are people who do really type this countless times a day:



or the more tricky:

for (int i = ; i >= 0; i--) {


Note in that latter case I can still mess up and type "i++" instead of "i--" (a 'thinko' as its called).

But I don't care at all, because I type "fi<tab>" (three keys) and I get the first one or "fir<tab>" (four keys, "for i (in) reverse") and I get the second one. You ain't beating that (especially seen that I'm a touch typist so I type these three or four keys fast). In addition to speed, as an added bonus the autocompletion won't mess you "i--".

In many case I don't know exactly the line I'll get: sure, I know it "more or less" and that's exactly the way it should be.

share|improve this answer
Totally agree. Let the IDE do the majority of the work. Spend time on learning general concepts (OOP, recursion etc) and specific technologies (libraries, frameworks, systems, tools etc) instead. –  Rickard von Essen Mar 25 '10 at 21:02

Don't sweat it too much. As others have mentioned it eventually gets easier to write code without looking things up so much as you work with a particular language over time.

HOWEVER There are a few reasons that even veteran programmers find themselves constantly using reference material:

(1) Unlike days of yore, most projects now require you to use a number of languages to get the job done. For example single web site-project a web-site may require C#, XML, JavaScript, SQL, HTML, XHTML, RegEx and CSS all in the same project. Switching between some of these languages can really throw you for a loop sometimes because many of them are just similar enough to be familiar, but just different enough to make you forget the subtle differences in syntax.

(2) Just when you start getting comfortable that you know a language inside and out, the vendor will release a new update that changes everything you knew about it. For example ASP->ASP.NET.

I still look up simple things fairly frequently and I've been at this almost 20 years. The important thing is that you understand the underlying concepts and principles.

share|improve this answer
Yeah, recently I was working on VBA and kept putting semicolons at the end of everything. So used to C#... –  robault Mar 25 '10 at 20:28
VB/C# transitions are the worst. I go back and forth all day and I am always getting the variable declarations wrong (Dim X as string vs string x) –  JohnFx Mar 25 '10 at 20:34
After about 30 years of programming I think remembering we've seen something on a subject and then finding it quickly and implementing it is a real strength. I can't remember everything, though I have a photographic memory, but I can remember reading it and what the page looked like and a quick search or two will bring it up, and I'm off coding again. –  the Tin Man Mar 25 '10 at 21:48
Good point. One of the major differences I've seen between beginner programmers and experts is that when the experts need to look something up they know the right term to type into Google. Photographic memory helps too. Unfortunately I only have fax memory, it's all there but it is a little fuzzy. –  JohnFx Mar 25 '10 at 23:45
@JohnFX, loved the fax memory. That was new :) –  Thorbjørn Ravn Andersen Mar 26 '10 at 3:16

It took me 12 years to get where I am at today, which is my experience in professional programming. You will always improve when working with some programming language, even if you have been working with it for the past 5 years.

About your question, it depends. I think that you should be comfortable with the syntax after a week, comfortable with the main libraries after a month, and comfortable with the platform after 6 months.

But when you get there, don't stop!

share|improve this answer
That time line seems reasonable to me now that I've been developing for 5 years. I couldn't imagine doing it that fast my first couple of years though. –  robault Mar 25 '10 at 20:22

If you code every day with the same language, you'll probably have the common language elements and patterns memorized in a month or two. But there are plenty of things that you'll probably never memorize, simply because you don't use them often enough, and also because modern IDE's can help you so much that you don't really need to remember everything if you utilize all their features (like code snippets, shortcuts, intellisense).

I've been coding for 15 years, and doing C# for the last three, and I still use the MSDN reference material every day. However, as far as the basic building blocks of the language are concerned, I had them memorized in the first month or two.

Also, the more often you code, the better you'll commit it to memory.

share|improve this answer
Basic building blocks like operators, syntax and types? –  robault Mar 25 '10 at 20:25
@robault: Yes, and also the most frequently used elements of the libraries that come with the language (e.g. collections in C#). –  Igby Largeman Mar 25 '10 at 21:45

There's a false assumption going on here I think...

At my job I end up working all over the stack in different languages and platforms. If I'm away from a project for 6 months I end up having to look at code to get even basic things done. The advantage of experience is reducing the re-ramp up time on productivity though.

So, instead of it taking weeks or months to get back to a point where I can write 80% of the code from memory it takes a few or several days (if that sometimes). I've been programming for about 5 years now. I'm just now getting to the point of being able to visualize small applications in their entirety.

As long as you're working on solving a problem that you haven't already solved (numerous times) you'll probably always have to look up code.

If it can be done I'm guessing it takes longer than 5 years for most people, unless they work in one language with one editor and in one area. (ex: C#, Visual Studio, file system operations) My company isn't big enough to employee someone that specific.

share|improve this answer

Don't be downhearted by having to consult documentation all the time man, that's what it's there for. Over time you get used to syntax and things like that but don't sweat it if you can't remember library methods or ways to connect to a DB.

Over time (with experience) you might remember these off the top of your head but in reality there's nothing wrong with taking a quick consultation of the documentation to refresh the memory.

Also remember that technology is ever changing so it's good to keep the mind fresh with new ways of thinking/ways to do things.

share|improve this answer

Question is not 100% clear. One of the best programmers I know doesn't remember anything and needs to look up printf formatting strings almost daily. On the other hand if you are having hard time figuring out how to write that for (int i = 0; i < len; i++) loop after doing this for 6 months -- that doesn't sound right.

share|improve this answer

the idea that one could every bit of code from even a single language and then type plainly from memory is pretty far out. the amount of pre-defined functions for, say PHP or Java alone is immense.

but that being said, its important to learn the programming structures, and know them the best you can. structures like foreach, if then else, switch, etc. are really the things that need to be integrated thoroughly. also, conceptual things like Object Orientation (not just "using" objects like mysqli, but understanding things like controlling code, client code, bottom-up and top-down architecture) are the real things that make good programmers great. for myself, i know that i have not the capacity to learn every defined function thats provided by language writers so i instead learn whether or not it can be done(and of course still try on occasion to do things that cant be done, lol). if you know that, then its a matter of google and books to find the "specific" mechanisms on how.

cheers my friend.

share|improve this answer

Not an answer per se, but I just wanted to say that as a novice myself, this q&a is one of the most useful things I've read on SO. It seems that yes, experts can probably code the basic stuff from memory, but even they revert to book for complex problems, and for beginners, that's what the book is for.

I feel like I'm just beginning

share|improve this answer

You should use code snippet if you are using certain piece of code repeatedly. I doesn't bother me if I cannot remember some piece of code from memory.

share|improve this answer
Right, it is not necessary at all. –  javaguy May 4 '10 at 20:47

For me, it depends heavily on what I'm writing. For example, I doubt that most people ever quite memorize all the parameters to some Windows functions. I may know that I need to call CreateFile on the next line, but don't know all the parameters in order until they're typed in (with help from Intellisense, and sometimes MSDN).

With something that's doing simple computation, I'm a lot more likely to be limited by my typing speed (but I'm a fairly poor typist, so thinking faster than I can type doesn't take much).

That means it's really a question of how much of the time you need to refer to something to type the next line of code -- at first, it's a pretty small percentage, and over time it grows. I doubt it ever gets to 100% for anybody though. I, for one, don't think I'd want it to -- that would indicate I wasn't working on new and different things...

share|improve this answer
Yep, if you're not looking it up, you're probably not growing. –  robault Mar 25 '10 at 20:31

If you use eclipse and java, you may find yourself already there.

Other combinations may be a little slower to a lot slower.

Java has the advantage that it's pretty easy for the environment to build an entire parse tree while you are typing. At any place in your code, typing ctrl-space can give you an entire list of valid options.

Also syntax errors are always underlined.

If you want to go hard core though, I started in C before the day of decent editors and it took me about a year before I typed in more than a few lines and didn't get a compile error.

share|improve this answer
Eclipse will do the job for other things than just Java. I use it for C and Python (PyDev package) in exactly the same way and it works fine for me. The PyDev package could use some debugging though... –  inspectorG4dget Mar 25 '10 at 21:00
It's impossible to resolve either C or Python 100% at runtime, but they kind of work. Python can't resolve everything because it's dynamic and dynamic languages cannot be resolved statically (Although I understand I may be wrong about this with regard to Scala). C because is essentially pointless since everything is untyped. (In java, when a method takes a Frame, it can tell you exactly which frame objects are available to you at that point in time. In C it would just give you every pointer which would be--umm--pointless, or only pointers to struct frame which might not be complete) –  Bill K Mar 25 '10 at 22:04

I don't know about memorization. Repetition is mother of all learning and that applies to all aspects of life. Look at the experienced accountant vs. the novice when filing taxes, who looks up stuff more. But what I did discover recently is that I navigate documentations much quicker and have a sense for going directly to where my question is answered. I got 6h sense - I can see the code! Seriously, it all comes with experience. Still, when learning something completely new, there's no shame in looking up how to do certain things. That's what separates humans right, learning from others. The more you work on something, the better you become.

share|improve this answer
Good point about the 6th sense; I have that too. "Knowing" what the code does, without thinking about it consciously; but also the other way; thinking about a concept, and "knowing" the code. –  Pindatjuh Mar 25 '10 at 21:02

There is absolutely nothing wrong with having to lookup the documentation every time you want to write some code. I got lucky in that once I use a certain function, I don't forget it very easily. However, most of the time, especially when I'm coding in a language that I haven't used in a while,

  1. I start out by writing a flowchart of the algorithm that I want to code - just the pure logic. The most important reason for doing this is so that I don't lose my train of thought and forget the algorithm that solves my problem in the midst of technical problems like syntax and < what library functions exist? >
  2. Then I look at the documentation and check to see if there are simple function calls that will help me accomplish each task in my algorithm
  3. If such functions do not exist, then I either modify my algorithm to accommodate for what functions the language does provide or write helper functions do fill in the gaps.
  4. I only start coding NOW, which is not too difficult to do anymore, because I already have all the relevant functions written down. So now it's just a question of translating pure logic into syntactically accurate code.

Proper syntax usually does not elude me, but if that does happen (VERY rare), Google provides very nice code snippets if you ask nicely.

Hope this helps

May the Force be with you

share|improve this answer

I'm programming Java now for about 5 years, and I never have had any trouble remembering syntax. I can <brag>write almost all java.util.*, java.io.*, java.lang.* and javax.swing.* stuff out of my memory</brag>, but does it help me? Not very much. It doesn't make me a better programmer than someone who can't!

I'm using Netbeans, which greatly helps working with libraries. Also, the documentation, just in the place where you need it. Sometimes, it's quite unnecessary, but sometimes you'd wish the "auto complete" screen would popup faster!

The best thing as a student is to concentrate on what you are doing, not how fast you are doing it. Looking up things isn't bad; as it'll help your so-called "unconsciousness mind" process what you are really trying to accomplish. Having such breaks, e.g. by looking up a certain documentation or syntax reference, may even let you be better at programming (no proof for this, though).

Question is quite subjective.

share|improve this answer

With the great many IDE's available and the "newbie" tutorials on getting started, it won't take you long before you're off writing your own apps.

That said, unless you have a "thirst" for how stuff works kinda attitude all the time towards everything, you won't go far. In this field, you really have to have a passion for what you do to be great.

share|improve this answer

... It bothers me that I am continually having to look things up... How long did it take you to get to the level where you are now?

For me, and for most of the students I teach, the answer depends on two variables:

  • How many lines of code have I written?
  • Do I use the language or library every day?

(Reading other people's code is very helpful for learning a language and learning how to think in a language, but for me at least, it hasn't helped me become a fluent writer of programs in a language. Only writing code does that.) So my first comment is that time should be measured in lines of code written, not hours or years. (Ray Bradbury once advised aspiring writers of fiction to write a thousand words a day six days a week, and after they've written a million words they might start to know something about their craft. This is good advice for programmers too.)

As for my own experience, across a half dozen languages that I currently know well or once knew well, it's been pretty consistent for me that

  • After writing 100 lines I am continually looking things up in the manual and don't really know what I am doing.
  • After writing 1,000 lines I use the manual occasionally and am starting to learn how to think in the language.
  • After writing 10,000 lines I am about as good as I'm going to get without making special efforts.
  • After writing 25,000 lines I probably will not need the manual again.

It's also true that

  • To learn to write 100 lines I had to read 100 to 1,000 lines that someone else wrote.
  • For the first 1,000 lines I write it is good for me to read 2,000 lines someone else wrote. For the next 1,000 lines it is good for me to read 1,000 lines someone else wrote.
  • After I've written 5,000 lines I learn the most by reading code written by world experts or by people who designed the language and understand what is there. I no longer have much to learn by reading just any program.

On the other hand, my experience about when I stop having to refer continually to the documentation is much less consistent. I find it especially hard when two languages are very similar; I will never stop needing the ksh manual to tell me what is different from sh or bash, and I will never stop needing the Haskell manual to tell me what is different from Standard ML (though the need grows less with each additional 1,000 lines of Haskell that I write). I also find it interesting that while I have written over 35,000 lines of Lua code, and I will never need the manual again for a language question, I have to look up libraries and API functions almost every time I write something longer than 500 lines. (I've written a lot of short Lua programs and a couple of long ones, and I don't use the language every day, although I definitely use it at least several days each month.)

As for the unspoken question, when are you personally going to get better?, take some advice from Watts Humphrey: measure your own performance and track it over time. I think if each day you count the number of times you had to stop and look things up, and graph that against number of lines of code written or edited (which you can get from source-code control), you will be pleasantly surprised by objective evidence of improvement. And I think once you have such evidence, you will be able to focus more on continuing to improve, and not so much on where you are now or where you hope to be in a year.

share|improve this answer
You may have learned the language syntax, but I do not think you can learn the whole JRE by writing 5000 lines of code. –  Thorbjørn Ravn Andersen Mar 26 '10 at 8:35
Nobody can learn the whole JRE, no matter how much code they write. Just like the bloody Haskell library. –  Norman Ramsey Mar 26 '10 at 17:57

It's true that after some years of programming you'll be able to remember a lot of thing without having to check the "manual". For me this is not an important milestone in your programming life though, the really important moment is when you reach the point where you don't know how to do something... but you're sure that can be done and you know where and how to research about it :-)

You made a very important step participating on this site. Exchanging ideas and helping each other it's a excellent way of learning.

share|improve this answer

Sociologist Malcolm Gladwell believes that ten thousand hours is a good benchmark for the amount of practice required to become world class at many fields of endeavour. I think that sort of number applies to programming as well. This isn't quite what you asked, though; being able to code competently certainly requires familiarity with your environment (language constructs, system libraries, third party libraries and perhaps something of the concepts underpinning them), but there are many soft skills involved which are harder to describe and can only really be acquired through practice.

As others have said, being good at programming is not about typing code from memory; it's about recognising patterns, understanding systems, solving problems. It's about choosing the right tools for the job (languages, libraries, algorithms, whatever) and being able to make proper use of them. In all the jobs I've had, it's about adaptibility and flexibility; you might have to learn a new language or pick up somebody else's poorly documented code tomorrow, and a good programmer will be able to take this in their stride.

share|improve this answer

I've been coding professionally for nearly 10 years now; there's all sorts of code I use semi-regularly which I look up the options for at least some of the time. There are too many commands with too many options in too many languages for me to remember each and every last one in detail and Google is quite good enough at getting the information I want.

That said - there are some bits of routine code which I use all the time but can count on one hand the number of times I've written - the exact syntax for populating a dataset in .Net for example. One of the skills I've most come to value over this time and which saves me the most time is spotting when some code can be quickly and easily moved into utility libraries. If it's fiddly but routine, consider this approach to save yourself hassle and improve your overall code quality.

share|improve this answer

In the context of this question ; java, c++, javascript the languages are still evolving. I can't say about other languages.

  • The language standard/specification changes over time
  • Libraries are added to supplement the language constructs e.g Boost, Google Collections, Apache Commons, jQuery
  • Applications will rarely be bound to a single aspect of a language
  • Across organizations/projects, coding standards change
    • A project I worked upon recommended against using primitives
  • When unfamiliar with the constructs used, I put in pseudo-code flagged with //TODO first .. then go in and find the actual API to use.

IMO, the answer to your question is - there is no definite answer.

share|improve this answer

As a Java programmer the sheer size of the runtime library makes it impossible to remember everything. Swing is big, there is an XSLT engine (which contains TWO languages), the Concurrent support evolves and grows.

The direct access to the Javadoc API from within Eclipse combined with code completion makes it possible to find the information you cannot remember but you know is there, quickly and efficiently.

I have found the javaalmanac.com (which has been reworked into the more convoluted http://www.exampledepot.com/egs/index.html) invaluable in presenting short, concise and above all correct programs doing just one small thing. Strongly recommended.

share|improve this answer

Most weeks I program in Java, C#, Python, PHP, JavaScript, SQL, Smarty, Django Templating and occasionally C++ and Objective C. I'm a student so this is partially school work and partially my part-time job. Instead of learning syntax I've learned what concepts to look for.

Seeing patterns and concepts is key, once you know the concepts and what to look for the syntax is secondary.

I find that even when I am just being exposed to a language I can accomplish a lot just by looking for 'what ought to be there'

share|improve this answer

Why should you be able to remember all of this stuff? Personally I embrace the fact that I can't remember all of this stuff and simply try and remember where to find the information that I need. I find that much more useful. This takes the form of blogging, taking notes, keeping large amounts of 'sample' code and reusable libraries and writing about code that I find useful and interesting; oh and lots of books, some of which I hardly ever 'need' and some of which I hardly ever really read but they've been skimmed and I know where they live.

Technologies come and go and there's just no way I could have kept all of the things that I may one day find useful in my head; so I page them out and just keep the index in memory... For example; 9 years ago I was doing some stuff with Java and CORBA and whatever. There's no way that I could drop back into that now without the notes that I wrote up for my website back when I was doing it: http://www.lenholgate.com/blog/2001/02/corba---enumeration.html. Likewise I have code that I use on a daily basis that has been kicking around since 1997 or earlier. I don't remember how to type it in, I have it in a file with tests (if I'm lucky) and docs (if I'm even luckier).

Whilst I realise that most of what I'm talking about is 'big stuff' I also often have to go and look at some of my old code to simply work out how to structure a typedef...

Of course the day to day stuff will come with time and practice; but you need to work out that you have to page some of it out in a form that you can reload later very quickly. Embrace the fact that your memory is never going to be able to hold it all and outsource it :)

share|improve this answer
You should remember this stuff because every time you pause to look something up, it interrupts your _thinking about the problem you are trying to solve_. You want to avoid interruptions and spend as much time as possible thinking about problems. This means you want to know the language and API stuff you use every day, for much the same reason that a really good programmers puts in the time and effort to learn how to type fast. –  Norman Ramsey Mar 26 '10 at 1:39
Of course you need to know the stuff you use every day but you ALSO need to know the stuff you used 10 years ago and the ONLY way to do that when technology changes as often as it does in our industry is to accept that you can't know everything and embrace the fact that you MUST make notes, write stuff up, keep stuff as working examples and whatever. Also, IMHO typing fast is overrated; programmers need to know how to think deeply about the problems they're solving. Typing fast just means you rush in and make mistakes quicker - and yes, I can type plenty fast enough... ;) –  Len Holgate Mar 26 '10 at 5:32
