Dave

Software professional with 25+ years in SaaS product development, coding, consulting, platform transformations, and data migrations.

Contact: hikingdave @ gmail.com

What are you building?

The first question asked when someone wants to learn how to code is often, "What should I build?" And the answer is often to choose a project that would help them solve a problem or help with tasks in their own lives. That answer is 100% correct. but answers the wrong question.

Coders do have a long-term vision of their work and you should likewise have a vision of what you are building. But that vision isn't what you sit down and write code for. You write code to build smaller pieces of your app. Before you can assemble lego bricks into a structure, you need to have the bricks. So the question we need to first answer is the equivalent of "What bricks do I need?", or to be specific, "What pieces do I need to create which can be assembled into the final vision?"

To answer that, when my kids started asking such questions, I had them draw out what they want on a whiteboard. My son drew a board game design. Which was a perfect illustration of how to break down pieces.

He drew out the large components: A board, some dice, some cards with monsters on them, some players, and a set of rules on how to play. All perfect example of specific pieces we would need to code.

So then we broke them down again - what is a game board, really? On a computer screen, it is just a drawing. It is a box, with lines drawn on it. Maybe some color and pictures. So coding the board itself is just drawing a picture. 

What are dice? Again, a drawing on a screen, with a few possible number of dots on them. And a way to randomly choose how many to show.

Cards are again drawings, with some lines and layout that will be consistent, and some content that changes depending on which card you are showing. To draw from a stack, you need to draw the stack on the screen, have something happen when you click it to pick a random card, and then show that card.

What are rules? Rules are the algorithm we get to code to bring it all together. What happens when you play the game? What do you click, and how does the program respond?

This is the level you need to get to when you begin coding. Because now your questions are a level at which a beginner can learn. Your tasks are simple ones - draw a line on a screen, generate a random number, store a piece of data, retrieve a piece of data. This is the level at which people really code, and breaking something down from a large idea into workable pieces is absolutely what we do as professional coders.

I'd encourage someone who wants to learn to code to go through that same exercise:

  1. Decide what your final product will be.
  2. Draw out what is might look like on a board, on paper, somewhere.
  3. Write out a list of each piece that you drew.
  4. Look critically at each piece and think about what it really is - is it something visual to be drawn? Some rules to be coded? Sound? Text? Does it change based on what someone does in the program, or is it always the same? Make notes of all those answers.
  5. Take each piece, one at a time, and you should have a bite-sized task that you can work on.