everyone should write a programming language

i know, it sounds completely bonkers. ive been toying with the notion for a year or two, and my original thinking on the matter was more of an ideal than a practical thing.

the first question is, “not everyone can write a programming language.” ok, thats not even a question.

not everyone can learn to code, either. wait, yes– everyone (that can learn to read) can learn to code. they might not be able to code in python, or java– but they can definitely code in something. theres absolutely no question. its a matter of making the language simple enough– and thats a hint.

why, why, why, should everyone write a programming language?

because its simply the best way to learn to code. its not the only way! its not always the easiest way– and if learning how to write a programming language isnt helping the student learn to code, then perhaps do something else.

but here i am, explaining to a good friend and fellow blogger who tells me im very good at explaining programming in plain english (thank you, its a huge compliment) that they dont even have to “learn” to code if they can write a programming language–

i know how crazy it sounds. and this is not the first but the second person ive said it to this week. im starting to think i could even be serious.

of course some people need help to learn how to code– and other people need help writing a programming language.

most people would need a lot of help writing a programming language– but then they wouldnt have to learn the language, get it? they would make it up, and thus skip the whole chore of learning it.

now that doesnt mean they would have it memorised– i still have to look up a command in the language i wrote myself, if im not using that command all the time. ive known most of those commands for more than year but hey, theres almost 100 of them. did i make this one with one parameter or two? oh, right, it had two.

what it means is if they made it up, they understand how it will work. steering them towards keeping it simple could be important, though in some cases it could be better to show them how to do things in a more sophisticated way. some people will find it worth the trouble, others will want an easy way (i sure did.)

if creating a language in python (source-to-source compiler or interpreter) i recommend implementing variables, i/o, simple math, loops, conditionals and functions– if its an interpreter you can put all of it in a loop, and have the exit command simply break the loop. that saves having to implement a real loop feature.

for a long time ive wanted to create a programming language designed to make it easy enough for anyone to create their own programming language.

python is the closest thing to that i know, but i mean something easier.

one of the reasons people dont know how easy it is to create a programming language, is that they start with a parser and try to make it sophisticated. as they teach at brown university– dont! start with functions. its what i did to create my language, and i found out its what they teach. you can add a parser later.

a parser can be simple. as they teach at brown, you can build an api and then have more than one parser for different styles of language. i did it that way because i wasnt trying to build a language first, and i didnt know i was going to. thats how easy it was, done that way– “what if i told you… that a language implementation could be written just like any other program?”

parser, scanner, lexer– cut that out! you need to loop through a string of text (possibly containing newlines) and do things based on what the text says. thats your “parser.” stop trying to make an enterprise-grade general purpose language as your first language, and youll have something to show for it a lot sooner.

people often say these days, you need something to accomplish if youre going to learn to code– an app, or a website. it isnt true! you can just practice little tiny snippets that are fun but dont do much thats useful. people learn that way sometimes.

but if youre looking for a thing to accomplish while learning how to code, try a language implementation! seriously– of a very simple language. you can do it! itll be fun. and it will take less time to learn how to code, because youll end up understanding how languages work before youve even learned your first. and yes, at this point i am completely serious.

 

 

debunking a lot of bunk: coding IS TOO “fun”

soon im going to take qz off my list of places with articles that make sense or check anything they say at all. (wait, have i done that already?)

i guess coding isnt “fun” anymore: https://qz.com/987170/coding-is-not-fun-its-technically-and-ethically-complex/

“ethically complex?” what the heck– i dont think theres anything inherently complex about creating a website, do you? when i was learning to code there was nothing about it that was ethically complex– im sure there are some aspects of publishing software that– could someone please help the author of this tripe get it together?

there are lots of pro-coding articles and a surprising number of anti-coding articles.

  • coding isnt as easy as they say (well its not always, it is certainly possible to make it difficult in some instances, isnt that a good thing?)
  • coding isnt for everyone (define “everyone” and why that isnt possible, please…)
  • coding shouldnt be taught in schools (fine, neither should math. what, i need to state a good reason and you dont?)

 

i have no idea where these people come from.

now when i was a kid and i learned coding, i used to think it made me special. today, im happy to tell you thats a lot of bunk– anyone can code if theyre interested. making it easy and making it interesting are a special challenge for anyone that wants to teach– but thats typical of teaching.

