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/


educators should help design languages for coding

off topic aside: dear wordpress, please move it back to the left. thats terrible over there! how many websites do you know of that put stuff like that on the right? ive right-justified this paragraph to exaggerate how absurd the move is. oh… and now everything on the reader is off-center, why?


amidst the idea that coding is just about teaching logic (and the suggestion that we put more time into the abstract than the functional,) lets talk about the benefits of actual coding.

for many educators, they already struggle with the problem of connecting “how are we going to use this?” with coding. incredibly, they already know one of the answers: coding is great for teaching people to problem-solve using logic.

its also good for getting people to finally “make friends” with their computer. instead of trying to point at stuff to make it do things all day, coding brings the computer in as a real ally and workhorse. instead of telling an application to talk to the computer, youre talking to it yourself!  coding is the shortest and straightest route to digital literacy.

but even though it helps solve (or even prevent) computerphobia, the fact that some educators are mildly computerphobic– and notice it in their students– leads them to say things like “wait! this is good for teaching logic– cant we just teach logic instead?”

now youve not only thrown out the bathwater and baby, but the bathtub as well! and youve thrown out the tool that was so great for teaching logic– even with practical everyday applications.

dont forget, coding actually produces something. it may not be the next version of windows or even the next popular video game, but it has results that people can look at and even reuse– how many school assignments are like that, really? theres only so much room on the front of the icebox.

laura has the right idea: make tools easier to teach with, rather than shy away from using any actual computer tools. https://codeboom.wordpress.com/2017/01/07/gui-zero-making-python-guis-really-simple/

thats also the idea behind the fig language– but this isnt about just fig. fig was intended as an example; i also use it, but fig was meant to be one tool that makes it easier to learn coding. there are several!

nonetheless, fig is a showcase of ideas that can make coding more forgiving, and easier to learn. it even throws one of those ideas away– in basic, if you ask for the value of “x” and x wasnt set, it gives you 0.

python and javascript will give you an error instead; very few languages have ever given you 0, and even modern(ized) users of basic will discourage it or use a compiler option to make that give an error.

i could have made fig return a 0 for unset variables, but some error messages are actually helpful. heres what fig does instead of giving you 0:

each_line_starts_with_a_variable  “hello world”  ucase  print


a few special commands (block commands mostly) start without a variable, but other than that its a standard in fig. and naming the variable at the beginning of the line sets it to 0, but you have to actually name it before you can use it. then you can do all you want with it on that line, and the value persists– until you start a line with it again. if you want variables to persist, switch to another one after using them:

x 37

y 28

now x print

now y print

x # now x is 0 again


what it doesnt do is let you name a variable later on in the line, if you havent used it already. then you still get an error:

fig 4.1, jan 2017 mn

1 now p print

error: variable or function not created, but referenced… “p” needs to be set before first use
error in line 1:
now p print


why do you want an error? the same reason you want your spellchecker to underline thisword in red. its trying to help!

writing helpful error messages is an art (not one im claiming mastery of, either.) most error messages will presume you already know enough about what youre doing that youll at least understand the error message. it would not be impossible to make a system for coding where the error messages would offer to teach you how to do anything properly that you did wrong.

if theres room on the screen, you could offer a simple example of something that works instead. you could even offer an interactive tutorial. however, the more information you add to an error, the more someone might think “oh, no! look at all that– this is really bad!”

a kernel panic really is bad: https://en.wikipedia.org/wiki/Kernel_panic

for one thing, it means anything you havent saved… however after you turn it off and reboot, it will probably be alright otherwise. an average user might get a kernel panic once or twice a year (if that,) unless your electric lines are noisy.

when youre programming, most error messages mean “you typed something in wrong.” thats ok! find it and fix it. it will often tell you where, and figuring it out is part of coding. it also teaches you one of the most valuable applications of that logic they want you to learn: debugging.

of course, once youre not afraid of error messages, youve overcome one of the things that the average user lives in fear of– a message that says “hey, somethings wrong!” and they dont know what it is. and that is a great reason to learn coding!

but educators shouldnt throw away these tools– by all means, add more. but its rare to offer such a strong connection between learning concepts and applying them as there is with computing. dont squander it! use your voice– online or with computer-savvy associates– to talk about what would make the coding experience easier, without throwing the whole opportunity away.



Why Our Kids Must Learn to Code | Mark Heninger

i reblogged this over my post on writing a programming language: https://codeinfig.wordpress.com/2017/02/07/how-to-write-a-programming-language/

i think its really important for people to think about this– some of you already know how to code. its good to know why you should help other people get there, if you can. and do check out the original post, even if youve read most of it here. i want you to check out the blog its on, if youve got a minute to do so.

Free Campus

Why Our Kids Must Learn to Code | Mark Heninger

Find the beauty, prose and voice in Code. We all should know code as well as we know our own language. What do you think?

Video link: https://youtu.be/STRPsW6IY8k

Free Campus link: https://goo.gl/PwMrvE

View original post

this is what happens when you make coding elitist

people are declaring themselves “NON-PROGRAMMERS” while programming a computer:

I am writing in bash and gtkdialog.

theres a word for writing (code) in bash and gtkdialog. but weve overloaded its meaning so many times over– resulting in the simple misunderstanding that so many things arent “really programming.”

