LaunchSchool - An Online School for Developers /

Blog

Learning to Code Anti-Patterns

It’s often difficult to prescribe a “right way” for a beginner to learn programming because everyone learns differently. But there are certainly wrong ways to learn. Over the years, we’ve seen many learning anti-patterns. In this article, we’ll talk about many of them and how to avoid them. This article is geared towards those who haven’t started the Launch School program yet, or those who are very early in the process.

These learning anti-patterns can be broken down into the following categories:

  1. Expectations
  2. Study Habits
  3. Code/Technical
  4. Communication

We’ll talk about the anti-patterns in each of these categories in turn:

Expectations

The first set of anti-patterns that needs to be addressed is about expectation setting. These are the issues you need to address before you even start our program.

Anti-Pattern: having no specific goal

We’ve seen many students over the years who come to Launch School without a specific goal in mind. Students who say they they want “a job” also fall in this category. Wanting “a job” is not a specific enough goal. It’s like saying that you want to become “a writer”. Anybody can call themselves “a writer” but what specific kind of a writer do you want to be? If, however, you say that you want to become an investigative journalist for the New York Times, your have a much more focused goal, a goal you can take action on.

At Launch School our goal is to teach people the fundamentals of programming well enough that they can start a long career; a career that fortifies them against the ups and downs of the industry. Even though the IT industry, when seen form a long-term perspective, is trending upwards in terms of job opportunities, it does experience short-term fluctuations. During an upswing, you can perhaps get a programming-related job with bare minimum skills. However, those are not the type of jobs Launch School is trying to prepare you for. In a market upswing it can be tempting to forego a fundamentals led approach for surface-level knowledge to quickly get a job but the results are very different in the long run. You will notice the difference when the industry experiences a downswing. That’s when the low-level jobs that don’t require an in-depth knowledge are affected (ie, they no longer exist).

We have a very specific goal here at Launch School. The very first thing you’ll want to decide is whether your goal is aligned with our goal. If it is, Launch School is the right place for you. Our learning goals are covered on the Is This For Me page.

Anti-Pattern: giving yourself X months to reach your goal

This is probably the most common expectations related anti-pattern that we’ve observed. In our program, giving yourself a fixed time duration is almost always a mistake. More often than not, people underestimate the amount of time they’ll need to learn something really well. At Launch School, we ask you to learn things to a level of depth you’re probably not used to, and that makes it difficult to estimate the amount of time it’ll take. Being a mastery-based program, we often talk about giving yourself some flexibility and giving your brain the time to absorb new concepts. Most likely that means that X months are not going to be enough.

Artificial deadlines set you up for failure. It’s one of the main sources of anxiety, as well. When anxiety creeps in, behavior changes and your focus shifts from comprehension to trying to honor the deadline. Our advice is to give yourself enough time, be flexible and don’t work with a tight deadline because that’ll likely lead to disappointment and anxiety.

Anti-Pattern: underestimating what it takes to become a professional

Becoming a software engineering professional who is fortified against the ups and downs of the industry is a vastly different experience than just dabbling in programming. Most students that come to our program are at the stage of exploration. Transitioning from that to a goal of launching a long-term career requires a level of seriousness and even competitiveness. Along with that, it also requires other, oft-ignored skills. Attributes like good communication, a strong work ethic, attention to detail, being nice and being a good team member make a huge difference. We don’t have any courses on developing these skills, but we will get a chance to give you feedback on these things through the process of interacting with you.

Anti-Pattern: not being detail-oriented enough

Programming requires you to be extremely detail-oriented. Being detailed oriented is not so much a binary attribute as it’s a spectrum. You have to be among the most detail-oriented people to be really good at it. A lot of beginners underestimate the highly imperative and detailed nature of programming in the early stages. One has to learn to give very specific instructions to the computer, and that does not come naturally to most people. As you advance, you’ll work with higher level of abstractions but even then, being highly detail-oriented is invaluable not least because you’ll have to do a lot of debugging.

Study Habits

Next, we’ll discuss a few anti-pattern related to study habits:

Anti-Pattern: having poor study habits and not improving them

One of the major problems that hold back many students is poor study habits. It’s especially problematic because people often don’t even realize that they have poor study habits. We’re an online program and that makes it difficult for students to see how hard some of their peers are working. We are in a position where we see all the students and some of them work extremely hard. They takes notes, make flashcards, and do all the study related activities you’d expect a university student to do. Then there are others who don’t do any of that. When we compare those two types of students, 9 out of 10 times, we can guess who’ll do better in an assessment.

