proj-oot-old-150618-ootLearnToProgramNotes1

---

when i went to http://scratch.mit.edu/projects/editor/?tip_bar=getStarted , there is a tutorial where you make a cat sprite dance.

i created a simple script with 3 commands. The commmands are presented as GUI puzzle piecs, but here is some text that sort of corresponds to them:

On green flag clicked: repeat 10: move 10 steps

(note: the 'move' seems to implicitly reference the cat sprite, i think because i had it selected in the sprite selector area in the GUI while these commands were displayed)

one discoverability issue was in the very first step; when i opened this page, there was an authoring tool with various panes. It was unclear what i was supposed to do. I eventually noticed in the rightmost pane that there was some tutorial text. But it confused me because it said:

"Step-by-Step Intro

Want to get started with Scratch? Try this!

(picture of cat dancing in disco ballroom)

(picture of star) 1 Start Moving

Drag a MOVE block into the Scripts area.

(picture of a MOVE block in the appropriate area) "

it confused me because i thought i was supposed to "try" (picture of cat dancing in disco ballroom). But there was no disco ballroom anywhere except right there, and when i clicked on it nothing happened.

also at the bottom of each tutorial section there was a hyperlink to the next section, but apparently no way to get back to the previous one

There is a File menu with options:

New --- Upload from your computer Download to your computer --- Revert

i tried 'Download to your computer' to see what format the script would be in. It downloaded as an .sb2 file. An .sb2 file is a .zip file. When i unzipped it, it had 4 graphics files (2 .pngs and 2 .svgs), 2 sound files (.wavs), and 1 'project.json' file. Here is the contents of project.json:

{ "objName": "Stage", "sounds": [{ "soundName": "pop", "soundID": 1, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "backdrop1", "baseLayerID": 3, "baseLayerMD5": "739b5e2a2435f6e1ec2993791b423146.png", "bitmapResolution": 1, "rotationCenterX": 240, "rotationCenterY": 180 }], "currentCostumeIndex": 0, "penLayerMD5": "5c81a336fab8be57adc039a8a2b33ca9.png", "penLayerID": 0, "tempoBPM": 60, "videoAlpha": 0.5, "children": [{ "objName": "Sprite1", "scripts": [[18, 55, [["whenGreenFlag"], ["doRepeat", 10, [["forward:", 10]]]]]], "sounds": [{ "soundName": "meow", "soundID": 0, "md5": "83c36d806dc92327b9e7049a565c6bff.wav", "sampleCount": 18688, "rate": 22050, "format": "" }], "costumes": [{ "costumeName": "costume1", "baseLayerID": 1, "baseLayerMD5": "f9a1c175dbe2e5dee472858dd30d16bb.svg", "bitmapResolution": 1, "rotationCenterX": 47, "rotationCenterY": 55 }, { "costumeName": "costume2", "baseLayerID": 2, "baseLayerMD5": "6e8bd9ae68fdb02b7e1e3df656a75635.svg", "bitmapResolution": 1, "rotationCenterX": 47, "rotationCenterY": 55 }], "currentCostumeIndex": 0, "scratchX": -92, "scratchY": 3, "scale": 1, "direction": 90, "rotationStyle": "normal", "isDraggable": false, "indexInLibrary": 1, "visible": true, "spriteInfo": { } }], "info": { "flashVersion": "LNX 11,2,202,359", "videoOn": false, "scriptCount": 1, "swfVersion": "v419", "spriteCount": 1, "userAgent": "Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko\/20100101 Firefox\/29.0" } }

note that my source code is represented not as plaintext but as an AST in children.scripts.

http://wiki.scratch.mit.edu/wiki/Scratch_File_Format_%282.0%29

---

so, from the .sb2 file format, i think we should take the project file format and use the idea of objects with scripts and included sprites, sounds, etc, but have have text files for the actual source code, rather than representing code as a JSON object (hard to edit in text editor)

note that Scratch currently uses Flash but we'll use HTML5

--

http://twolivesleft.com/Codea/

--

http://twdkz.wordpress.com/2014/06/26/teenage-haskell/

https://news.ycombinator.com/item?id=7956627

--

https://news.ycombinator.com/item?id=8001337

