Make It Habit Forming

In general, I am passionate about learning. I think about it all the time. If I'm not learning something new, I'm bored. Thus, conversations around learning are very nearly an everyday occurrence for me. It is no miracle that last night's conversation was centered upon learning and my latest goal of becoming a master of web development.

The conversation was started by a discussion about the great book 'The Power of Habit'. The best method of learning is to form a habit. Regardless of the material you use or your genetically endowed intelligence, you will learn if you make a habit out of it.
The big question seems to be: how do I form a habit? Clearly, forming habits is one of the hardest things for us to do. If everyone effortlessly formed a habit then we wouldn't make New Years Resolutions.

All I can contribute is my two cents to the conversation. I'm not going to solve the problem any better than anyone else but I do seem to easily be able to form habits. So, maybe, I will be able to shed some light on how I do it.

Mental Toughness...or lack there of

Personally, I think that mental toughness is one of the most under-taught skills in modern society. Don't get me wrong, there are plenty of things worth quitting. We are inundated in modern culture with shiny objects that take up ridiculous amounts of our time. These are absolutely worth quitting. However, really important tasks, which wil have a long lasting effect on our life, are definitely worth making an effort to accomplish.

I don't have a definite answer as to how I built up my level of mental toughness. Yet, I am convinced that it is an ability/characteristic that anyone can acquire. Case and point, when I was young I would routinely leave things unfinished. I remember my sister getting frustrated with me because I would never completely finish coloring-in a picture before I wanted to move onto the next one. Yet, I clearly had enough mental toughness to make it through Special Forces Assessment and Selection and Special Forces Combat Diver Qualification Course, two of the most difficult courses in the world to pass. I am very proud of completing both of these grueling tests of will. Dive school was incredibly difficult. It was not fun. All 6 weeks of it absolutely sucked!!

I think that mental toughness is like anything else, you have to work on it, just like muscle building. You don't walk into the gym the first day and push 400 lbs. When I first entered a gym I could barely lift 100 lbs but, little-by-little, I made improvements and my strength grew. Mental toughness and learning work on the same principle, you have to exercise them. 

Mental toughness only kicks in when things really get boring or they really start to suck. So, the goal is to continually raise your threshold so that things don't suck. If I took someone who has never run out to run 5 miles at my pace, they are never ever going to want to run ever again in their life. However, if I lead them through a short run each day and build up to 5 miles over the course of 4 or 5 months, it will seem easy. They will run 5 miles effortlessly. The final 3 minutes of every run will not be fun. Yet, pushing the pain barrier will allow them to make great advances. However, the pain barrier should only be touched for very short periods of time. This is how you build mental toughness: little-by-little. You do repetitions. Then, next time it gets easier. 

It’s not that I’m so smart, it’s just that I stay with problems longer.
— Albert Einstein

Mental toughness is like a blowing a bubble with gum. If you blow too hard at the beginning it will pop. The best bubbles are made by carefully blowing at a steady pace, little-by-little the bubble expands. Exercising your mental toughness shouldn't be a test. You don't learn mathematics by taking tests all the time. Constantly putting yourself on the spot and seeing if you can pass a rigorous standard is far too stressful to be beneficial. Professional athletes train for hours each week in order to complete a 'test' (i.e. a race or competition). Whether you are exercising muscles, brain cells or mental toughness, you have to train to get better. No one is born into perfect knowledge or ability. It takes careful effort at a steady pace.

The same applies to learning new things or skills. Build up your pain threshold little-by-little. Then, we you get to the point where you don't feel as though you are making any progress, go back to something comfortable. Give yourself a boost of confidence. Expand the bubble of mental toughness and then retreat a bit in order to let your mental heart rate relax.

Mental toughness needs to be exercised in order to become a great learner. You will have to push through boring moments where you don't feel like you are making progress. These moments define a life-long student. You don't have to stubbornly spend hours doing something boring. Just do 15 minutes each day. This is mental toughness. Eventually, you will break through and your progress will take off like a rocket.

To make your life a work of art takes effort,

Rome wasn't built in a day

Code Commentary

...the rest is just commentary!
— Hillel haZaken

Code is a strange beast. It is based entirely upon mathematically logic yet, it can be incredibly difficult to figure out what is going on. This seems rather strange. I think that this conflict is caused by bad explanations. 

The logic is simple: if everything in programming is based on a strict rational model, then everything should be clear when properly explained. Programs do not think outside-the-box. They do not randomly insert lines of code. They act in a very precise and "programmed" manner. 

Despite their programmatic nature, it can be mental gymnastics to figure out what is going on. Part of this is a simple location problem: part of the code is one place and another part is located elsewhere, either in another file or in another location within the same file. The other difficulty in reading code is variables. While they are a key component of programming, variables also make it challenging to keep track of all the pieces and how they relate. Looking at code can be like deciphering a puzzle. 

