Developers seem to know everything

So you want to become a developer? well that’s awesome! Developing apps for desktop, mobile devices, the web and even mods for your favourite game is a very exciting (yet sometimes daunting) experience. The biggest upside from developing anything, with the coding aspect in particular, is that you’ll learn a new skill that is very useful in today’s work field. Many programmers are self-taught and you could be too!

Over the course of 3 guides, we’ll be going through some general knowledge, getting your tools ready and setting the first steps in coding something.

Before we start

You will see me talking about coding and programming in this guide. I use the terms interchangeably although they both mean very different things (look ‘em up). When I use them I usually mean:

  • Coding: writing bits of code to make the computer do what you want. With trial and error, using other people’s code and re-using code you will get the computer to do what you want.
  • Programming: thinking of what and how you want to tell the computer what it needs to do. This is something you can do without a computer, because you should already know what the computer needs to know. It’s about structuring code and (for me) mostly about solving problems. When you’ve finished thinking, you make a plan and start coding.

In this guide (and maybe some after that) I’ll be taking you through the things a want-to-be developer needs to know. I’ll also be trying to introduce you to a way of thinking for (some) programmers.

If you’re looking for a straight-up “I want to make a weapon for the game X”, then this is not the guide for you (though I may make more specific guides at a later point). No, this guide takes you through the steps that may help you solve your own problems and hopefully become self-learning from other people’s’ code, problems and mistakes.

Requirements

  • A computer
  • An internet browser
  • An internet connection

Learning goals

  • A basic understanding of what a developer can do to solve problems
  • how to form a search query for a search engine

Let’s dive in!

People in software development (and IT in general) seem to have a great knowledge of anything to do with their computer, programming languages and other IT-related aspects. The main task of these people is to solve problems and they seem to do a pretty good job at it. Probably the biggest benefit any developer has though is that 80% (this is a made up statistic) of the time they have the biggest resource of information at their fingertips: The Internet.

Google is something you’ll want to get familiar with, because it will help you a lot when taking your first steps. Simply typing a well structured search-query and pressing enter can save a lot of time having to go back and forth trying to figure out why something isn’t working. Thousands of other people have run into the same problems you are going to run into and asked for help on websites such as www.StackOverflow.com (for software development), the FiveM Forums (for GTA V modding) and last but not least the Garry’s Mod Lua Developer Discussion on Facepunch.

Thinking of a good query can be quite a task though! For example when you get the error: “myscript.lua:23: attempt to index a nil value (global ‘surface’)”, what are you going to search? The whole error? Just “attempt to index nil value”? Close, but you’re forgetting one thing: what are you working with?

Generally a search query will consist of the following parts:

<Language you are working with><Specific implementation you are working with> <part of the error that is not related to your script only>

Or:

<Language you are working with> <Specific implementation you are working with> <description of problem occuring>

In our example error you might type a query into Google like: Lua Garry’s Mod attempt index nil value global surface

Or: Lua GMod nil value surface

In an example where there is no error, but something weird is happening: Lua Garry’s Mod ragdoll spazzing

If you read the problem the person posted you can see that it is very similar to your problem, which means you can now go have a look through the answers. Even if there’s something in the answers you don’t understand, you now know how to solve this! Simply think of a new search query and head of investigating again.

“Learning to code (or becoming a programmer) isn’t necessarily about diving into books and studying your ass off. It’s about practice and learning gradually; the more you practice, the more you’ll learn”

When searching for information be sure to keep your problem in mind and filter results based on that, whilst also making sure you don’t dive too deep into the documentation or even Wikipedia. Nobody needs to know that processors are essentially made of sand when the question was what variables are… (You’ve gone too deep into Wikipedia, come back and finish what you came here for!)

Searching can help you get a lot done with minimal effort, though sometimes a problem can be more specific to your implementation. This means you will have to go and “debug” the code. Debugging is the process of removing problems from your code (called bugs) either by using special tools, or manually by checking parts of the code.

In most modding environments there is a lack of debugging tools, which mean you will have to manually make adjustments by trial and error to figure out problems. Luckily a console or even chat is usually available in games to which you can print information for yourself, to check if everything is working as expected.

An example with psuedo-code (non-functional):

function whenSomethingEnters(entity)
  if(entity:IsPlayer())then
     local playerName = entity:Name()
     entity:MoveToShopLocation()
  end
  print(“Welcome to my shop, “ + playerName)
end

The problem that occurs is that the value of ‘playerName’ is not shown in-game. Maybe an error even occurs. You’re almost certain it should work, I mean otherwise you wouldn’t have written this bit of code. So to check whether everything works as you expect it, you insert some debugging code:

function whenSomethingEnters(entity)
  print(entity) -- is entity what I expect it to be?
  if(entity:IsPlayer())then
     local playerName = entity:Name()
     print(entity:Name()) -- Is what I am putting into playerName what I expect it to be?
     entity:MoveToShopLocation()
  end
  print(playerName) -- Is playerName still what I expect it to be?
  print(“Welcome to my shop, “ + playerName)
end

After writing this bit of debug information to yourself, you will find that after the second print, playerName is no longer working! With some digging in the documentation, searching online or even just good old ‘trial and error’ you find that the ‘local’-keyword in front of playerName is causing the variable to only exist within the `scope` of the if-statement.

If any of these terms (like variables, local, scope, if-statement) are unclear to you, I hope you took to Google and went to search for basic information on them 😉

So to finish this part up, you’ll come to find yourself Googling a lot, learning new things and becoming a cumulatively better coder along the way. Don’t be daunted by a lot of problems occurring, each of them are but a problem that needs to be solved and the reward of looking over a finished product that YOU made is very fulfilling.

Pro tip: Errors tend to snowball into more errors so always start by fixing the first error that occurs, because that will usually solve other problems as well.

TJjokerR

About TJjokerR

My name is Timothy, a.k.a TJjokerR. I was a coder for VentMob and one of the founders of Revolt Gaming (both now defunct). It took about 14 years to get where I am now, which is as a teacher in software development at a school in The Netherlands. I learned programming the easy way: making stuff I wanted to make, learning everything myself.