Python is now the most popular introductory language at top U.S. universities (acm.org)

blahedo 3 days ago

link

This methodology is suspect, and the headline is extremely deceptive. Note that Guo has conflated CS0 (meaning: CS for non-majors) with CS1 (meaning: intro to CS major). He is upfront about this fact and he does it intentionally, but comments about "first officially-sanctioned exposure in college" and such make it sound like he's unaware that most CS majors do not ever take a CS0 course; and among instructors of CS, phrases like "introductory language" without further qualification is usually understood as referring to CS1.

If we then look at the table of actual data to filter a little bit, the story changes. There are certainly some schools, big ones, that use Python in CS1. But a lot of the Python representation is coming from CS0 at schools where CS1 is taught using Java.

(I can also clarify one of his other comments: he says of the AP exam using Java that "it's unclear whether that will change anytime soon." This is untrue. It will not change in the next 3-4 years at the very minimum---and that would be the time frame if the College Board said right now today that a change was happening. In fact, though, although the idea's been mentioned, there has been no study or apparent motion on that front, so a more realistic earliest-date-of-change would be around 2019 or 2020. And I wouldn't count on it, given how many CS1 courses are still taught in Java.)

reply

pgbovine 3 days ago

link

Author here. Thanks for your comments blahedo. I'm a bit short on time right now, but I will convert some parts of this response into more coherent form and edit my article accordingly to clarify.

I'll address each of your paragraphs in turn:

1.) Re: CS0 vs. CS1. Like you mentioned, I was very upfront about the methodology for this analysis. And I am very aware that most CS majors do not ever take a CS0 course. But please also be aware that there are a minority of CS majors that do take CS0 before moving onto CS1, usually because they feel ill-equipped to take CS1 right away. I harp on this point because even though this is a minority population, it's a very important one since those are students who, without CS0, would not major in CS. These students are more likely to be female or from underrepresented minority groups. On a related note, a larger and larger fraction of non-CS majors are taking CS courses because they recognize the value of programming and computational thinking. (Again, these non-CS majors are more likely to be female and from underrepresented minority groups.) So I would argue that CS0 is just as important as an "introductory programming" course as CS1, if not more important, due to the rise of the non-software-engineers-who-want-to-learn-programming population. [Edit: And I think that a CS department's choice of language to offer to the CS0 student population is still very significant, and a decision that is not made hastily.]

2.) Re: Python CS0 and Java CS1. You are absolutely right, and in my original article, this sentence appears in the discussion section: "Some schools have fully switched over to Python, while others take a hybrid approach, offering Python in CS0 and keeping Java in CS1."

3.) Re: AP exams using Java. Thanks for the clarification. I will remove "it's unclear whether that will change anytime soon." from the article.

[Also, as to cyorir's comment that the chosen data may have been cherry-picked, please rest assured that I tried my best NOT to cherry pick. If I had cherry picked, wouldn't I have made Python look even better? ;) Any incomplete data is strictly due to human error or oversight on my part, and I gladly welcome any correction requests via email.]

reply

---

candeira 3 days ago

link

I work at Monash University in Melbourne, Australia. Last year we moved our foundational course in data structures and algorithms from Java to Python, with great success. This is a course that used to be taught in C, then moved to Java. I tutored it as a Java course, and was in charge of adapting the tutorial (classroom exercises) and laboratory (programming assignments) materials when we started using Python to teach the unit.

The main content of the course hasn't changed. Complexity, Big O notation, sorting and searching are introduced in the first two or three weeks. Students work through the usual implementations of arrays, linked lists, stacks and queues (both array and linked-list based), trees, heaps, tries, etc. All these data structures are explained first as chunks of data with external functions for the operations; then a second time as objects with methods for operations, once object orientation is introduced in week 5 or 6. Iterators are introduced as an abstract interface to list-, array- and tree- walking. Where relevant, we explain every operation twice, showing the iterative and recursive approaches. The course ends with two weeks of lower level work, where the students hand-compile pseudo-Python to working MIPS assembly.

