everyone can learn to code (fig + others)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
learnhow2code

everyone can learn to code (fig + others)

#1 Post by learnhow2code »

i coded in basic for 25 years. here is linus torvalds talking about what its like to learn basic: https://www.youtube.com/watch?v=S5S9LIT-hdc

here is the program in the video:

Code: Select all

10 PRINT "SARA IS THE BEST"
20 goto 10
for some reason, when he runs it there are no newlines output, so it really looks more like 10 PRINT "SARA IS THE BEST"; (with a semicolon.)

in early 2015 when my debian project was put on hold, i started working on a programming language designed to be "the easiest language ever." obviously that depends on whats important and whats difficult: if youre trying to learn memory management, learn c.

i wanted the language ("fig basic") to be usable for teaching the following concepts. if you can use a computer, you can probably learn them too:

* 1. variables, including arrays
* 2. input
* 3. output
* 4. basic math (2 + 2 = 4, upper-case "p" is ascii 80)
* 5. loops
* 6. conditionals
* 7. functions

fig has about 100 commands and punctuation is optional ( ) | ; : = ,

except for "strings of letters go in double quotes" and # hashes mark comments. decimals do what you would expect: 2.5 plus 2.5 is 5.

fig is also designed to get people more familiar with the command line, through simple tasks:

* compiling a program
* starting the program
* (not actually on the command line, but in the cli) running the program