its ok– you dont have to label yourself anything you dont want to. but if youre working with code, thats the thing– youre really quibbling if you want to talk about non-programmers that program.

elitism is only partly to blame. i take responsibility for my part, talking about “languages and introductions for non-coders.” but that means “for people that arent working with code yet; people that havent tried it before, or people that gave up quickly.”

if youre in training, youre coding. and most “programmers” are always in training anyway. people are still more concerned whether they qualify or not, the end result of which is people arguing with me when i say “everyone should learn to code” that “i dont ever want to learn to code! im happy writing and editing bash scripts.”

this has actually happened several times, despite the fact that some programming languages are easier to learn than bash. bash scripts do provide endless examples and let you learn-as-you-go, so if you dont run windows theyre still a good way to learn: bash is “learnable.”

but what theyre saying isnt that far from: “i dont ever want to learn to drive, i only deliver pizzas in my car.” in the future a new metaphor will be required, but for now its just as silly.

in case im not clear, using the command line (depending how you use it) may or may not be “coding” per se. theres some gray area. but at a certain point it definitely is coding, and the line between the two is a thin one. in other words, if youre comfortable with (or need, or are using for whatever reason) the command line, youre close to coding or “programming” already.

what is “scripting?” its a kind of programming. arguably lesser perhaps, but the line between “scripting” and “programming” is artificial, was always quibbling, and gets smaller every day as scripting languages get more powerful.

can you program without the command line? yes. can you use the command line without programming? yes. but theyre still related, and people are putting a very strange amount of effort into separating things that go together pretty naturally and easily. you can if you want to, but really, why?

ive only found one good reason for this much effort to distinguish the two, other than the need to quibble. by saying “im not a programmer” you shield yourself from the endless critiques of know-it-all coders constantly telling you to do it a better way (sometimes helpful, often used as a bludgeon or critique, and often arbitrary and useless– personally i find it annoying and practically useless when people tell me dont put “cat file” in front of a pipeline.)

but since this sort of nit-picking happens at least as often in bash as any other language– it doesnt really work. either way it brings me back to how elitism is robbing people of the chance to realize theyre programming. thats a very needless shame. i was lucky enough to teach myself how to code– i doubt i would have continued to enjoy it for 30 years if id had that nonsense to contend with every step of the way.



code.org and codesters

a friend of mine that did marketing and communications for a large organization showed me that heavy critique can be a launchpad for discussing who you are and what you have to offer.

so yesterday when i blogged about idit harels quartz article, i found it necessary to review code.org and see what it was like to use once and for all. note that i am not affiliated with them in any way, if anything i am (like harel) in “competition” with code.org, but not any kind of serious competition– more the theoretical variety.

in reality, i think the more tools that are available, the greater the odds that we will find newer more innovative solutions to the problem of computer illiteracy. so i like to at least be aware of as many of these solutions as possible.

in the past ive been wary of mark zuckerbergs endorsement of code.org, as i am no fan of his. i put that aside and looking into the site and its authors, i am pretty impressed. now that ive tried the site (yes, its drag-and-drop coding) i am more impressed. instead of just playing with logo, you have a hi-res cartoon character trace over a practice line. you have to solve for the shape using code– this is great.

for a look at what im working on, you can see that im doing iterations on instructional materials here: figch0and1.gif (281k, 502 x 7144) and im excited that harel is working on / with her / companys own solution at globaloria (and i still think its worth mentioning this in the article criticizing code.org.) but i havent tried it out yet.

like harel, i am personally a fan of helping people write code, vs. drag-and-drop. but i dont think this is right vs. “all wrong” like she describes, there are definitely pros and cons of both concepts.

in the days of basic, dijkstra claimed basic was all wrong, even damaging, while others simply made basic work better. but its difficult to impress me with elitism as ive heard it all before. (n.b.: someone compared my language to pascal the other day. i was very flattered– niklaus wirth is awesome.)

naturally im fascinated with concepts that bridge writing and drag-and-drop, such as greenfoots frames concept: http://www.greenfoot.org/frames/ but since im allergic to java, i can only hat-tip the innovation.

but the best part of reading harels article was this reply to her twitter account:

Provocative, interesting post from our friend @Idit. http://goo.gl/P6ew9E Codesters combines ease of blocks w/ access to actual code.

the video on their site: https://www.codesters.com/ is worth a look. buttons on the left, drag to the code window and it drops code in you can then customize. best idea ever? couldnt tell you. exciting though? absolutely, i like it!

(full disclosure: as a teaching tool / demo, i once made a buggy javascript-based calculator interface that did one keyword (with parameters) at a time, to show what was and wasnt a valid line. the one at codesters is a proper editor, and actually works!)

im not the sort of person that gets drawn in by every shiny new thing. for one, im typing this on an old netbook; almost no one i know uses those anymore. (it was already used when i got it.)

but just like we have more reliable software/design when it is informed by knowledge of the past, we can get good ideas by taking inspiration from the “future”– even when its a hypothetical future, even when a lot of it is hype, and even when most of it is a fad. clearly, part of it is really working and that counts.

i love, i will defend, time-tested concepts. but i dont think all good design ideas are behind us, either. stay open to the next good idea; maybe you can use it as a part of your good/reliable, more old-fashioned solutions.

happy coding!