The move to Python gained us, among other things, the freedom not to have to explain Java's generics and access modifiers. Many of our students have never programmed with a text editor before our unit, and dropping them into the big boilerplate world of Java micro-management was not good for them or for the course. We used to spend too much time on syntax and other details ("native types are like this, reference types are like htat") that we should have been spending on data structures and algorithms.

With Python, we even have time to explain idiomatic Python iterators and generators, and to discuss Python scoping rules (which come up again when we work on local variables in their hand-compilation tasks).

mandalar12 2 days ago

link

I have a different experience tutoring (exercises and labs) in an engineering school in France for programming / CS beginners.

We moved from Java to python this year and I miss a few things. Due to the absence of explicit typing the students don't bother to understand types anymore and it leads them to a lot of mistakes and misunderstandings: confusion between simple types, lists, dictionaries, instances of a user created class, etc. Besides I think the verbose and rigid syntax of Java forced them to understand what their wrote and for a first language that was a good thing.

Overall I found that since it is easier to write code in python they rush to writing anything without understanding the algorithmic problem first. Thus they are less able to decompose a problem in sub-problems and write atomic functions to solve each of them.

Note that I think teaching python as a first language is a viable option but in our case the course needs to be intensively rewritten and the labs adapted. For instance my lattest point about algorithms is not a problem with the language: it could be resolved by having a part of the lab being pure algorithmics and then an implementation part.

reply

simonw 3 days ago

link

I think C makes a great second language. Use Python to teach if statements, variables, control structures etc - then later use C to teach low-level algorithms, pointers and how computers actually work.

I don't think there's any harm in learning Python first. I think they may be harm in learning C first - it's much more likely to frustrate people and potentially even put them off programming.

This is the same reason I dislike Java as a teaching language: having to tell people "don't worry about what public static void main(String[] args) means just yet" when teaching "hello world" isn't a great introduction to programming.

reply

---

how would "public static void main(String[] args)" look in oot?