if you install pygame, fig has a graphics window and a LINE and PSET command. (a public domain circle routine can be found here: http://www.murga-linux.com/puppy/viewtopic.php?t=107170)

if you dont install or have pygame, fig will use ansi in the term to do LINE and PSET (and the circle routine.) you can see what thats like in this video snippet: http://i.imgur.com/uslBGBo.webm

like older versions of basic, fig isnt case senstive. unlike almost any basic dialect, it starts almost every line with a variable. just use "p" or "x" or "z" if you dont want to think of a variable all the time. i often use "now"

Code: Select all

now "sara is the best" print
it just goes left to right. heres how to make the variable contents uppercase before printing:

Code: Select all

now "sara is the best" ucase print
"print" means "put on the screen." its an old basic / teletype thing; it used to print onto actual paper.

i tried teaching basic to friends, spent 5 years looking for a suitable basic alternative, found python, tried teaching python to friends.

trying to code gets a lot of people lost. fig is designed (both sematically and in terms of core subjects) to go in a straight line, so that after the basics are understood, the coder can move forward in one of several ways:

* transition to python or bash through figs arrshell and python commands
* learn another language
* do website / html / css / etc
* write a simple programming language (seriously)
* add routines to fig to create their own derivative

i also have a series of short stories related to the 7 programming concepts, which do not lean on code but make it easier to explain how programming works.

learning how to code wont necessarily prepare you for a career in coding, but its a first step. it will also help you understand computing, which for too long was being "trained instead of taught" and we are finally getting back to teaching again.

as for why fig is not drag-and-drop coding: there are usable drag-and-drop environments already. i wanted to make a language that made writing code as easy as possible, i didnt want to start with an ide.

fig tries to be the easiest language ever (if you arent familiar with the basics: http://imgur.com/oZ0zc1M -- it may not appear to be easy to understand at first) but its meant to also encourage coders to try to write an easier language. thats what the sig in my post currently talks about.

everyone should learn how to code. whether its fig or python or js or c, each language has strengths. figs (i hope) is that it will be easier to teach the largest number of people how to write and understand code.

Image
Attachments
puppyfig.png
(62.57 KiB) Downloaded 190 times

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#2 Post by nic007 »

Why should everyone learn to code? I'm a general computer user and quite frankily have other interests and specialities (and will find coding boring). For most using puppy it is good enough/beneficial to know how to write a very basic bash script. That's about it for me.

learnhow2code

#3 Post by learnhow2code »

nic007 wrote:Why should everyone learn to code?
it will help you understand computers, it will help you understand modern laws (and your rights as a computer user,) it will make you a better user.

I'm a general computer user and quite frankily I have other interests and specialities
thats fine. please note when i say "learn to code" i do not mean "become a professional software developer." i mean "understand coding basics that can be learned in about a week to a few weeks."
(and I will find coding boring).
that is not your problem, that is the problem of instructors and developers. its being worked on. im very interested in what people find boring or tedious about coding, and trying to find ways to fix that. (still not your problem. though i am interested.)
For most using puppy it is good enough/beneficial to know how to write a very basic bash script.
writing a basic bash script (depending on what you mean by "basic") is already more complicated than what im saying everyone should learn.

some of the most basic bash scripts do the equivalent of:

* function calls
* input / variable setting using read
* output using echo
* loops using for

in fact here is a (similar) bash script version of the example code in the screencap:

Code: Select all

# bash                                           # # fig
for y in $(seq 0 15) ; # public domain           # for y 0 15 1 # public domain 
    do for x in $(seq 0 15) ;                    #     for x 0 15 1 
        do echo -en "\x1b[$((y+30));$((x+30))m"  #         now colortext x highlight y
        echo -en $x                              #         now x prints
        echo -en "\x1b[0;37m"                    #         now highlight 0
        done                                     #         next
    echo ""                                      #     now "" print
    done                                         #     next

not exactly the same but you get the idea. i like to teach a language that can go a lot further, and fig and python can, but one can definitely TEACH all 7 concepts using only bash. i worked on that prior to fig.

but youre already using puppy and gnu/linux, which means youre automatically going to be exposed to so much of the stuff im talking about.

i do think some of my lessons might help you in your bash scripting, but thats beside the point of "why should i learn to code?" youre already learning. im talking mostly about people that do less than you already do. it would help.

cheers.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#4 Post by nic007 »

The point is why would they be interested to learn? Most people just use things that work for a certain purpose and care less about how it is working. You don't need to know what is going on under the bonnet, the important thing is that the car takes you from point A to point B. This is one of the main reasons why most people use Windows instead of Linux, it's more (or perceived to be) more user friendly.

learnhow2code

#5 Post by learnhow2code »

.
Last edited by learnhow2code on Tue 28 Jun 2016, 07:41, edited 1 time in total.

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#6 Post by Burn_IT »

Everyone should learn to code!
Not because of computers necessarily but because of the mental discipline involved in writing good code.
The discipline is the same for all sorts of things that people do during their lives - though in the vast majority of cases they don't realise or think of it.

It is all about analysing and planning tasks.
"Just think of it as leaving early to avoid the rush" - T Pratchett

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#7 Post by nic007 »

Most people are just not interested and have better/more important things to do... Sorry to burst your IT bubbles, coding is just not of interest to most of us.

learnhow2code

#8 Post by learnhow2code »

nic007 wrote:Most people are just not interested and have better/more important things to do... Sorry to burst your IT bubbles, coding is just not of interest to most of us.
why are you so interested in arguing that something isnt important because you dont find it interesting? this is both a non-sequitur (personal interest and importance are not synonymous) and a contradiction: if no one is interested, there is no need to try so hard to dismiss it as "unimportant."

it is a real problem that more people are not interested. i already pointed out that the onus is on developers and teachers to make it interesting-- you respond by saying "sorry, im just not interested." like thats the only part you care about. why come here to say that over and over until we do what? agree that we dont think its interesting either? it is the duty of teachers to try to create interest (but not to prove that things are interesting, only to encourage.)

no one is going to twist your arm. but despite your lack of interest, you already admit youre doing MORE yourself than anyone is claiming is necessary. you are basically saying "no, i refuse" to something youve already done... you already know how to do a basic bash script-- ok, youve done enough i guess-- why even protest then? its very confusing. what are you trying to prove?
Burn_IT wrote:The discipline is the same for all sorts of things that people do during their lives - though in the vast majority of cases they don't realise or think of it.

It is all about analysing and planning tasks.
what i like about the part i bolded is that learning to do it "on purpose" helps people understand (and improve) processes theyre already involved in using.

i do more planning than i used to, but even now i "shoot from the hip" when it comes to these things.

it starts with "just doing something" and where i apply the processes and planning is in the evolution of the project im working on. this is partly ouf of being lazy and partly out of the fact that im (personally) capable of doing more when i start with whats easy and work "up."

there are more than enough examples of situations where planning from step 1 is vital-- the best example i know is the space shuttle. but even the wright brothers started with what they knew, built, planned, refined, built, planned, refined.

learning to code can take a very disorganized person like myself and at least teach them to better organize things sometimes. 10 years ago, the most organizing and planning id ever done for any project was for a very large BASIC tutorial.

function definitions (or in the world of oop, objects/object methods) will save you more trouble than any other feature i know, once planning becomes important. you can even use them to detangle an existing mess, which isnt necessarily the best approach but it beats leaving it tangled.

i used to think that was elitist or "a solution in search of a problem." and that is what it looks like, until you encounter the problem and go "oh! wait this will help..." i fought function definitions for > 10 years, until pythons easier syntax for them (yes, easier than basic) made them quite trivial:

Code: Select all

' basic              ' # python                # # fig
function fname()     ' def fname():            # function fname
'code goes here      '     # code goes here    #     #code here : return rvalue
fname = rvalue       '     return rvalue       #     fig
end function         '                         # # indentation and ":" optional
i still think function definitions are a great first step towards creating your own language. this is true in bash, in python, and also taught at brown university: https://www.youtube.com/watch?v=3N__tvmZrzc

but short of creating your own language, being able to call a command designed for your use can make a lot of coding less tedious and repetitive, completely counter to what it looks like when you first encounter function definition syntax! it isnt a guarantee, but functions are a gateway to organized and maintainable (and even easier to write) programs. the trick (an important one) is to make them friendly and easy enough.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#9 Post by technosaurus »

nic007 wrote:The point is why would they be interested to learn? Most people just use things that work for a certain purpose and care less about how it is working. You don't need to know what is going on under the bonnet, the important thing is that the car takes you from point A to point B. This is one of the main reasons why most people use Windows instead of Linux, it's more (or perceived to be) more user friendly.
It is more important to have interdisciplinary knowledge, but if you work wiith computers, programming should be a part of that. If for no other reason than it can save you a lot of work. One of my first computer jobs in the 90s was database entry copying data from one system to another (paid per record) ... after the first day of the most boring job ever, I had a pretty good idea what was going on under the hood, so I went home and wrote a program to do the work for me. I finished my whole dataset the next day and they gave me the rest of the data to finish the next day. I got a bonus for finishing early and training one of the secretaries to use my program .... but hey, if you're cool with doing boring repetitive tasks, by all means, don't learn to program - its hard.

The level of programming knowledge needed by the masses is small. Not everyone needs to know how to implement low level networking protocols to use multiple CPU cores and GPUs, but most people that work with computers would benefit from a basic enough knowledge of programming to handle their boring, repetitive tasks to improve their quality of life (and/or productivity).
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

learnhow2code

#10 Post by learnhow2code »

The level of programming knowledge needed by the masses is small. Not everyone needs to know how to implement low level networking protocols to use multiple CPU cores and GPUs, but most people that work with computers would benefit from a basic enough knowledge of programming
exactly.
Last edited by learnhow2code on Tue 28 Jun 2016, 07:42, edited 1 time in total.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#11 Post by nic007 »

What i know is what any general computer user would know and learn after having used a computer for a period of time, the basics, to do things you want to use the computer for. I do not need to know more to complete the tasks I'm using the computer for. That's it for the general computer user, no need to know anymore unless you are really interested in exploring further which most people interested in other fields of practice are not. That's why we have doctors, lawyers, architects, accountants, etc. The thing is people will not do something if not interested in the subject harsh as it may sound for your IT guys.

learnhow2code

#12 Post by learnhow2code »

.
Last edited by learnhow2code on Tue 28 Jun 2016, 09:12, edited 2 times in total.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#13 Post by nic007 »

You missed the etc. The point is most people use the computer as a tool (and mostly to do repetitive tasks) in order to do their real jobs. It's a bit like driving your car to work so that you can get your real job done. It's a tool, a machine. If coding floats your boat, go for it. More competent students to do what?

learnhow2code

#14 Post by learnhow2code »

.
Last edited by learnhow2code on Tue 28 Jun 2016, 07:44, edited 1 time in total.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#15 Post by nic007 »

Of course going on a course to learn the specific functions of a certain programme (like power point) is beneficial to the user of such programme but that has nothing to do with coding or wanting to know what is going on underneath the bonnet. That's the point.

learnhow2code

#16 Post by learnhow2code »

nic007 wrote:Of course going on a course to learn the specific functions of a certain programme (like power point) is beneficial to the user of such programme but that has nothing to do with coding or wanting to know what is going on underneath the bonnet. That's the point.
powerpoint useful to teach, coding useless to teach. gotcha. i honestly hoped i wasnt being unfair when i summarized your position with that. guess not. probably not going to get any of the serious questions i asked answered either, but ok.

want to repeat your thesis one more time? i mean im addressing you, so it might be time to arbitrarily dismiss a point about education as "pointless" again, based on some appeal to, i dont know, i cant relate to what youre saying.

go ahead, then maybe i can stop wasting the bandwidth of talking to you.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#17 Post by nic007 »

No need to be aggressive. It seems you have some comprehension problems (which will do you a world of good addressing). I never said coding is useless (afterall we wouldn't have computer languages if it wasn't for people doing coding). What I'm saying is that it is of little or no interest to the general computer user. Is that too difficult to grasp?

learnhow2code

#18 Post by learnhow2code »

nic007 wrote:No need to be aggressive. It seems you have some comprehension problems (which will do you a world of good addressing).
really, now? cheers.
I never said coding is useless (afterall we wouldn't have computer languages if it wasn't for people doing coding). What I'm saying is that it is of little or no interest to the general computer user. Is that too difficult to grasp?
im pretty certain you have conflated those two things in any reply where both were mentioned-- and possibly in some where only one was mentioned. if not, then i certainly did not mean to treat them interchangeably. only that your position seems to have no basis other than deliberately swapping these two words for each other. i may have imagined it while trying to figure out what your game was.

in any case, i asked quite a few questions, and you answered at least one or two, hopefully enough times for me to understand your position on this. so thanks for that. whether its my problem or yours however, i simply cant twist your replies into something i would generally consider either honest or thoughtful-- but you could certainly be right! i hope that satisfies you, have a great day.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#19 Post by nic007 »

How many general computer users have taken up on your offer to learn a new (or any) computer language? That should give you an idea.

learnhow2code

#20 Post by learnhow2code »

nic007 wrote:How many general computer users have taken up on your offer to learn a new (or any) computer language? That should give you an idea.
you would be surprised. i am fairly dedicated to this idea, but also to the larger idea it is based on. as i have painstakingly tailored it to the needs and fancies of the demographic i had in mind, ive had more luck getting them to try / follow it than i do talking to people with more established opinions.

on the other hand, an older coder thought it reminded him of pascal, and ive used it to reverse at least one ubuntu users opinion on whether programming is "hateful" or not. ive gotten people to learn and understand more about programming with this than trying basic and python with the same individuals. (although obviously i like python, as i used it to write the compiler in question.)

but as i said, getting established coders (like yourself) to appreciate it is more uphill. not entirely surprising, i just have a feeling when im getting a reply with substance or not. youre obviously capable of constructing arguments and appeals with substantial reason and logic, hence my frustration before-- i felt i was being short-changed. i do not require you to agree, and i didnt.

what use do i think this has for coders? perhaps none except for the ones who wish to teach (or want a new challenge, or like shortcuts.) i think bash is very good for everyday tasks, up to a certain level of some kinds of work. if my own language was a replacement for bash, it wouldnt need two "shell" commands. it is at least useful to me, when i teach-- but it provides numerous shortcuts to things i grew tired of doing by hand. so i use it a lot despite 30 years of programming experience. its still an educational language, inspired by basic and python and logo.

Post Reply