How do top programmers work?

They have a natural library at the back of their head. How top programmers build that library?

Answer by Rose Wiegley:

First, they do NOT do a lot of things:

They do NOT reinvent a wheel. There's lots of new stuff to do and no time to waste redoing what others have done well. If there are libraries, gems, code snippets, examples, etc they will happily use the tools available and spend their time on the new stuff.

They do NOT write code for features they do not need. In other words they keep it simple. When writing something it's common to think "Well some day we may want to do X so I'll go ahead and add Y and Z to this feature in case we need to support it …" If a good programmer doesn't need something now they do not add it. You never know what you will really need in the future. Stuff changes and writing stuff takes time now and support time later.

They also do a lot of things:

They have a mental map/design of the project in their head. Before a drop of code hits the computer a top programmer already has a picture of what it will look like. Just like an artist has imagined their canvas before they have touched the paint a programmer has designed something in their mind. It may be designed in components as they go but they don't start writing blindly with out a mental map.

They are working on the project a lot more often then most people notice. Taking a shower, falling asleep, occasionally driving a car, they are architecting their code in their head. The mental map in the above point is evolving all the time. A good programmer in the middle of thinking out a project in the beginning may have a lot in common with an absent minded professor.

They test their work as they go. Even a genius will make mistakes. In fact I'd argue a top programmer accepts that mistakes are human and works in a manner where they expect them. They test the components as they build the project. They make sure the beam is strong before the building rests its weight on it. Sometimes they will look slower then others but when they are done there will be a solid master piece.

They reference a mental library of experience. Reading and following this or any list will not automatically turn someone into a top programmer. A brilliant mind does not automatically make someone a top programmer. 30 years at the same job will not make someone a top programmer. Top programmers have coded a lot. They have coded in different languages. They have coded on different projects and at different companies. In the back of their head is a natural library of a million things that work and don't work. A million patterns for how things are done in different places. They probably don't realize it but as they work the components they need are built out of this vast experience.