10 tips for new Mac coders

New coders have a lot to learn, but some lessons are more important than others. Here are 10 things every new coder should know

By

  • logic Maths
  • debugging First time failure
  • detail Detail matters
  • learn css Learn CSS
  • layers of abstraction It's all abstract
  • command line Unix
  • comments Comments
  • python style guide Style guides
  • pep naming convention Learn to describe
  • tabs spaces You're doing it wrong
  • More stories
Next Prev

10 tips for new Mac coders: It's not about maths

Learning to code can be a daunting challenge, and there are many practical things to think about. Which language to learn? Whether to pay or use free programming courses? Which tools and equipment to buy or install?

One of the things that some newcomers to programming find worrying is that link between coding and mathematics. Don't worry. Sure, computers have a history with mathematics, and many programs are used to crunch numbers.

But programming isn't about mathematics at all. If anything it's closer to logic, although even that's overrated to begin with. Mostly it's learning simple statements and commands, and then a whole bunch of problem solving.

You'll pick it up as you go. But don't worry if you're not too hot at maths.

Read next: Complete guide to Mac coding

Next »

Next Prev logic

Learning to code can be a daunting challenge, and there are many practical things to think about. Which language to learn? Whether to pay or use free programming courses? Which tools and equipment to buy or install?

One of the things that some newcomers to programming find worrying is that link between coding and mathematics. Don't worry. Sure, computers have a history with mathematics, and many programs are used to crunch numbers.

But programming isn't about mathematics at all. If anything it's closer to logic, although even that's overrated to begin with. Mostly it's learning simple statements and commands, and then a whole bunch of problem solving.

You'll pick it up as you go. But don't worry if you're not too hot at maths.

Read next: Complete guide to Mac coding

 

10 tips for new Mac coders: Nobody's program works first time

Once you get past the early stage of creating programs that print "Hello World" on the screen, your program will not work first time.

It probably won't work the second, third or fourth time either. If it appears to work, it'll probably be doing something in the background.

Don't worry. This is normal. You don't so much write programs, as write the code and keep removing all the bugs till it works.

This is as true for coders who've been writing programs professionally for 20 years as it is for total newcomers. Don't worry. It's not a sign that you suck.

 

10 tips for new Mac coders: The devil is in the detail

It's incredibly important to pay close attention to detail when writing code. In most languages, capitalisation is vital and you must use the correct symbols. In particular, pay attention to spacing.

When you're copying code from an online website, make sure you write it out word by word, and line by line. Don't cut and paste. Write slowly, and methodically, and attempt to understand each line.

When you get to the end of writing a program, read it line by line from back to front. Make sure it's all grammatically correct.

 

10 tips for new Mac coders: Russian dolls and learning CSS

As you start to learn programming (no matter which language you learn), you'll come across a sense of Russian Doll-ness to everything. Everything you uncover has something else hidden inside you need to learn.

Everywhere you look is a function, object or variable that takes parameters and arguments from other functions, objects or even other files from other programs. They in turn need other functions and modules from other parts of the program.

This is often known as "indirection". Something works indirectly, going from A to B to C. There are other terms such as Recursion, where features run inside themselves.

Even learning parts of programming often throws up more questions than answers.

This is why learning HMTL, and CSS (Cascading Style Sheets) in particular, are good pre-steps for learning programming. Snobs will tell you that HTML isn't a "proper" programming language. It's still worth learning, but CSS is a real tool to have in your toolbox. With CSS you learn the basics of how programming elements interact in an easy environment.

 

10 tips for new Mac coders: It's all abstract - learn what's happening under the hood

Programming is all about abstraction. At the physical level, on the hardware. It's billions of tiny transistors arranged in blocks switching on and off. You'll often hear about computers only working in 0s and 1s. The binary system.

You may hear about "machine code". This is code written in binary or hexadecimal (another layer of abstraction).

Binary is an 'abstraction' that makes something easier to understand.

You are unlikely to ever work in machine code. Instead you will work in abstract programming languages. Most typically Python and Java. These convert your code to machine language on-the-fly. Some languages, C in particular, require you to build a separate machine code file and run that program.

If you want to learn programming then take the time to learn about the systems underlying your programming language. You don't need to go all the way from Python to Machine Code, but read up about what's going on under the surface.

 

10 tips for new Mac coders: Learn Unix and the command line

As a learner you'll often start out in web-based sites like Codecademy, or apps like Swift Playground. As a developer you'll often work in a fancy IDE like Xcode.

So you might not realise how important it is to open Terminal and learn how the Command Line works. It's vital. That's where things actually happen on the computer, and you simply can't program if you don't know how to use Unix.

You should make learning Unix commands one of your top priorities.

 

10 tips for new Mac coders: Write comments in your code

Learn how to write comments in whatever language you are learning. Comment everything, everywhere, religiously. Even if you are the only person who will ever read your code: comment, comment, comment...

When you first start to write comments, you'll repeat (or rephrase) the function of the code. What it does.

As you get better you'll start to write about intention. What the code accepts, and tries to do with data.

 

10 tips for new Mac coders: Read style guides

Be sure to read the style guides that go with your programming language. These will teach you how to capitalise different parts of your code, and what is the generally accepted convention.

Here is PEP 8: Style Guide for Python Code and Google Java Style Guide.

 

10 tips for new Mac coders: Write descriptive functions and variables

As you start to code you'll need to create variables and define your own functions. Learning good naming habits early on will save you a lot of trouble down the line. No matter what language you're learning. PEP 8 has some good advice.

 

10 tips for new Mac coders: Don't get involved with pointless wars

Whether it's the argument about tabs vs spaces, where to position braces or which text editor to use (or which language to use), programmers like nothing more than a pointless war.

There are right and wrong ways to do some things in programming, but all too often programmers think their way of doing things is "right" as opposed to just what they prefer.

As a general rule, consistency is more important than fashion. Whatever you choose to do, do it consistently. And don't be too stubborn to change when you're working with other people.

Elsewhere on IDG sites
Nokia 8 vs Galaxy S8

Nokia 8 vs Galaxy S8

Best new design books 2017: From vintage infographics to the the psychology of type

Best new design books 2017: From vintage infographics to the the psychology of type

iMac 21.5-inch (2017) review

iMac 21.5-inch (2017) review

Nokia 8 : design, caractéristiques techniques, date de sortie

Nokia 8 : design, caractéristiques techniques, date de sortie