One of the solutions that I have found to this problem is creating code commentaries that explain step-by-step what is going on and how the pieces connect and relate to one another. I think that writing down a thought process can help you better focus your energy and prevent you from losing the line of reasoning that you are following. 

My efforts to understand how to build a cookie

Commentary upon code can be tedious. I don't think it is worth doing all the time. It would take way too much time to do so. However, it can be incredibly useful for working through difficult arrangements of code.

For example, I really had a lot of trouble the first time that I went over how to do cookies in JavaScript. Of course, I can always just copy lines of code and get it working but, I wanted to understand how cookies work. Thus, I resorted to making code commentary as a means of thinking through how the code is set up and how the different pieces are interacting. It helped me immensely. 

This does not mean that I could sit down and write out a cookie in JavaScript from memory. Truly learning something doesn't work like that; learning requires repeated exposure to the same material. However, I am now far more aware of all the different steps that need to be undertaken in order to create a cookie and I understand the rational behind them. Thus, when it comes time to troubleshoot the mistakes that I will make the first few times that I build cookies, I will be far more capable of figuring out what is not working and why. 

I think that building a commentary around code can be a phenomenal practice for improving your comprehension and further ingraining your knowledge of how everything is interacting. Of course, I am interested to see if keeping up this practice will yield long-term positive results on my in-depth knowledge of computer languages.

Stack Overflow - How to Learn HTML/CSS

Below is an answer to a question that was posted on Stack Overflow about learning HTML and CSS for an absolute beginner. This is my response.

I was in the same position as your friend when I started with HTML and CSS. I had absolutely zero background in computer science, software development or any sort of programming. Hence, I did a significant amount of research and consulted with numerous friends who are very accomplished software developers. The following is the path that I took:

One piece of advice to start off with: type everything! I have read countless books that tell you not to type all the code but simply download it. This goes against everything that I have studied on effective learning strategies and long-term language acquisition. Programming is like learning a human language, it requires muscle memory. The more senses you involve in a particular learning activity the more efficiently you will learn it. So, TYPE EVERY LINE OF CODE OUT THAT YOU CAN FIND! DON'T TAKE SHORT CUTS! CODE, CODE AND CODE SOME MORE!!

 - Head First HTML and CSS by O'Reilly publishers. Before focusing on computer languages, I spent years becoming quite accomplished at learning human languages. I my recent effort to master web development, I have started with the assumption that the principles behind learning programming languages will be the same as those behind learning human languages. Thus, working with code and building stuff right from the beginning was critical. At first, I had looked through other O'Reilly books (e.g. HTML5 Up and Running, HTML5 Cookbook, etc.). Despite their wealth of information, they are more like grammar books than methods aimed at beginners. Immersion in the language, whether computer or human, is the most important. The Head First series makes you jump right into the code. No matter what language you are working on, if you are a complete newbie, I wholeheartedly suggest the Head First series

 - HTML Tutorials. As @Quentin (another StackOverflow user) stated, there are many problems with w3schools and once you get past the basics I would stay away from them. However, I still suggest them to people because their in-browser TryIt Editor is very handy for easily playing around with code and seeing the result immediately on the page. It is not a necessity but it does save you time when you are starting out. In addition, their basic HTML, CSS and Javascript tutorials do not have any major issues with them. Thus, they are simply a short stepping stone. Focus on doing little experiments in their TryIt Editor in order to see the output. The huge benefit of programming languages over human languages is the fact that you can immediately receive feedback on any changes that you make. Take advantage of this.

 - CSS Tricks Podcast by Chris Coyier. While most people have heard of HTML, very few beginners realize that CSS is actually where most of the activity takes place in the HTML/CSS mix. When I started, I had such trouble understanding what CSS was until I sat down and started playing with it. A couple of programmer friends tried explaining it but they ended up confusing me far more than enlightening me. In reality, CSS is very straight-forward and the Head First series will teach you all the basics. Then, the CSS Tricks screencasts, which can be found on iTunes, will move you to the next level. Chris Coyier does an amazing job!! Plus, he has made hundreds of screencasts. If you consistently go through his screencasts you will learn an incredible amount and reach a very high level of HTML/CSS mastery.

Beyond the 3 resources listed above, there are many other great places to get inspiration. Smashing Magazine is most definitely a place to immerse yourself in design patterns and the latest trends. Web Platform looks like it will become the go-to source in the future for in-depth documentation. A list Apart contains a lot of great information related to web design principles and worth visiting frequently. However, once you have the basics down it is important to get out there and build stuff. In addition, I would suggest moving on to Javascript, jQuery, and PHP, MySQL or Rails based upon what direction you would like to go.