if oot defaults to 'public' access modifier (don't need 'public'), and has gradual typing (don't need 'void' or 'String[]'), and has 'bare' functions (don't need static), then main would just be:

main(args)

(or whatever function defn syntax we choose)

or perhaps it's better to execute the top-level, like in Python?

---

http://zedshaw.com/2015/06/16/early-vs-beginning-coders/

totalBeginner 3 hours ago

I would find some resource of assumed knowledge useful in my career field of chemistry and biology, but what really resonated with me from zedshaw's piece was something even more basic to the field. The biggest hurdle I had to learning to code was finding a text editor. The next big hurdle I had was finding somewhere to host my one-page HTML site. I ended up asking a friend who suggested Sublime Text and Amazon AWS. At that point I'd been reading HN for two years and had heard of these things, but not understood their central utility (or the utility of similar such general services) to doing anything with code. This is the level of beginner that I would hope zedshaw's efforts would target, someone like me from last year.

I want to emphasize that while learning abstract functions, and understanding that code syntax is an abstraction for electrons moving through logic gates are fundamental concepts for an early programmer, learning those concepts was less frustrating for me than finding somewhere to write the text I had learned from codecademy. I am a chemist by formal training, I took an extremely abstract multivariable calc course in college that taught me Big and Little O, and functionalized concepts most people learn by rote "drills," and I consider learning new concepts my strongest career skill. I don't mean to humblebrag here, but rather to refute the only-somewhat-popular sentiment I've seen on HN that non-coders "can't get shit done." No. I am a non-coder that does shit. In moving from chemistry to neurobiology and biophysics, there are basic skills that can't be found in a textbook, like _this is a pipette_, and _this is a flask to grow cells_, and if you don't know those things you won't be able to do experiments, and you'll fail the informal subtext of an interview. The best resource I've found in (three years of reading HN anonymously) for analogous tool-teaching in code has been Michael Hartl's book on learning Rails, so thanks again mhartl! The first two chapters of that resource were more treacherous (but ultimately well-guided and successful) than teaching myself d3.js. A true, zero-level, adult beginner's guide to some code---manipulating an excel sheet in Python, writing an API-interacting tweet bot---would be a great boon to people like me.

SCHiM? 11 hours ago

This is good. I've had problems that were somewhat related to what the author talks about.

When I was learning C# and was already quite fluent in C/C++. I had a big problem with the C# type system/management. I'd been reading guides that were in the first category the author mentions, eg. "not really a beginner, but new to this language".

I was trying to retrieve the bytes that a certain string represented. I was looking for ages and everywhere everyone mentioned that "this shouldn't be done", "just use the string", etc. A stack overflow answer mentions a way to use an 'encoding' to get the bytes and this seemed to be the only way.

How strange I thought, I just want access to a pointer to that value, why do I have to jump through all these hoops. None of the guides I was reading provided an answer, until I found a _real_ beginners book. This book, helpfully starting at the real beginning of every language: the type system, finally gave me the answer I was looking for:

.net stores/handles all strings by encoding them with a default encoding. It turned out that the whole notion of 'strings are only bytes' that I carried over from C++ does not work in C#. All those other helpful guides gleefully glossed over this, and started right in at lambdas and integration with various core libraries. Instead of focusing at the basics first.

reply

wolf550e 5 hours ago

This has nothing to do with learning a programming language and everything to do with learning how to process text in a computer. Being a C programmer doesn't mean you have only a PDP-11's understanding of text ("it can be ASCII or EBCDIC, and I know how to convert between the two!").

When I learned C# (in 2003?), I learned that String in an array of Char and Char is 16 bit, and that .NET used the same encoding as Windows NT (UTF-16 in native endian).

I knew that both WinNT? and Java made the mistake of being designed at a time when people assumed 16 bits are enough and consequently caused the surrogate pairs mess. I knew that Java assumes UTF-16BE and Windows assumes UTF-16LE. I knew what UTF-16 means in C/C++ and how to work with it or transform such data to and from UTF-8 and UCS-4.

When learning a new programming language, I know to look up whether strings are mutable and whether they're sequences of bytes, code units or code points. If they's immutable, I look up how to create a copy instead of a reference when using substring and when they're not bytearrays I look up how real bytearrays are called in this language.

Should early programmers be taught this? Absolutely. At what stage? I don't know. But they must be taught from the start that this has nothing to do with a programming language and everything to do with how data is represented in memory.

reply

---

WalterGR? 2 hours ago

The above link is to a Hyperbole and a Half cartoon image of a person and the words "No, see, that solution is for a different problem than the one I have."

Blind links aren't polite. :)

reply

danso 10 hours ago

I've been teaching coding to beginners for the past year now...and even after having done coding workshops/tutorials for many years previous, I've found I can never overestimate how wide the knowledge gap is for new coders.

Yesterday I was talking to a student who had taken the university's first-year CS course, which is in Java...she complained about how missing just one punctuation mark meant the whole program would fail...While I can't passionately advocate for the use of Java in first-year courses (too much boilerplate, and the OOP part is generally just hand-waved-away)...I've realized that the exactness of code must be emphasized to beginners. And not just as something to live with, but something to (eventually) cherish (for intermediate coders, this manifests itself in the realization that dynamic languages pay a price for their flexibility over statically-typed languages).

Is it a pain in the ass that missing a closing quotation mark will cause your program to outright crash, at best, or silently and inexplicably carry on, at worst? Sure. But it's not illogical. Computers are dumb. The explicitness of code is the compromise we humans make to translate our intellectual desire to deterministic, wide-scale operations. It cannot be overemphasized how dumb computers are, especially if you're going to be dealing with them at the programmatic level...and this is an inextricable facet of working with them. It's also an advantage...predictable and deterministic is better than fuzziness, when it comes down to doing things exactly right, in an automated fashion.

I think grokking the exactness of code will provide insight to the human condition. While using the wrong word in a program will cause it to fail...we perceive human communication as being much more forgiving with not-quite-right phrasing and word choices? But is that true? How do you know, really? How many times have you done something, like forget to say "Please", and the other person silently regards you as an asshole...and your perception is that the transaction went just fine? Or what if you say the right thing but your body (or attire) says another? Fuzziness in human communication is fun and exciting, but I wouldn't say that it's ultimately more forgiving than human-to-computer communication. At least with the latter, you have a chance to audit it at the most granular level...and this ability to debug is also inherent to the practice of coding, and a direct consequence of the structure of programming languages.

reply

alphast0rm 7 hours ago

A good analogy I've heard to explain this is how you'd request a glass of water from the kitchen from a friend versus a computer. You can simply tell your friend "get me a glass of water" and they'll understand what you're asking. With a computer though, you must be completely explicit with your instructions, for example: walk to the kitchen, open the top left cabinet, take out a glass, put it underneath the faucet, turn the faucet on until the glass is 80% full... etc.

reply

Lawtonfogle 6 hours ago

Day one CS 101 class.

Bring in a few loaves of bread, jars of peanut butter, and jars of jelly, with a few utensils. Also, lots of paper napkins.

Have the students spend 10-15 minutes writing a 'how to make PB&J sandwiches'. Select volunteers to read their instructions while you follow them as a computer would. Explain that this is how computers work.

Get some bread: grabs entire loaf of bread, uses the entire loaf for following instructions.

Open the loaf of bread: Rips open the entire package.

Open the jar of peanut butter: Fails to rip the lid off.

Spread peanut butter onto bread: Grab a big handful of peanut butter and spread it messily over the bread.

You can demonstrate how a more flexible language allows you to not just stop and crash (ie. Unknown command 'open peanut butter') but can result in far worse results.

You can even get into the different levels of languages by showing the difference between a motion by motion (assembly) instructions vs. one which assumes general sandwhich knowledge (C/C++/etc).

reply

---

nekopa 5 hours ago

bwy, I am writing this to you, from a current teacher to maybe a future teacher. I have a big issue with this line of your response:

Otherwise, your efforts may be futilely spent on explanation when all they want is to get things working.

Now this attitude is fine in a work environment, or many other places. But this is death for learning. Learning is not about getting things to work, it is about understanding why things work, so you can apply that understanding elsewhere, to unrelated fields even.

So, for example, I do agree with you when you say: don't go back and explain that the interpreter is this thing with very strict constraints and everything you type matters But I disagree with what you say next: That's not the point. Explain what's wrong, why, and how to fix it!!!

What would be better, in my experience, is to lead the student to find out, for themselves, what is wrong, you can supply the why, and get them to figure out how to fix it. These are what we in teaching call teachable moments, random events which present an opportunity to give the student a deep learning experience, one which will stick with them for a long time.

Your 'explain what's wrong, why, and how to fix it!!!' can be done via google, doesn't add to a real learning experience, and can turn people into cargo cultists.

reply

jordanpg 9 hours ago

The only important trait I see that matters for either of these groups is a willingness to try things, push buttons, see what happens.

A beginner worries about breaking the computer and doesn't yet understand that any question they have can be typed into a search engine verbatim and will probably be answered with 20 SO posts and 50 blogs posts. And early programmer is stumbling down this road.

I don't know that this ethos can be communicated with a book.

---

 kazinator 8 hours ago

I can still visualize what it's like to know nothing, because when I saw a BASIC program for the first time when I was ten, I thought the = signs denoted mathematical equality (equations). How the heck can X be equal to Y + 1, if in the next line, Y is equal to X - 2?

Later, I tried using high values for line numbers just for the heck of it. Can I make a BASIC program that begins at line 100,000 instead of 10? By binary search (of course, not knowing such a word) I found that the highest line number I could use was 65,000 + something. I developed the misconception that this must somehow be because the computer has 64 kilobytes of memory.

reply

scribu 3 hours ago

> I thought the = signs denoted mathematical equality (equations).

I had the same confusion! My very first roadblock in programming was when the teacher told me to write `x = x + 1` on the blackboard, which didn't make any sense, mathematically.

reply

top1nice1gtsrtd 11 hours ago

I actually worked on teaching my 71 year old father Python using this book. One point of difficulty that struck me during that exercise was that I as a programmer had completely internalized the idea that an open paren and a close paren right after a function is a natural way to invoke a function with zero arguments (e.g.: exit() exits Python's prompt. exit doesn't.). The whiplash I felt from finding the questioning of the convention silly to finding the convention silly was amusing to feel. Like it makes sense to a parser but not to a flesh-and-blood contextual-clues-using human. We don't vocalize "open paren close paren" whenever we say an intransitive verb. We just "know" that it's intransitive. Anyway, great article.

reply