let me tell you something, those teachers that told you everyone needs math are lying. everyone benefits from math if they can do it, but not everyone needs it. it is possible to go through your life without it– just as you can with code. but making a special argument against teaching math in school would be absurd.

most people do not become mathematicians for a living, and most people who learn to code will not spend their lives as a career programmer. perhaps it takes a special kind of mind to code for a living– i dont recommend learning to code for that reason anyway. i recommend learning to code mostly because it will help you understand computers and technology better than people who dont learn to code. and thats a pretty solid argument.

if they tell you it cant be fun, or simply “isnt fun,” theyre lying. or theyre making an idiotic claim, which i will now address:

the article starts off with one of the worst non-factual claims that could possibly be made on the subject:

“the profile of a programmer’s mind is pretty uncommon.”

 

oh, great! taking us back 20 or more years in one fell swoop. thanks walt, youve just rejuvenated an urban legend people are working year after year to kill.

no, programmers dont have a special brain, they have a special skill. i remember a time that i couldnt whistle, but after hearing it explained enough different ways and practicing, i managed (years later.) perhaps that part of my brain finally developed? no! i just learned how to whistle. coding is no different.

the reason i know its no different is because ive done experiments (limited in scope for sure) to teach code concepts to all sorts of people. the thing is, code can be over-complicated. but those over-complications are not requirements that cant be mitigated. because of useful abstractions, almost nothing in code is ACTUALLY required. it varies depending on the task. it can be both fun, and simple, and still powerful.

its really just language. and no one is telling you that it takes a special person to write a sentence. nope, literacy touches every group of people except (and often including) those who are extremely poor and didnt have the best advantages in their youth.

practically anyone can learn to read. if theres an exception, its a true exception– if you can learn to read, you CAN learn to code. but like with reading, how easy it is depends on both the teacher and the lesson. if you have an awful teacher and start with a hard lesson, only some people will manage. that should be obvious, and doesnt prove that learning anything is difficult or “no fun.”

i suck at math, so you know. learning code actually helped me with math a little, though some people will probably tell you that you need to be good at math to code. nope! i needed to learn to code first.

more tripe:

 

” As well as being highly analytical and creative, software developers need almost superhuman focus to manage the complexity of their tasks. Manic attention to detail is a must; slovenliness is verboten.”

so if youve been diagnosed with a.d.d., i guess that counts you out! well, i WAS diagnosed with a.d.d. and even treated for it, but not until id been coding for ten years. i guess all that coding didnt help me focus much– even though its a requirement!

so first they tell you that you have to be a special kind of person, and now weve raised that to be “almost superhuman!” theres more than enough data in these first two claims for the laziest of armchair scientists to debunk the article, but im going to do more of that work for you:

 

“…a quasi-symbiotic relationship between human and machine that improves performance and motivation.”

if i managed a publication that an author on my payroll submitted this to, id be asking for a urine test right about now. this author is high.

 

” When it comes to programming, why do policymakers and technologists pretend otherwise?”

i dont know buddy, its probably for the same reason they pretend that the earth isnt flat, or that the moon landing actually happened.

however, in the second half the article the author nearly admits (just not explicitly) that all that leaning on costly prejudices was more or less click-bait: it was a segue into the importance of the ethics and politics of technology:

 

“In an ever-more intricate and connected world, where software plays a larger and larger role in everyday life, it’s irresponsible to speak of coding as a lightweight activity.”

no it isnt. it it certainly CAN BE a lightweight activity, like playing with legos or scultping with clay. and you can also segue from throwing play-doh at the floor to the ethics of artistic expression, the politics of copyright and the history of propaganda, but sometimes a cigar is just a freaking cigar.

by the time the author admits what hes really saying, his article has done more damage than it makes up for. heres my advice: dont reinforce a load of nonsense to throw in a good point at the end of an article. it shouldve been an article about the negative impact of click-bait on journalism, though its too late for that. heck, if thats what passes for journalism now, i could write for qz and im not even trying. (dont call me, guys, ill call you.)

 

 

thanks to mhneifer for pointing this article out in the first place: https://f7l8c9.wordpress.com/2017/05/25/coding-is-not-fun/

 

what does it take to belong?

We roll into our new neighbourhood cautiously guided by an old-timer, who after we finally manage to maneuver into our RV site, introduces himself as Graham. “Been here since the park first opened,” he beams and then proceeds to point to each of the other trailers and run down who’s who: “The ones behind you […]