The most important skill that you will need after you get past the basics is researching solutions. Code programmers spend a significant amount of time conducting research in order to figure out how to solve a problem. This might mean a simple Google search or ordering a book that specifically deals with a large problem. Once you are more advance, O'Reilly's HTML5 Cookbook can become an amazingly useful resource.    

Finally, I should mention that I am not yet a fan of Treehouse or Codecademy. I think that they have real promise but they are still not as useful as other resources. The main problem is that they force you to follow a strict path that can often lead to wasted time and it is questionable whether their method would lead to more efficient learning. When I used both, I felt as though I was moving very slowly and it led to frustration. I think that it is a very useful platform but I don't think they have been perfected yet. They are simply too slow and too strict.

Recent Answer from Quora

Below is a recent answer of mine to a question on Quora: What is the Best Way for a Beginner to Go About Learning Javascript? 

All of the above answers are great and provide a wonderful set of resources and learning principles. Unfortunately, they are written for people who are already proficient in coding. That is to say it is written for college educated computer scientist. Personally, I am not included in this category. Thus, I think that if I had followed much of the above advice when I first started learning Javascript, I would have been very quickly frustrated.

Codecademy ( is a promising platform but did little to help me get the basics of Javascript down. (I talk about Codecademy a little bit in a recent blog post: The gap.) 

The unanimous opinion in software development is that JavaScript: The Good Parts is one of the best books available on Javascript. That being said, I would feel a twinge of pain for anyone who tried to learn the language from scratch with it. The book is written for people who are already proficient in the language and searching to push themselves to the next level. I have not yet ventured into tearing into the book because it does not solve any of my problems. However, I am sure that there will come a day when it will be very useful. 

As a novice in Javascript, it appears to me as though Douglas Crockford is sort of the godfather of the language. Thus, everyone suggests his stuff. Unfortunately, once again, his material is really geared towards giving a conceptual understanding of the language rather than practical lessons and examples that can be used as learning devices for a beginner in Javascript.

Of course, if you can find a project to work on that is great. However, it is often quite difficult to break a problem into different parts and solve the smaller problems if you don't already have a firm grasp of programming and how you could potentially solve a problem. Thus, there is sort of a "the chicken or the egg" situation. Without knowing how you might solve certain problems it is difficult to figure out what might be possible. Having a specific project in mind motivated me to want to learn to code, but having the opportunity to see how a brilliant software development guy breaks apart a problem helped me to understand all of the possibilities.

So, what have I found to be the most useful resources for a true beginner in Javascript? (This is assuming that you already have a good command of HTML/CSS)

  • The Starting Point -> JavaScript Tutorial - There are countless problems with W3Schools Online Web Tutorials and many people have pointed this out elsewhere on the web. However, they still kick Codecademy's butt. The main reason for this is because of their handy little Editor that allows you to play around with examples. I am a big fan of typing out lines of code even if you understand perfectly the concept; there is still value in painstakingly typing out code. It helps ingrain commonly seen items. Yet, it can take a lot of time and be annoying to constantly switch back and forth between the browser, the javascript tutorial and the text editor in order to play around building different functions. The w3schools editor doesn't force you to follow a certain path or solve any annoying problems in order to move to the next stage. It just makes it easier to play with the code and see the result without wasting time. Go through these tutorials and pass over real quick concepts and examples that don't seem too relevant to what you want to do.
  • Javascript 4 You - This is a phenomenal series of videos that are hosted on YouTube and iTunes. Every single video is very short and covers different concepts in Javascript. I don't remember how I came across this site, but I have loved the guy's short tutorials. There are no long winded explanations. He simple shows the code, gives a quick explanation and shows what it does in the browser. It is brilliant!! I am amazed that more people have not mentioned it. The best part is that he has continued doing it for the past number of years, so now there is a large archive of material that goes all the way up to more advanced parts of Javascript. It is awesome!!
  • javascript/tutorials - WebPlatform Docs - This is a site that is rich in everything Javascript and web development. If you work through sections of this site, little-by-little, typing out every single line of code and then creating your own examples, you will learn a phenomenal amount. 
  • JavaScript Garden - This is a great overview of Javascript fundamentals. Type out every single line of code and, then, try to create your own code based on the model that you just saw in that particular step of the tutorial.

Once you really get the basics down, it becomes important to have a problem to solve. Come up with your own website as a project even if there are already a million other sites that do the same thing. As you play around with your own project you will start the creative juices flowing and start learning more about the details of Javascript. As you advance, the key is to become really good at research. Mix in advanced texts, such as JavaScript Cookbook and Eloquent Javacsript: A Modern Introduction to Programming. Blend together periods focused on learning and periods focused on experimenting.

It takes a little bit of time, but it is such a cool thing when you get to the point where you can solve awesome problems and create cool programs. It quickly becomes addictive.