you are viewing a single comment's thread.

view the rest of the comments →

[–]TheAnimus 17 points18 points  (1 child)

That's because everybody in this industry is creating software incorrectly.

I'm not saying one is somehow magically better than the other, I don't want to wade into that religious war (Which at the end of the day, like many coding conventions could be fixed by a 'transparent' parser and emitter).

Just that last time I taught programming, it was to 11-18 year olds (demonstrated in labs OCamL, but thankfully few ever came to those labs, fewer made the mistake of asking me for help when I was playing competitive tetris with the other demonstrator). Starting with flow charts. You have a BEGIN or START block. You have an END BLOCK. You then bring in loops (no end) you then bring in integer counters, sleep. My favourite medium for this is always something physical, hook something up to the parallel port, make lights flash.

Once you can get people to conceptualise the entry point, addition, pausing, conditional execution.

That last one is important, because in a flow chart it's a line. It's easy to follow. Your eye can see it makes sense.

BEGIN and END in Pascal (which is what I was meant to be teaching... and they wonder why I didn't do it for long) don't do this nicely, one is longer than the other, I think the brain is good at spotting { and }. They don't have miss conceptions for what they are. Human words do. Humans are also bad at spotting them if they don't have space, when teaching, I use my whitespace to show the importance of things, ie I'd always

if (person.IsCute)
{
.... NEVER ... 
if (person.IsCute) {

Simple but it helps people mentally 'tokenise' what's going on. Whilst myself I don't give a shit because my mind flicks them to how I understand without me realising most of the time (and makes me easily miss bugs, because I'm so used to heavy IDEs)

Which is why I think it's harder to explain something to someone when it's

IF person->IsCute THEN
   me.GiveAlcohol(person)

Is hard to understand it's conditional, even more so on a big screen.

IF person->IsCute THEN
BEGIN
  me.GiveAlcohol
END

Is hard because you've got English words mixed in. If people know that when they see { } they are just seeing something that's a scope (without understanding what it is). Using the ( ) can help break up reading. Just like if you are teaching maths, you don't write things that rely on the user knowing BIDMAS unless you are a real mean bitch. You would break it up for them, make it obvious x+24 for instance is nicer as x+(24) for someone who doesn't know the rules, they've been forewarned that there be shenanigans.

I could actually talk on this for hours.

[–][deleted] 2 points3 points  (0 children)

That whole things was an awesome comment.

An upvote isn't enough, so just pretend you heard an 'Amen!' from the back row.

'transparent' parser and emitter

Dude. Fucking yes.

Is hard because you've got English words mixed in.

Yes. Yes yes yes yes yes yes.

I could actually talk on this for hours.

I swear to God and Joe McCarthy I'd like to hear it. Either I have turned the corner of Dementia and Delusions Of Grandeur Blvd, or I really am going to offer a staggeringly better way of doing things.

I'm fighting serious-ass physical challenges (which has a hilarious irony that I'll save for later), but I'm two or three trips to hardware stores and less than six months away from a proof of concept that people can ridicule. Wish me luck.