One phrase we often use when we give advice is “habits over enthusiasm”. What this means is that you cannot keep your excitement and enthusiasm levels up for a year or two. Excitement is only helpful in the beginning, exploratory phase of learning. In the long run, the differentiating factor is going to be your study habits. We try to challenge people to calibrate their efforts by comparing with other students. One advantage of being in a program like Launch School is that we tend to attract very capable students who are very serious about learning. Being an online program, however, that’s a little difficult to see. In a classroom environment, for example, you can easily get a sense of how other people are studying and can adjust accordingly. That said, in our Slack chatrooms, students frequently discuss study habits and that can be a good place to get sense of the kind of work our top students are putting in.

The good news for those who don’t have great study habits is that it’s something you can work on. Observing and asking other students definitely helps. We highly recommend you check out the following two resources as well:

  1. Mastery by George Leonard
  2. Learning How to Learn (a free course on Coursera)

Anti-Pattern: getting distracted by new developments in tech

This is an anti-pattern that affects everyone from novices to senior developers. In software development, there are always so many new things happening that we can basically spend all day, every day reading blogs about them. This can be extremely detrimental to the learning process because it makes you feel like you’re missing out. Just know that 99% of those blog entries are focusing on concepts that are beyond what you’re trying to learn. The fear of missing out on something important is unfounded because rarely are these blog posts about something foundational. These high level technologies change so often that by the time you master the fundamentals, there will probably be something new being hyped in the blog posts.

In general, trying to learn advanced content at an early stage is not helpful because you don’t have the context and experience to understand or use that knowledge. It’s usually counter-productive and distracts from the important goal of mastering the fundamentals. This includes things like Design Patterns, Agile Methodologies, TDD, etc.

Anti-Pattern: looking for a shortcut or a way around difficult topics

Another problem that plagues beginners is the temptation to take shortcuts and avoid working on difficult problems. We get emails from students asking whether they have to work on certain assignments. Our answer is that the harder the problem the better. The highest salaries in our field go to people who have a skill, not necessarily to the people who have a piece of knowledge. Employers likely won’t ask you to apply the knowledge you already have; you’ll often have to solve problems you haven’t encountered. The best way to prepare for that is to find and solve the hardest problems you can. That’s how you improve any skill and programming is no different. There is a caveat here; don’t just search for difficult problems online because some of them will require a knowledge of advanced mathematics or specialized data structures and algorithms. In our program, you’ll only be asked to solve problems that are based on your understanding and skill level.

Anti-Pattern: learning slowly means I can take a lot of breaks

We often talk about taking “the slow path” to mastery. We believe in it so much that it’s the first thing you read on our front-page. Some people have interpreted that phrase to mean that we want you to do less work. The slow path means that you shouldn’t be in a rush. It’s not as much about being slow as it’s about comprehension. The slow path will result in more work, not less work because we’ll ask you to learn each topic to depth and not be satisfied with mere awareness of it. What we see is that a lot of the time people are in a rush to move forward, which compromises their comprehension.

Anti-Pattern: not caring or taking time to establish mental models

This anti-pattern will be a little difficult to understand for those who are not yet in the program, or those who haven’t studied a programming language before. This one is about not trying to create a mental model of how something works. Mental models are an important tool that helps us make sense of the world. Just like physical scientists use mental models to make sense of the physical world, programmers need to have clear and precise models of how the world of computing and programming works. Having a clear mental model of a concept often means that you only have to remember a few principles and not a thousand specific rules.

Bear in mind that a mental model is not a fixed entity. The first mental model that you develop about a particular construct is very likely going to be simplified and not fully developed. As you gain more knowledge, make sure that you update your model. Whenever you encounter something that violates your current mental model, try to investigate the cause of that violation and make the adjustments accordingly.

Code

Let’s now discuss some anti-patterns that are more specific because they are technical in nature and probably easier issues to work on than the ones we discussed above:

Anti-Pattern: not analyzing error messages

This is a prevalent issue among beginners to programming and there’s a good reason for it. Error messages seem daunting and incomprehensible when you see them for the first time. Analyzing error messages is a habit that takes some time to develop. It requires a patient temperament that you’ll have to develop if you don’t already have it. In the beginning stages, it’s going to require a fanatical attention to detail. The more error messages you read, the easier it becomes to read them; over time, you start noticing patterns in error messages.

One important aspect of resolving errors in programs is knowing how to look for help. You can’t just copy and paste your error message into a search engine because most of the times it contains information specific to your application or environment. Try to look for the general principle that’s being violated and search for that. Before you seek help online, though, make sure you’ve already spent enough time sifting through the stack trace. In the age of Google and StackOverflow, you can find answers to most questions online but that shouldn’t be your first instinct. An over-reliance on others can lead to immense frustration when you get an error message you can’t find an easy solution to, and that will happen at some point.

Anti-Pattern: not knowing how to debug

