In this new year, I wanted to make an introduction to programming which mentions all the parts which (albeit being quite essential) many of the other tutorials, books and teaching documents tend to leave out. Things like “How do I even start debugging?” or “How to not lose it if my program doesn’t compile or when nothing works anymore?”. I was fortunate to get taught these skills by friends and helpful colleagues but if you’re a remote-only learner and don’t have access to such people – this series is for you. In this first post, I’ll address the problem that you’re in a situation where your program does not work at all. In the case of LaTeX, this means it won’t compile. Other programming languages which are not compiled will just not run. So what do you do in that dire situation?
Step 1: Take a deep breath
Stay calm. I repeat, stay calm. Take a deep breath. It’s just a mistake and you’ll find it if you look close enough.
Step 2: Get back to a point where it worked
Get back to a point where it worked. This requires that you come up with a way to do just that. You can always hit “undo” but what if the mistake was introduced too far back already? (This is also a great learning opportunity reminding you to check regularly if what you’re doing works.) Most people rely on so-called Version Control Systems. You probably have heard of one – Git(hub). Github is basically just the online hosting solution of git.
Step 3: Get version control to reduce damage and help you relax
For LaTeX, maybe try github on Overleaf. It’s just a little clicking around. Try with a GUI (graphical user interface – as opposed to in a command line) option if commandline freaks you out. You’ll get used to version control like you’ll get to the command line. Just give yourself time and don’t freak out if it’s not going as smooth as it could be in the beginning.
Try it on a project without collaborators first. Only once you’re used to maintaining your own projects using version control systems, try solving merge conflicts with others (when you already fully understand the basic functionality).
To be continued…
This is already the end of this short post. I won’t get into debugging here (which is the logical next step) because there will be a dedicated post on debugging. I’ll try to keep the posts from this series on the shorter side generally. Give me feedback if this helps or you’d need anything else!
Buy me coffee!
If my content has helped you, donate 3€ to buy me coffee. Thanks a lot, I appreciate it!
2 thoughts on “Learning to program: What to do if the program doesn’t compile”