Zen Programming Tips

This is a free resource from my online course, From Idea To Launch, where I teach you how to build a full Laravel web application, step by step, at beginner's speed. Learn more →

Here are some tips that I’ve gathered over the years. They’ve helped me immensely, and I hope at least a few of them will help you, too!

Don’t copy-and-paste code samples

While you can always copy and paste code samples, you’re doing yourself a huge disservice by doing so — every time you do it you strip yourself of a lot of potential training. So I strongly advise against copy-pasting.

And actually, this is one of the main reasons From Idea To Launch uses video lessons — because you can’t copy and paste code from a video ;)

In case you’re curious, there’s also plenty of scientific research to back this up. Remember back in grade school when you were told “When studying this material, trying copying it down. Or recopy your notes. Or make flashcards.” The action of putting the figurative “pencil to paper” helps reinforce the material you’re learning and has been shown to greatly improve retention.

So, take my advice, and always type out all of the code examples by hand. When you do that, you’re training your hands, your brain, and your mind in how to read, write, and comprehend the code.

You’ll thank me in the end. I promise. (And as an added benefit, you’ll get better at tracking down and fixing typos, of which you’ll inevitably make a few. I still do all the time!)

Try to solve things yourself, first

If you run into an issue while you’re programming — as you most definitely will, from time to time — always try to solve it yourself, first.

As opposed to running straight to Google to track down the “answer,” just stop. Take a breath. And take five minutes to think through the problem. What did you just do? What may have gone wrong? Giving yourself a chance to think will help strengthen your coding muscles more than you can imagine.

And if, after five minutes, you’re still stuck, then go forth and Google or visit StackOverflow. There’s absolutely no shame in searching for an answer (again, I do it all the time), but there are huge benefits in attempting to work things out on your own first.

The best strategy to solve issues and fix bugs: to get more information

When you’re stuck, the most important thing to do is get more information. This should be your first, go-to strategy when you’re trying to solve issues or fix bugs in your code.

Look at the data. Does anything look out of place?

Print out variables. Everything look right?

Gather as much information as you can, and 9 times out of 10, the answer will just pop right out at you.

Do some research regarding the error message(s) you’re experiencing. Has anyone else seen the same one? Answer’s almost always “yes.”

It’s alright to be totally lost at first. Coding is very frequently learned as a series of epiphanies, as are so many other things in life. You work hard at it for a good while, and just feel like you may not be getting anywhere. … And then all of the sudden, BAM, you experience a quantum leap in your understanding and whole bunch of stuff that you thought five minutes ago you “didn’t get” just clicks.

Stick with it. I promise you it’s worth it.

Create a schedule

This is simple. But extremely important. Don’t skip this!

The “New Member Survey” in From Idea To Launch helps you easily establish your schedule.

Schedule a predictably recurring time slot for your programming sessions. For example, every Monday, Wednesday, Thursday at 7:00pm, after dinner.

Here are some tips to make your schedule as effective as possible:

  • Shoot for three sessions a week.
  • Start with a small, easy-to-complete amount of time (e.g. 10
    minutes).
  • If at all possible, do each session at the same time of day (e.g. do every session from 7:00 – 7:10pm).

Starting with such a small barrier — e.g. a 20-minute session — makes it almost impossible for you to fail. Can you do one thing for 20 minutes? For sure.

As you progress, you can gradually increase the length of each session. (In fact, you’ll likely see it happen naturally, as you get more excited and into it.) But starting out with a small commitment helps develop a strong habit, which is crucial for your continued success.

Remove distractions to set yourself up for success

When you’re trying to accomplish something, there are always outside influences acting against you, as I’m sure you’re well aware.

Some are unpredictable: if the basement starts flooding as soon as you sit down to practice your coding, you couldn’t have done much to prevent that.

But, some are predictable. And those you can prepare for.

You want to remove (predictable) barriers ahead of time:

  • Set up your workspace beforehand.
  • Remove distractions (e.g. leave your phone in the other room).
  • Work in a closed-off environment (e.g. a separate room; a coffee
    shop) — one without distractions.
  • Close all unrelated windows on your computer (more on this in a
    minute).

When your scheduled time arrives, don’t think — just go. Go to the place that you have already set up for your success.

Use “full-screen” mode

As I mentioned, it’s important to close all windows on your desktop unrelated to coding before you start each session.

Display as few windows as possible, and have them take up the entire screen.

You should still simulate a sort of revised full-screen mode with those two windows: resize window #1 so it takes up the entire left-hand side of your screen; and resize window #2 to take up the entire right-hand side. That way, you can see both windows, and distractions are still minimized.

Pro Tip: If you have a tablet, consider setting it up next to your computer with the course you’re following along with and open your source code editor in full-screen mode on your computer.

Focus on making small, consistent progress

One of the best ways to minimize overwhelming feelings and inevitable roadblocks is to focus on making small, consistent progress.

That’s exactly why I recommended setting the length of your initial programming sessions at just 10 minutes each. Is it easy to do something for just 10 minutes? Yup. There’s really no excuse for not doing something for just 10 minutes.

And by starting at such a small, achievable amount of time, you will rapidly develop a very strong habit of actually completing those sessions.

With that habit in place, you can gradually progress to longer sessions and work into a schedule that suits you. But that’s only possible after you’ve laid a good foundation of consistently completing those small sessions.

If you stick to this general philosophy, you’ll be in great shape:

  • Start small ->
    • Build good habits ->
      • See progress ->
        • Gradually revise your programming session plan

Take breaks

Programming can, and at times will, be tough. But when you start to feel frustrated or overwhelmed, there’s a tried and true tactic that almost always works:

When you get stuck – or feel yourself getting frustrated, or overwhelmed – take a break.

Take a walk around the block. Go in the other room and read a few pages of a book. Do some pushups.

I can’t count the number of times I’ve gotten stuck and taken a short break, only to have the answer pop right into my head, mid-walk-around-the- block.

Your brain is a muscle. It gets fatigued. It needs breaks. When it gets tired, it may feel different than when, say, your legs get tired from a several-mile run, but nevertheless, it still experiences that same sort of exhaustion.

Knowing when to stop and give your brain a rest is crucial, not only to get “unstumped,” but also to prevent yourself from getting overly frustrated. When you’re programming, take breaks, often.

Above all, have some freaking fun

I truly believe learning to code should, first and foremost, be fun.

It’s incredibly rewarding to be able to start with an idea, and through coding, make it come to life right before your eyes, seemingly from thin air. It’s still something, to this day, that brings me incredible joy.

So, throughout the entire process, always remember to enjoy yourself, and have some freaking fun with everything! Don’t take yourself too seriously. Enjoy the process. Revel in the results.

It’s a great journey, and, if you stick with it, you’ll be immensely rewarded.

Get to it

This advice is based on my years of experience.

I’ve experimented with a lot, and these are the tips, tricks, and techniques that continue to work best for me, personally, time and time again. I hope that they’ll save you some time and help jump-start your programming learning.

But I can’t do the coding for you. So with that in mind, I’ll leave you with a quote from one of the best teachers of all time:

“Do. Or do not. There is no try.”

— Yoda

The rest is up to you…

Yoda, Zen Master, teacher extraordinaire