By Fatos Morina May 3, 2017

Learn Programming Like Einstein Learned Physics

Einstein was a genius and one of the greatest scientists ever to live. In 1905, he published four scientific articles that laid the foundation of modern physics, changing views on space, time, mass, and energy. After making his name with these four articles, he went on to win a Nobel Prize in 1921 for his explanation of the phenomenon known as the photoelectric effect.

We can all learn from Einstein’s life, especially his ways of working and learning. Even though we may not all be a genius of Einstein’s calibre, there are still some patterns that can be emulated across multiple fields of study, especially in software development. Success leaves clues, and reveals how we can learn from anyone. People like Michael Jordan, or Arnold Schwarzenegger are not software developers, but their deliberate practice and attitudes represent some replicable patterns that can be implemented both by software developers, and people from other professions as well.

People who are the best of the best at what they do are usually differentiated by their unusual habits, like focusing on the right things, and obsessively practicing their craft when nobody else is watching. They not only outwork their peers and other people outside their peer group, they also work more efficiently, and consider learning as a way of life. As the world’s most famous performance coach, Tony Robbins, says, “I think if you’re hungry to learn, you’re hungry to grow, you’re hungry to master things. If you won’t settle for less than you can be or do, then you can outstrip anybody else.”

Learning how to learn

Einstein is reported to have said “insanity is doing the same thing over and over again and expecting different results.” If you want to achieve different results, you need to do different things from what other people are doing. When you learn like others, you are going to get the same results they do. You need to be willing to go deep into a subject and learn things differently in order to be like Einstein.

A few decades ago, a physics student achieved an otherwise perfect score on an exam, but the professor graded him poorly on a question that asked how to measure the height of a building using a barometer.

The student wrote, “Go to the top of the building. Drop the barometer and count the seconds until it smashes on the sidewalk below. Then use the formula for acceleration by gravity to determine the height of the building.”

The expected answer was to use air pressure as a tool for measuring height, having referenced a barometer. When the student argued that he had come up with a correct solution in a slightly unconventional way, the professor made a deal with the student: if the student could correctly answer the same question using yet another approach, the professor would give him full marks for the question.

The student immediately came up with another response. He said that he would use the barometer to bang on the door of the building’s landlord. When the landlord opened the door, he would ask, “How tall is this building?”

The professor challenged the student to come up with another way of answering the question, so the student recommended tying a long string to the barometer and measuring the length of the string from the top of the building. Or swinging the string as a pendulum and inferring the height by the motion it creates.

The professor recognized that all of these answers from different angles were correct and awarded the student full marks.

According to the book Learn More, Study Less, this young student was Niels Bohr, who won a Nobel Prize in Physics in 1922 for discovering the nature of electrons inside atoms. But he did not learn all these approaches by simply attending his physics lectures.

You have to be really passionate about something to go to that deep level of learning, understanding the topic and coming up with so many answers for the same question. Moreover, you also have to learn differently than most other people.

Most students study for an exam because they want to get a good grade. They do not learn more than what will be covered by the final exam, let alone spend more time studying something related to the subject after finals.

Similarly, a lot of software developers tend to use Google to solve a problem, so that they can fix a bug as quickly as possible. Their main concern is appearing to be productive in front of their managers. They do not spend time understanding the solution at a deeper level or figuring out the most efficient way to solve a problem. They are satisfied enough that the task got closed in Jira.

Of course, there may be cases when you are under pressure and you have to fix a critical bug fast, as the deadline is approaching quickly. Nonetheless, you should not let those few cases divert you from continual learning.

John Sonmez, who currently charges 1000 dollars per hour for his consulting sessions, is an example of a software developer who mentions his ability to learn as the key to his success. He admits that he is not naturally good at many things, but he is really good at learning.

Now that we know how learning is critical to one’s success, let’s see how we can become better software developers by learning better.

1. Learn the fundamentals of computer science

According to the biography of Albert Einstein written by Walter Isaacson, before Einstein was 15, he had mastered differential and integral calculus because he considered mathematics as a way to understand nature. These fundamental concepts later on turned out to be useful in his work in the field of physics.

Most people tend to avoid learning the fundamentals, as they may not see the fruits of their work in the short-term. It is more satisfying to tell others that you have your application ready to be downloaded in Play Store rather than informing them that you are still focusing on the basics.

Be different than those people. Learn the fundamentals of computer science — more specifically, data structures and algorithms —and learn them really well. You have to become capable of implementing some of the most commonly used algorithms and data structures yourself without using a textbook.