via What Does It Take To Belong? — One Woman’s Quest II

ive never cared much for syntax highlighting

code-1839406_960_720

 

syntax highlighting is meant to make it easier to read and manage code. its not intended as training wheels, but a tool for professionals and students alike.

i find it draws attention away– if only a small amount of it– from what im trying to do. there are also at least two problems with syntax highlighting, regarding the colours chosen: first, that the parts of syntax that need the brightest or most vibrant colours (that draw the most attention) follow the same logic for everyone. just for a random example, in the picture above the items in red– a colour used for “stop” and “warning” because it gets the most attention– are the tag names, and the equals sign. a more useful scheme to me would be if = was one colour, and == was a different colour (to make assignment vs comparison easier to spot.)

its different for every person. i dont need the tag names in red– theyre already marked with a chevron to the left. thats what im looking for to find tag names. yes, red certainly makes it easier to find the tags (or equals signs) but the whole time im coding, those tags now try to pull me away from the rest of the code. its not worth the tradeoff.

the other problem with colours chosen is that at any given time, what im really looking for in code is a specific group of things, and it changes based on context. so while im looking for whatever it is that im looking for, (it might not even be syntax) ive got all this colourful noise in the text im searching through. now picture a needle in a haystack: do you want to look for that silver needle in a bale of ordinary blonde hay, or would it be easier if the hay were eight or nine different colours?

i find highlighting very useful for search results– especially multiple results displayed at once:

leafpad

 

but i only use the search feature if a quick look over the page doesnt suffice, and syntax highlighting only gets the way.

im inclined to think that syntax highlighting is something a lot of people just “put up with” because its there, and its “too much bother” to turn off. (most people hate configuring anything in general, unless they need to and they cant.) and im sure its useful at least for most of the people that make it a feature in the editors theyre writing. it would be funny if that werent the case– if everyone thought that everyone else preferred highlighting, so developers that didnt want or need it assumed they had to add it for the users, while users assumed there was benefit (because why else have the feature?)

its even possible that syntax highlighting is a fad, but im sure a lot of people either love it, or think they do. i gravitate towards editors that dont have it, and i will turn it off if i have to.

 

 

hello, fig (based on lambdashire hotpot post)

today i found a particularly charming new entry about “hello world.” i will quote parts of it here and direct you to the original: -> https://lambdashirehotpot.wordpress.com/2017/05/05/hello-world/

“The ubiquitous introduction to a language, the purpose of the hello, world program is to get the user up and running in an environment, prove that their system is working and provide a taste of its syntax and philosophy.”

alright! so lets do fig. fig tries to be the easiest practical language to learn, topping even basic. (basic has an incredible history, is pretty much the first computer language designed to be learned by everyone– logo is the second– and it has few things about it that are worth improving for an educational language. but there are some, and fig does try.)

how to do hello world in fig?

hello

thats great. but we want it to say hello world:

hello “world”

ok, now weve set the variable hello to the string “world” but we want the string to be “hello world”:

now “hello world”

the “now” almost could be anything:

x “hello world”

p “hello world”

helloworld “hello world”

englebert_humperdinck “hello world”

the goal of hello world is to put it on the screen. we therefore add the print command:

now “hello world” print

now for a “lambdashire hotpot”-style analysis of this example: (loved the “‘armless” bit, lh.)

“It’s terse, requires no unnecessary boilerplate and gets straight to the point, which tends to be true of the language in general.”

i think fig works nicely here, though it does require that most lines begin with a variable. on the other hand, fig doesnt require parentheses to print.

“But let’s take a look at some of the implicit assumptions made here:”

“The python executable needs to be available in our environment, and if it wasn’t initially, then we needed to run a simple installer or take a trip to the system’s package manager.”

at least as much is true for fig.

“We need to understand the process of the call-response mechanism that command line interfaces use in order to enter the print command and interpret its output.”

there is an equivalent of this for fig.

“We must be competent in text entry via, perhaps, a keyboard.”

same here.

“This can run on a device somewhere that we have access to, maybe a desktop PC.”

🙂

“We are fluent enough in written English to understand that ‘print’ is a verb and ‘Hello, world!’ is an object. And that the quotation marks in the construct ‘some words’ draws on the metaphor of someone speaking.”

well, fig goes left-to-right a little more often.

“At some point we need to able to take some of this for granted,”

yeah.

“So let’s try taking a look at the concepts presented in the program itself that the user will be expected to understand or learn”

