Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Teaching programming h;lp

Name: Anonymous 2006-09-18 11:08

I'm going to teach programming to somebody who's going to study it more formally in a year, but wants to be learning part of it in the mean time.

What SIMPLE, CLEAN, STRUCTURED language would you recommend me to use for teaching? Please, refrain from language wars as this is not a fanboy thread but a serious question. Before yuo mention it, I'm not going to start with either Python or Ruby because they're too complex and get too much in the way, and no, I'm not stupid enough to start with Java because a radical OO language (and a crappy one at that) with a shitty enterprise API is not the best either.

I'm thinking Pascal. As much as it sucks, it has strict/anal types (it's better to start anal than to start easy-going and botch it), simple yet not messy syntax, simple stdin/stdout input and output to play with (that's all I'll need), and none of the complexity of OO. Yet it sounds so useless. But I don't know of other languages that meet these requirements.

Name: Anonymous 2006-09-19 14:09

>>27
How about tradition. They've been in use for, oh, longer than like 98% of 4chan's user base has been alive. Also, string operations on zero-terminated strings are a couple of instructions shorter than their length-prefix equivalents (i.e. the test against zero can be folded into the load from memory), which as any embedded system developer will tell you does matter. Plus, length-prefixed strings either limit you to 256/65536 bytes, or you end up wasting one or three bytes most of the time.

>>28
Oh very well. All operations that need to touch the string data proper, or if you prefer, all operations on zero-terminated strings.

The cache bit is to remark about how optimizing for omg one loop over a string is pretty much insignificant on today's processors, where fetching extra data from non-cache storage (or even the L2 cache) can be slower in relation to the processors' core speed than memory used to be in the early nineties. Certainly, grabbing the length value from a negative offset in the string pointer is quick. But let's face it: how many strlen() operations do you actually have that aren't immediately followed by accesses to the string contents?

Binary safety I took a stab at in >>26. Nutshell version: silly pythonist, strings are for characters and buffers are for bytes.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List