When you finally understand them at a deep level, you will have gained the ability to solve real-world problems in software development in an intuitive way, which can be a much faster and more efficient approach.

As Isaacson mentions, Einstein believed that “intuition is nothing but the outcome of earlier intellectual experience.” In software development, that prior intellectual experience requires a solid grounding in the basics.

As Linux kernel developer Linus Torvalds puts it, “I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships.

Large tech companies such as Microsoft, Google, or Amazon recruit new software developers by challenging them with hard technical interviews that mostly revolve around fundamental concepts.

In other words, no matter what type of programming language you use, your code is just the way to express the algorithms and the data structures beneath the surface.

2. Learn by solving problems, not just passively watching tutorials

Einstein often skipped classes in college. Isaacson quotes him as saying, “I played hooky a lot and studied the masters of theoretical physics with a holy zeal at home.” He was not interested, nor compelled, to attend his lectures. He found something more engaging and fulfilling—he used his time to focus on solving hard problems and obsessively playing with ideas and equations on his own.

There are a lot of books and tutorials that can teach you programming. But they often only give you a shallow introduction to new concepts, whereas the deeper understanding and learning is done while solving real-world problems using those concepts.

Don’t fall under the false impression that you have learned something by passively watching someone rapidly developing a web application. Don’t pretend that you understand something when you haven’t truly learned it yet. As Einstein wrote, “Any man who reads too much and uses his own brain too little falls into lazy habits of thinking.”

Instead, you should be actively engaged in solving problems in order to learn new concepts. You may find technical problems that can test your understanding of the fundamentals from online judges such as LeetCode, Codility, HackerRank, CodeChef, CodeForces, etc.

You can also contribute to open source projects in GitHub through fixing bugs or optimizing existing functionalities with more efficient implementations. Working on other people’s projects can help you learn from their implementations and approaches and challenge you to come up with new solutions. This kind of work actively engages your brain as you find new approaches to existing solutions, which as a result help you learn and retain the information in the long term.

If you already have a full-time position, or even if you are an independent contractor, you should constantly be seeking challenging tasks for your current level of experience. Don’t be afraid to ask your project manager to assign them to you. Instead of shying away from these opportunities, be enthusiastic and feel the privilege of getting paid for learning to do something that you did not know before. As Einstein said, “Intellectual growth should commence at birth and cease only at death.”

Moreover, don’t hesitate to start a side project. You do not have to wait for five years to pass before you build your own application. You can start developing a small application and plan to scale it further as you learn more.

Publish your source code on GitHub, and try asking for feedback from other programmers by contacting them via email or in programming communities.

3. Improve your understanding by writing tests

Einstein’s Uncle Jakob challenged his nephew to prove Pythagoras’s Theorem at an early age. “After much effort, I succeeded in ‘proving’ this theorem on the basis of the similarity of triangles,” Einstein recalled.

Einstein put a lot of hard work into building his understanding through doing proofs. As a result, he was not only able to learn things holistically, but he also got confident enough to try other things on his own.

Proving theorems is analogous to writing tests in programming: You need to prove that a feature of a website is really working by coming up with test cases, and then expect a particular functionality to be performed or an output to be produced by the source code. Tests are an alternative approach to learning something new, as they take more time and effort than passively watching a tutorial.

Some new developers are afraid to enter into the realm of testing, but it represents one of the most effective ways of understanding the flow of execution and functionalities of a piece of software. It can be especially helpful for people who are new at a project and want to learn the structure and workings of it.

If you want to learn how a particular open source framework works, you can improve your grasp of it by writing tests. This way, you will not only understand that framework a lot better, but your tests can contribute to the project as well.

In cases where you are working on a large project and something is unclear to you, you can break the execution flow down into several components and write tests for each one of them.

Writing tests will not only help your understanding, but it will also allow you to find potential bugs, and as a result contribute to the project overall.

4. Concentrate deeply

We live in an age of too many distractions. From the moment we wake up in the morning, we reach for our phone. Check texts. Read emails. On average, a person is engaged in 76 separate phone sessions per day.

Obviously, Einstein didn’t have a cell phone, but he had his own types of distractions and had ways of dealing with them that we can learn from. His son reported that “Even the loudest baby crying didn’t seem to disturb Father,” adding, “He could go on with his work completely impervious to noise.”

