Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Functions, arguments, classes, methods, objects, threads, locks, all these are reassuring everyday words, and yet their meaning in programming (and math) bears no relation to their everyday meaning. (from http://akkartik.name/post/mu)

I can see how the use of the term "arguments" could be confusing ("parameters" or "inputs" would make more sense), and "threads" is a rather tenuous metaphor for how scheduling works within a kernel, but all of the others mirror their real-world meaning pretty well. I'd be more worried about students needing to unlearn "containers", "ingredients", and "reagents" when they start reading material from outside of Mu, talking to other developers, or learning calculus (which uses functions, sets, and arrays).



Actually, the only thread a ten-year-old knows is the one you might play cat's cradle with. It isn't obvious why there should be anything exclusive about one, or why you're better off keeping multiple of them 'separate'.

Functions are what something is for, as opposed to form. It isn't natural to think about their inputs and outputs.

It's quite possible my solutions are too blunt and problematic, but these seem like real problems.


Ada called them tasks. I always thought a multi-tasking program made more sense intuitively if one knew what a task was. A language designed for easy learning might call them actions, activities, jobs a la 1960's... something more intuitive.

Interesting, as I tried a quick brainstorm, I thought of a group of kids sitting together playing with the same toys. Actions that only one could do on a toy at the same time. Trying to convey the problems or exclusivity. Mentally came to problem of sharing. Then that people often borrowed toys temporarily then the owner checked up on them.

(lightbulb) Rust has a borrow-checker. And ownership. Now I wonder where they came up with that haha.


I'm not sure if a term like "tasks" / "jobs" / "actions" makes more sense. You wouldn't necessarily separate each thing that a program does into a new thread... Functions are for separating each body of work, while threads represent a path of execution through a process. In this way multiple lines of execution are intertwined to form a process, just as real threads are intertwined to form a rope... It's not a very good metaphor, but I can't think of a better one.

In Ada, "tasks" makes sense, but only because it is an abstraction that makes use of threads while managing all memory access and separation from the rest of the process.


Hmm. Good points. Maybe make an analogy to sonething like traffic lanes? More lanes equals more throughput. Not always utilized and diminishing gains as you add lanes for given workload. Problems occur during intersections where they share a resource. Requires synchronization, signalling, and/or ordering protocols to maintain safety.

How you like THAT! Maybe need a similar analogy closer to whats going on but the spirit of it seems accurate. Maybe factory workers on assembly lines or offics workers at desks.


I like that very much.


I would also agree that function is the wrong name.

Procedure however might be a good enough name, less connoted than Recipe.

Quoting the Elements of Programming by Alexander Stepanov:

"A Procedure is a sequence of instructions that modifies the state of some objects; it may also construct or destroy objects."

With the definition of Object as:

"An Object is a representation of a concrete entity as a value in memory"


Yeah, I agree about the term "threads" - it doesn't make for a very direct metaphor.

As for functions, I think the term makes sense, even with the non-mathematical definition, and especially in the context of OOP:

> an activity or purpose natural to or intended for a person or thing. synonyms: purpose, task, use, role

The "purpose" part doesn't make much sense with the way that we use the word, but it's certainly an activity. For example, a function of a stove is boiling water, its input would be liquid water, and its output would be steam & hot water. In OOP, "stove" would be the name of the class, and "boil_water" would be the function.


Ah, that's an interesting way to look at it. I hadn't considered that. Was that how the term appeared in math, I wonder.. Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: