CODE: A Hands-on Approach (cahoa)
This is the first draft to a document that describes a series of hands on tutorials to teach programming (using PAWN, currently for SAMP). Your input is necessary to add things that I could've missed, what you like, what you dislike, etc. For that, check out the "How Can I Help" section below.
A tutorial series that, as the name implies, focuses on teaching programming/logic to people of different skill levels (with an emphasis on beginners) through application. Namely, it will start off using SA-MP as a teaching resource, and eventually adjust into open.mp. It will be available in different languages to ensure it is accessible to as many people as possible.
Programming is a specific application of problem solving, an activity that can be fun for everyone, as long as the correct approach is taken. Most people enjoy games, and San Andreas is no exception; I am not alone when I say that SA-MP was the catalyst for further interest in computers and how to get them to do stuff.
With open.mp around the corner, it is the right time to produce a solid learning resource. The pawn-curriculum is a great resource on its own right, but it serves more as a programming reference rather than a tutorial. Thus, this series will make use of the curriculum where appropriate, using it as an anchor for readers who have grasped the concepts of this tutorial and wish to expand their understanding.
Its main objective is that: a learning/tutorial style tool that teaches concepts by their application.
Like any project, it should achieve its goal through a series of smaller, achievable steps; these steps are the individual lessons. Lessons will follow a general format for the most part:
- 1 sentence description on what will be accomplished
- Code snippet(s) to accomplish it
- Explanation to logic/approach without code
- Explanation specific to the code
Below is the outline of the series. It's split into two sections: appendix, and main. Appendices are like small footnotes that can be referenced at any point in the tutorials (and will be linked to where appropriate). The main section contains the substance of the content, and is split into Chapters. Each Chapter covers some particular concepts, and its respective project will make students apply those concepts.
Appendix A: Just Read It
Introduce the concepts of documentation, and how to ask good questions (question checklist/guide).
Project: List of good questions/searches that could arrive from the chapters
Appendix B: It Will Hit The Fan
Introduce the concept of debugging, different techniques for it, and what to do when things go wrong
Project: Debug some small pieces of code, check against suggestions
Appendix C: It Wasn't Supposed To
Introduce the concept of users, either intentionally or not, misusing the code, and how to guard against it.
Project: Correction of errors of different bits of code in the chapters
Appendix D: Art is Creative
Introduce the importance of creativity in bringing enjoyment with programming, how it drives progress, and how constraints can force creativity.
Project: Come up with an idea, implement it, and then submit it under some special thread in Burgershot
Chapter 0: Jumping in
Addresses initial tasks. Environment setup, getting feet wet/motivated, the right mindset to approach things with. Small modification to boilerplate code to see something happen. The impression needs to happen here.
Project: Race against an NPC in game (mostly boilerplate)
Chapter 1: First Steps
No longer boilerplate code; impression is done, so it can be "boring" - but only for a small window! Introduce printf and basic notion of variables. Showcase them in game. Introduce the need/motivate arrays, do them in printf, and then do them in game. Introduce the need/motivate functions, do them in printf, then in game.
Project: A guessing game to get a random car in game
Chapter 2: Creating Bigger Things
Introduce the need for modules, do them via printf, then in game. Build on previous concepts of variables, arrays, functions.
Project: Two simple modules, one for vehicles the other for money, that let the player go in game and buy a car from a checkpoint.
Chapter 3: Into the Real World
Introduce the need for git and external code/dependencies. Sampctl and git are introduced at a basic level here.
Project: Make the previous two module setup into a git repo, add it to sampctl, and make a simple edit.
Chapter 4: Ex stands for Extended
Introduce the usage of external code by an example of using sscanf and y_commands. Introduce implementing something from scratch: 3rd module, for utilities.
Project: Add an utility command (within utilities module) that allows the user to give themselves a particular weapon with particular ammo
Below is a list of the topics that are covered above, in order (appendices first):
- Thinking for Yourself: Reading Documentation
- Thinking for Yourself: Asking Smart Questions
- Thinking for Yourself: Tackling a Problem
- Thinking for Yourself: Sharing your thoughts
- Dealing with Mistakes: Debugging
- Dealing with Misuse: Leave no assumption unchecked
- Creativity: Its influence on progress and enjoyment
- Environment: Set up
- The Healthy Mindset: A balanced ego
- The Healthy Mindset: Be a sponge
- The Healthy Mindset: How to belong to a group, and why
- The Healthy Mindset: Motivation behind programming
- Keeping Track of Information: Variables
- Keeping Track of Information: Arrays
- Separation of Tasks: Functions
- Separation of Concerns: Modules
- Time Travelling: Git
- Using Existing Tools: Sampctl
- Using Existing Tools: sscanf & y_commands
How Can I Help
First of all, thank for reading this! Despite many overlaps in different people's preferences and learning styles, this is not a tutorial that I'd be designing for myself so your feedback is vital for it to stick well with people. To help, you can reply to the forum topic with answers to the following questions:
- What do you like about the proposal above?
- What do you dislike about the proposal above?
- What would you add/change/do differently?
- What helped you the most when you were starting out?
- What helped you the least when you were starting out?
Thanks again for taking the time to read and response to this topic. I look forward to seeing your responses!