Analyzing an error message is only the first step towards fixing an error. Some bugs won’t even come with error messages. The second and perhaps much harder step is trapping the problem. A lot of beginners and even some non-beginners don’t know how to do that in a systematic fashion. This is where our anti-pattern of “not having a mental model” becomes very relevant because without a sound mental model, you cannot do systematic debugging. Having a correct mental model enables you to scan the code, step through it, and catch the piece of code that violates that mental model. Sometimes, it’s these error messages that force you to see the holes in your mental model. Lessons learned this way are often the most well-remembered.

Debugging is a very important skill and you should familiarize yourself with it as early as possible. We have a detailed assignment very early in course 101 where we talk about various strategies and tools useful for debugging.

Anti-Pattern: hack and slash mentality

We use the phrase “hack and slash programming” to describe coding without intent; you don’t really know why your code works and you don’t have good reasons for making specific coding decisions. This approach is very natural and understandable in the early stages of learning to program. Trying out different things and trying to “just get things to work” is a good way to explore programming when you’re starting out. However, very soon after that, you’ll have to adopt a systematic approach and start working towards establishing robust mental models. Today’s high level frameworks makes it relatively easy to build features. It’s much harder to debug those features. Debugging requires a methodical approach and a sound mental model. It’s highly likely that your first job as a programmer won’t be to build a new app but work on an existing app and maintain it. You can’t hack and slash to do that.

Anti-Pattern: not studying an exercise or a problem to depth

We sometimes encounter students asking for more coding exercises to solve. This is a little surprising for us because we have a considerable amount of exercises spread throughout our courses. What we’ve observed is that this need for more exercises is often a result of the student not spending enough time on the exercises that they already did. If you don’t study each exercise to depth and don’t try to explore various scenarios and edge-cases, no amount of exercises will be enough for you. Try not to be content with just doing the bare-minimum to get a solution to a problem and move to the next exercise. Instead, play around with the exercises, see if your solution covers all edge-cases, try to explore what those edge cases might be. That way, you get a lot more out of an exercise and, in the long run, it’ll help you develop an instinct for writing robust code.

Communication

The next set of anti-patterns are related to how you communicate and work with others and how you ask for help.

Anti-Pattern: asking questions without analysis

A lot of the times your first reaction when you encounter a problem is to ask a question. That’s not the best way to approach it. Try to do your homework and spend time with the problem before you look for help.

Also important is the kind of questions you ask. We want to encourage you to focus more on the “why” questions and less on the “how” questions because the “how” questions are often very easy to answer. Most of the time, you can find an answer yourself by firing up an editor or starting a REPL session and experimenting. An example of a “how” question is:

Can you use the ruby setter method syntactic sugar without self?

You probably don’t understand this question very well at this point but the reason why this is not a great question is because it can be easily answered by testing what it asks in a REPL. A better question might be:

Why can’t you use the ruby setter method syntactic sugar without self?

This question is a lot more interesting and the discussion resulting from this question could lead to a profound insight into the mechanics of the Ruby language.

Anti-Pattern: getting too attached to your code

This problem is prevalent among most developers, including experienced ones. As programmers, we take pride in our code and it isn’t always easy to welcome criticism, even if it’s in good faith. However, it’s really important to be able distance ourselves a little bit from our code in order to allow others the room to give us feedback. Don’t get too tied to your code. You are not your code and a criticism of or feedback about your code isn’t a value judgment about you as a person. At Launch School, we’ll talk about your code a lot. Just keep in mind that our intention will always be to help you improve the quality of your code.

Anti-Pattern: getting too attached to a methodology or workflow

During the course of your studies at Launch School, you’ll get to learn about various “best practices”, and workflows. It’s important to understand the reasons and context behind these choices and not be dogmatic about them. Learn these “best practices” and methodologies and then over time try to develop an intuition about when it makes sense to apply them. It’s very likely that you’ll see people who don’t follow those practices and workflows in their code. You shouldn’t be quick to jump to conclusions. Try to understand the context behind their decisions. There might be legitimate reasons for why they made those decisions. By weighing in with your opinions without understanding someone’s point of view, you run the risk of coming across as snobbish.

Anti-Pattern: Imprecision of Language

In programming, we deal with highly abstract concepts and it’s very important to communicate those concepts clearly and precisely in order to minimize miscommunication. Callings a thing by it’s proper name goes a long way. Try to pay attention to the the details of the language that programmers use and learn the jargon. Learning to speak like a professional programmer will go a long way during job interviews and communicating clearly and precisely makes you a better team member.

Conclusion

There are different ways to learn and some are better than others. Which method works well varies from person to person but the anti-patterns we listed above are definitely things that you want to avoid. Some of these habits and patterns will be easier to change than others. The best way to overcome these bad habits is to pay attention to them. Try to be conscious of your study patterns and actively try to improve them. Developing good learning habits from the outset can be the difference between success and failure.

To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video