perfect:

“The pattern name(argument) is a statement indicating that the command name will be invoked with the given argument.”

fig is less explicit in this regard (a huge no-no in python. but fig isnt always like python.) the pattern is left-to-right and new variables are on the left, except for block commands.

“The symbol print is to be interpreted as an atom, in this case an identifier representing a named command, which is implicitly always available to the user.”

same here– though the first part is the variable, the second (in this case) is the string it gets set to, and then what to do with it follows after it is set.

in most languages, the function has to point to the object. but by following chronologically, the object is associated implicitly. (again frowned upon in python. but i think both designs have their own merits.)

“The symbol ‘Hello, world!’ is also to be interpreted as an atom, in this case a string of characters in which whitespace does not act as a separator.”

same here!

“Defining string literals is likewise always available to the user as part of the language.”

indeed, a string literal in fig is either a function parameter, or it overwrites (sets) the default 0 value of a new variable.

“The act of entering a newline causes the command to be evaluated and run.”

the act of entering a newline indicates a new line (and very likely a new variable also.)

“The double-quotes are not included in the output, so there is some difference between the representation of the underlying string and the format of the glyphs that form the output.”

also the same in fig, as well as many other languages.

“the action of printing to the console occurs as a ‘side effect’ – something that cannot be expressed in the language directly.”

hmm, i think ive conflated “state” with “side effect” for too long. is there any sort of i/o that doesnt qualify as a “side effect?” (not a rhetorical question.)

“That’s actually quite a cognitive load! And we’ve not even got into other ‘simple’ concepts such as numbers, variables, sequential execution, conditional execution, loops, and function definition…”

well, youve overexplained it. but i enjoyed it. fig was designed specifically around the concepts of:

* variables * input * output * basic math * loops * conditionals * functions

lets find out how that matches your excellent list:

(y) numbers
(y) variables
(y) sequential execution (well it does go left-to-right)
(y) conditional execution
(y) loops, and
(y) function definition…

“It’s very easy to forget how hard the first few steps can be, and Python is one of the simpler entry points.”

i agree. i coded in basic for a quarter century, and spent years looking for the best “21st century basic” dialect. i settled on python, and also used python to write fig.

i believe im also your first follower– i hope you enjoy this platform, and write more.

cheers.

 

Lambdashire Hotpot

Welcome! This is a blog about programming. And what better way to begin a blog about programming than with a clichéd post about Hello World? The ubiquitous introduction to a language, the purpose of the hello, world program is to get the user up and running in an environment, prove that their system is working and provide a taste of its syntax and philosophy. So let’s see what we can learn about some contemporary languages from how they present us with this allegedly straightforward task. Today, it’s the turn of everyone’s ‘armless snaky friend, Python.

Python

Hello world in Python is simple, right?

It’s terse, requires no unnecessary boilerplate and gets straight to the point, which tends to be true of the language in general. Excellent. We are encouraged to run it in an interactive mode to begin with, so let’s do so.

Like I said, simple! But let’s take a look…

View original post 532 more words

bossy happy people

 

this one is for connie. (who is not one of these people at all.)

i dont like the bossy happy people that have sprouted up. they dont just want everyone to be happy– they demand it. and if they cant demand youre happy, they demand you act like youre happy. or just go away.

but really, f*** that. mandatory positivity isnt just fascist, its mediocre.

in the old days, well-meaning people tried to cheer you up. they werent pushy about it, they didnt feel entitled to you putting a happy face on for them. (well, maybe your parents did. your friends didnt.) they might offer you a hug, or do some other nice thing for you. thats real charity– you dont owe them anything in return. you dont have to feel better if you dont.

this new happiness offers so little. it just demands people put on a show. this is a new sort of entitlement that has crept into popular culture during my lifetime, though perhaps some people felt it in the 70s and 80s. it even reminds me a little of certain cults that require people to either be happy, or pretend to be. some of it i believe can be traced directly to cults.

but whats different about it is that you used to be able to leave that sort of thing just by walking away from whatever group of people really believed that crap. and now, its like they arent in their own little groups and subcultures anymore. theyve gone mainstream, thats the real change. theyre everywhere. there could be bossy happy people right around the corner, lurking!

you know what? im not offended by your smile. if its real, let it shine. if its fake, i want to get away. if you expect me to fake it just so i can stand here, why dont YOU go away? but have yourself a *lovely* little day.