free software resistance
the cost of computing freedom is eternal vigilance
### tcoyc-what-even-is-a-software
*originally posted:* dec 2023
the free software foundation never did enough to get people into coding. like many people who know more about coding than teaching, the fsf focused on getting people into languages that would directly help the cause, rather than first making it possible for as many people to learn coding as possible.
its true that not everyone is going to learn to code on a level that is very helpful to free software- at least directly. but coding is a fun hobby for many, and the more people who can code enough to at least appreciate the value, the more people will be prepared to fight for software freedom.
one of the problems with learning how to code is that many coders dont know much about how to teach, and many teachers dont know much about how to code. the way most teaching works, sadly, does not depend on either the teacher or the student really understanding the subject- it depends mostly on learning enough about something to produce successful test results, rather than a practical understanding.
the two are not mutually exclusive of course, and many who do succeed academically will understand the subject. a common misunderstanding is to accept the artifacts of a programming language as definitive or universal, when every higher level programming language is really just a tool to produce lower level code so that the computer can do what the user wants it to.
this isnt to paint every complexity of coding as a useless gimmick, not at all. just as a primary schooler will be able to understand a primary school level introduction to physics and shouldnt wait until university to begin learning, a primary schooler ought to have an introduction to coding before university to make it easier if they want to learn more for a career in development, research or some other related field. many non-developer careers benefit from some level of coding experience, whether the coder is a scientist, librarian or most certainly, a teacher.
but while people are finding new ways to make programming more powerful for those who are skilled enough to use languages heavy on math and complicated algorithms, there are more people who just want to tell the computer to do something without having to sit behind the mouse and point, click or tap every step that the computer takes.
computers were built for automating tasks, and you shouldnt have to sit and drive the whole way from the beginning of every task to its completion.
but if everyone is going to learn some level of coding, we should at least make that level useful, simple- and if possible, fun.
what makes programming fun is doing tasks that may not always be useful. for me, it was often making programs that produce graphic designs. at age 7 drawing a "cone" made of 5 or more circles was a cool trick, but later on, using my own programming language, i made a cone that had a colour gradient and a spiral going up the side. i was able to do such things years before that, but the fact that my own programming language was up to the task made me happy.
another thing thats fun is making the computer respond to input with colourful or inappropriate words and phrases. we can pretend to be better than this, but i figure if 100 years from now people are still learning how to write computer programs, people are still going to make programs that fart or swear at the user.
languages that make it easier to produce games are also good. the one thing im wary of with game languages is they often lack more general purpose features that would allow the coder more customisation over logic or output. a language made specifically for EASIER game design that also let you make things other than games could be a powerful tool for teaching. it might very well lack instead features to make more powerful games- but i think thats a worthwhile tradeoff, given that languages for creating more powerful games always exist, and people have to start somewhere.
but how do people code? and how do people learn? what ive seen many introductory classes do- and some people manage, but this approach leaves so many people behind when it could actually give them an introductory understanding, is that a commercially viable language like java or c++ is broken into artifacts, which are imparted to the student to figure out on their own and apply, get a score or fail.
features are explained, but not in a way designed to ensure understanding or a broader and practical concept of usage. instead, corners are cut for the sake of time and also to obscure any lack of understanding or methodology by the instructor, and many students scrape by only to hate coding, never wanting to go near it again. this is a disservice.
i had similar experiences in school with a number of subjects, but i have seen other people suffer the same difficulty with coding. since i taught myself how to code, i was spared the agony of poor instruction and high demands.
years ago, i went through all the commands available in my favourite language, and produced a simple tutorial for each command i actually used in 20 or so chapters. later, i designed my own language based on similar features and command names.
one of the worst things you can do to a student is start with object oriented coding. this is exactly what schools do with java, because as a language, java forces you to do everything explicitly with objects and classes.
javascript is a bit more lenient, but is more tedious and peculiar in its approach than someone should have to become familiar with for their first coding experience- its not that you cant learn javascript first, just that javascript isnt an ideal first language. its a great language to learn second, if you started with an easier one. then when javascript is particularly tedious about something, you already know that not every language is so demanding or obtuse.
many more languages are object oriented, including python- but unlike java they do not force you to use an object-based paradigm when coding. everything in python is an object, but you can code in python for years and never once write an object class unless you want to.
the logic people who start with objects must use is, youre going to have to learn it anyway, you might as well start now. but the lesson that objects are mandatory or universal is misleading, and objects make complex tasks easier and simple tasks more tedious.
its better to show that simple tasks can be simple, than start in hell and make everyone think thats what coding has to be. some people hate java, and if they thought all coding was like that they would hate coding and never want to learn it again. this is not hypothetical, though fortunately ive coded in javascript and never in java. i have dated people who can code in java, and they didnt enjoy it either.
instead of starting with the more complex and optional paradigms, i start with the easiest options possible. i teach the following concepts:
1. variables
2. input
3. output
4. basic math
5. loops
6. conditionals
7. functions
by itself, setting a variable does nothing useful at all- the simplest demo program must at least have output or the user will never know what happened. this is why "hello world" programs exist but a program to only set a variable is something most people will never bother to run.
nonetheless, its one of the most necessary and useful features of coding to understand: its just giving a name to a piece of information. the way i describe it is having a friend named mike, and you tell mike to remember something for you, and tell you what it is later.
"hey mike, remember the colour blue for me okay?"
"sure, whatever."
later you ask mike what you asked him to remember, and mike says "blue".
in many languages, it would work like this:
```
mike = "blue"
```
mike is the name of the person, or the variable, and "blue" is the thing we asked him to remember. arrays are simple too:
"mike, remember three things for me, okay?"
"i guess, okay"
"5, pickle, 3.14."
"whatever."
then later you ask, "mike, whats the first thing i asked you to remember?"
"5."
in the python language, that would look like this:
```
mike = [5, "pickle", 3.14]
```
and asking for the first item would look like this:
```
print mike[0]
```
we are asking for the first item mike remembers for us, and array indexes (thats the number of the item we want) tend to refer to the first item with 0, the second item with 1, and so on. some introductory languages index starting with 1 because it makes more sense to beginners.
if you want to name all your variables after people you can, but most programs use many variable names and it definitely makes more sense to name your variables after concepts, rather than people:
```
phone = "555-its-unix"
```
input is something you do every time you use the keyboard, mouse or tap the touch screen, and output is when information goes from the program to a device like the screen, printer, speakers or network.
it helps a lot to have variables, because for example, when you want to get information from the keyboard often the first thing you do is set a variable to store the information you input from the keyboard:
```
phone = raw_input()
```
thats a command from python 2, in python 3 you would just use input() instead of raw_input(). the parentheses are not required in every language, but for python they are required for this.
instead of setting the phone variable with specific data in quotes or numeric form at the time of coding, you let the user set the phone variable by typing something and hitting enter.
when we told the computer to print mike[0], thats an example of output- it tells the computer to output the first item we asked mike to keep track of for us.
the nice thing about math on a computer, is that the computer does most of the math for us. it can add, subtract, divide and multiply for you, if you simply ask it to do so. it can also do more complicated math, if included functions exist such as finding the sine, cosine- or any custom task that can be expressed in code.
functions are the most complicated thing i teach as an introductory subject, because they arent as intuitive as other features unless youve used them enough times to see the point of them.
just as you can give a name to a piece of information, and this is called a variable- you can give a name to several lines of code, and call it a function.
lets say you want a command that adds several numbers, counts those numbers and divides by that count- a simple command that finds the average or "mean" of numbers. in python it could be done like this:
```
def avg(p):
total = 0
for each in p: total = total + each
return float(total) / len(p)
```
the goal of this chapter isnt to teach you python or explain how to write a routine that averages numbers, for now its just to show you what a function is.
we dont technically need a function called avg at all- we could avoid functions altogether, and just use this code every time we wanted to average numbers:
```
p = [5, 8, 9, 1]
total = 0
for each in p: total = total + each
p = float(total) / len(p)
```
that turns an array of 4 numbers into the mean of those 4 numbers. so why have a function at all?
there are many situations where you want to do the same thing over and over, in various or even unanticipated points in a program. rather than copying the same code to every place those commands are needed, its easier to define a function once, then we can simply say:
```
mean = avg([5, 8, 9, 1])
```
not only does this mean we dont have to copy the same code used to create our "avg" command every time want to use it, it also means we dont have to keep track of other variables in the function like "total" and "each".
functions are like las vegas: what happens in a function, stays in that function. you can still use variables "each" and "total" other places in your program, and calling (that means using) your new avg command wont affect what the rest of your code is doing.
this is a huge help when you write bigger programs, you dont have to keep track of what happens in a function, only the "parameters". thats the "p" in avg(p), its a variable that sends information into the function- and the return data- thats the "float(total) / len(p)" after the return command- return data is like the photos you maybe shouldnt have taken when you were in vegas.
if that makes this sound like programming is complicated, dont worry. making your own functions is still optional, and when you actually need them youll be glad they make things easier for you.
when you have a big program and too many loops in loops or conditionals in conditionals, youll be thrilled that functions let you move some of your more tedious code to other places in the program where they wont distract you as much- and you wont have to keep track of as many variable names.
loops and conditions are easier than functions. suppose you want to say "hello" 5 times- a pretty useless example, but very easy to demonstrate. you could do it like this:
```
print "hello"
print "hello"
print "hello"
print "hello"
print "hello"
```
and if you want to do something 100 times, then you just copy that line 100 times! or you could do this:
```
for each in range(100):
print "hello"
```
instead of saying 100, you could also get the number of lines of a file- by loading that file into an array, then you can do the same thing to each line of text in that file.
a conditional is like a loop that runs either 0 or 1 times, depending on whether a value is in a certain range, or whether it matches another value.
lets say your computer only wants to talk to steve. we dont have to know why, we can just have it ask someones name and then respond if its steve:
```
friend = "steve"
print "what is your name?"
n = raw_input()
if n == friend: print "hi, " + n
else: print "go away, " + n
```
this is sort of how passwords work, too. a good password program will not store the actual password though, it will store an encrypted hash of the password and see if the hash of the input matches the hash of the password that is stored.
this chapter has already explained variables, input, output, basic math, loops, conditionals and functions- but only to give you a taste of what these things are. a good tutorial would take more time and give at least slightly better examples.
for one, our example of a conditional included an else command, but else is optional. a better tutorial might first show a simple conditional without else, then after that show how else can be used the way we just did.
a better tutorial might show more examples of how these features can be used together, like how you could use a conditional in a loop to "break" the loop only when certain values match.
but this isnt meant to be a tutorial, its simply meant to quickly demonstrate an example of each of these features and say what the features are.
i believe that if we want students to do better, we must have two things: first, we need more languages that have the first priority of making these concepts AS EASY AS POSSIBLE for beginners to apply in a USEFUL way.
im not against games that introduce concepts but they offer the satisfaction of getting something right, not in applying it in a way that is actually useful, or can actually be seen to work with a real language. in games it is generally a simulation, like a quiz with graphics and sounds. i want to make someones FIRST language as easy to use as possible.
also, im not against drag-and-drop coding, but i do worry that many people wont feel like its coding even though it definitely is. the way to make coding with text as much like drag and drop coding as possible, is to have fewer commands (preferably every command would fit on what computer users call a "cheat sheet") and LESS SYNTAX.
the only "syntax" required in drag and drop coding is where the pieces fit and which place you put the data or variable names.
we need to make it as easy as possible for students to teach themselves. once youre satisified that you understand the basic concepts of coding, you can learn more syntax and more complicated examples of those concepts, even in other languages. have at least one first language that can be truly mastered, that covers the basics.
second, we need to make it as easy as possible to instruct teachers, and have them really master a first language too. many a teacher who mostly understands the lesson will fake their way through the rest or tell the student to teach themselves.
throwing people into the water is one way to teach swimming, but if you want the biggest number of people to enjoy their introduction to coding comfortably, i think its better if the teacher can answer every possible question about the language- without faking it.
not everyone is going to love coding, but if everyone had a better indtroduction, more people are likely to appreciate the value of the subject- and more people are going to be better equipped to fight for free software.
believe it or not, it takes a very small number of features to do amazing things. with only variables, input, output, basic math, loops, conditionals and functions, not only can you make practically any program there is- you can also use these features to make other programming languages, and translate "source" into target code, for example translating your own code of your own invention and design into python, or javascript, or c.
then you can make programs in your own language, and run the output in python, or a web browser, or translate them to c and have c compile it into standalone code that the computer can run without python or a browser.
ultimately, this is how programs are made- thanks to grace hopper, we have command names. sometimes a simple command like "cls" needs no other information, cls just tells the computer to clear the screen or the term window. (in bsd and gnu/linux, "clear" will do the same thing from the term window). other commands, like our "avg" command, need a parameter- like the "p" that lets us give avg an array of numbers to find the average.
programs too, have a name (its the same name as the file that runs the program- for example, the command that runs tor browser is simply "tor-browser" with no spaces) and programs often accept parameters, such as the name of the file or the url of the website you want to open.
interactive programs will let you input that information later, but if you can pass that information as a parameter, you can automate more of your tasks. then while other people are pointing and clicking every step of the way, you can go make a sandwich or talk to some of your friends- and let your computer do more of your work for you.
license: 0-clause bsd
```
# 2019, 2020, 2021, 2022, 2023
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org