His ability to concentrate deeply and work for long periods of time without interruption helped him achieve historical breakthroughs. “I was able to do a full day’s work in only two or three hours. The remaining part of the day, I would work out my own ideas,” says Einstein of managing his time at his intellectually unstimulating job at the Bern patent office, which gave him time to focus on more challenging engagements.

Software developers can learn from Einstein and practice blocking off distractions. Don’t pretend you are able to focus with the same level of intensity after countless sessions ‘just checking’ Facebook messages!

Tim Ferriss, author of the best-selling book, Tool of Titans, writes how “Single tasking is a super power.” He adds, “In a digital economy, where distraction is a currency, if you can focus on one thing for three to five hours at a time and block out all the distractions, you have a huge leg up, you are able to do deep work and connect dots that are unconnected.”

Try making a compromise with your manager about setting aside certain portions of the day for communication, and invest the other parts in valuable and cognitively demanding endeavors, such as learning new concepts or technologies and writing code.

When we are able to distance ourselves from those interruptions and apply good time management skills, we increase the chances of diving deeper into our learning, and as a result, we become a lot more productive.

5. Be curious and love learning

Software development is one of the most in-demand professions of our time. There are constantly new job openings, which attract both youngsters and already-employed people from a wide range of professions. They know that you can get a really good salary working as a software developer, and consequently they start their careers with great ambitions.

Even if you get a job in software development, however, you can only become great if you love learning and programming. It is one of the few professions in which you constantly have to learn something new.

It’s not just the existing concepts you need to know. You have to adapt to the constant invention of new technologies and programming languages. You have to adapt to the changes in the market and learn whatever new things are currently considered as valuable.

You will have to consistently learn a lot. In order to keep your brain constantly engaged in learning, you will have to be curious and stay humble.

Often, programmers get employed on the basis of their existing knowledge and start to think they don’t need to learn new things anymore. However, you will only be able to excel as a software developer if you are curious and love learning, as the need to learn never ceases.

On November 1915, after writing only two pages of what he referred to as “one of the most beautiful works of my life”, Einstein sent his 11-year-old son Hans Albert a letter. He praised his son for his learning efforts, saying, “that is the way to learn the most… When you are doing something with such enjoyment that you don’t notice the time passes.”

“Curiosity has its own reason for existing,” Einstein explains. “One cannot help but be in awe when one contemplates the mysteries of eternity, of life, of the marvelous structure of reality.”

Become curious about how a framework works and is structured. When you learn something thoroughly, you gain a clear picture of its mechanisms and functionalities. Do not simply accept that Rails is a great framework for rapidly developing web applications—learn how Rails works, behind the curtains. Moreover, consider the possibility of contributing to and improving it, as it is open source.

Watch out, too that you don’t become obsessed with money. Of course, we all need money to pay our bills and buy food for ourselves and/or our family, but if you want to excel in software development, you need to cultivate a passion for learning and developing for the sake of it. You need to love programming, and feel grateful that you have the opportunity to positively impact the lives of millions of people with the lines of code that you write.

Einstein believed that, “love is a better teacher than a sense of duty.” What we can learn from this as software developers, is the importance of not just working for of a good salary, but because we love learning and our work in general, and have an intrinsic curiosity and drive that keeps us engaged after work or during the weekends, when our boss is not watching.

Always remember: programming is a lifetime of learning

Aside from his learning methodologies, Einstein is one of the most influential figures in physics. His work has helped various disciplines, from nuclear energy production, to synchronization of GPS satellites to computers, to many everyday consumer products.

His genius and accomplishments may lay outside the reach of most of us, but his work ethic, humility, curiosity, and tenacity are worth emulating by anybody.

If you want to be successful, you can save yourself time by replicating the behaviors of other successful people. Though Einstein wasn’t a programmer, he live reveals some inspiring patterns that we can all learn from, and apply in the field of software development. Einstein can serve as an encouragement to focus on learning the fundamentals, learn by solving problems and writing tests for different projects, concentrate deeply, and most importantly, love learning. If we want to succeed in our careers, we need to become passionate about learning and recognize it as a crucial part of our lives.

About the author

    Fatos Morina

    Fatos is an experienced and passionate Software Engineer with a demonstrated history of working in the full life cycle of software development with enormous curiosity for algorithms, data structures, and solving challenging mathematical problems. He is an open source enthusiast at https://github.com/fatosmorina and also a blogger at http://fatosmorina.com. He is open for new opportunities.