HNHacker News
TopNewBestAskShowJobs

alew1

278 karma · joined November 17, 2016

submissionscomments
alew1··on Learn C programming and the rest will come
I'd agree, and even in Python, we end up talking about how some variables store "memory addresses," to explain the sometimes confusing behavior of variables bound to mutable objects. What's less essential is understanding all the ways that (C's) pointers can bite you: pointer arithmetic that results in invalid addresses, use after free, dereferencing uninitialized pointers, returning a pointer to a local variable from a function, and so on.
alew1··on Learn C programming and the rest will come
For our first semester, we use a modified version of "How to Design Programs": http://www.ccs.neu.edu/home/matthias/HtDP2e/ Highly recommended for teaching! I do teach pointers, but in stages — so that students can understand the mutability behavior of Python lists and other objects, we talk about how a Python list variable, for instance, is _really_ storing a memory address of a list. When we move to Go, they actually use pointers, but unlike C's, it's hard to shoot yourself in the foot with Go's pointers. When we finally get to C, pointers seem natural.
alew1··on Learn C programming and the rest will come
Agreed! It's a question of how you introduce them to these ideas. One option is to start at the bottom (hardware) and go up, so that pointers feel like a welcome abstraction when students encounter them in C. (They will already be used to thinking about memory addresses in assembly.)

The other option, and the one I choose, is to go from high-level languages down. What I'm not so sure about is just throwing people in in the middle, so that they are trying to grasp abstractions like functions and variables at the same time as they are trying to understand pointer arithmetic.

In the subset of Racket we use, all values are immutable, so an understanding of memory (stack vs. heap) is less necessary. We do still talk about "frames" to understand lexical scope, though, and students get used to thinking of each function call using up a new "frame" of memory to store its local variables. This allows them to understand the memory efficiency of recursive functions.

We then move onto Python, and _do_ talk about an "environment" (stack) and a "heap" (I call the heap "object-land" because objects live there). This enables us to talk about garbage collection. More importantly, students get used to thinking about variables as being bound to either primitives or pointers to shared memory.

In Go, there _are_ pointers, and students get used to thinking about memory addresses as values. They learn that pointers are useful both for sharing mutable references, and for avoiding expensive copies. (In Go, arrays are values, and passing a large array to a function copies it.) But none of the sharp edges of C's pointers are present. Go does "escape analysis" so that if you return a pointer to a local variable, that local variable is allocated on the heap; it is safe to point to anything and if you do, it won't be garbage collected. There's no pointer arithmetic.

By the time they see C, in the third-year course, a lot of the pieces are in place to have a good understanding of how the stack and heap (and manual memory allocation) really work. And along the way, because they were using higher-level languages, the students have been creating cross-platform, complex programs (web servers, games, etc.) that they're proud of. :-)

Re: sibling's comment that "some people aren't cut out to be engineers," I think that's a somewhat dangerous attitude. I think the study of computation is profound & rewarding and should be part of a liberal arts education for everyone; even apart from that, programming is also a useful skill for people who won't get a job as an engineer.

alew1··on Learn C programming and the rest will come
Meh. Learn any language and “the rest will come” if you then learn other languages. Some of these points don’t lead to C’s being a better first language or pedagogical language — like, why should a learner care that C is so fast? I teach HS computer science and we do use C, in our Data Structures course, after students have used Racket, Python, and Go. Using those other languages lets us cover interesting and important topics like recursion, data abstraction, concurrency, and more, all while doing projects that hold kids’ attention (sometimes using outside libraries for image or sound processing, e.g.). C is well-suited to the data structures course where students have to think carefully about memory and efficiency.

I can certainly imagine a different sequence, where students learn logic gates, hardware, assembly, then C, working their way up to higher levels of abstraction. Even in this case though, the goal isn’t to jump in and start writing big programs in C right away.

alew1··on Tesla fired hundreds of employees in past week
I feel like people who "strongly support organized labor" don't write like this about organized labor ("infiltration and union formation"?). Its _workforce_ is not "vulnerable to attack" from big labor, its bottom line is, and to the benefit of its workers. That's how unions work.
alew1··on New Theory Cracks Open the Black Box of Deep Neural Networks
Did you look at the actual research, or just this author's summary? I was also skeptical after reading this summary, but I found the presentation in the linked video to be far from trivial.
alew1··on Pollen: the book is a program
Thanks! Happy to :-) Here's the code for this assignment, as well as the pollen.rkt and HTML template/CSS files. (Disclaimer: this was written as code to get something done, not for others to see, so it's not always pretty!)

https://gist.github.com/alex-lew/883ee382a697b39f0f6b49561a0...

By the way, I use Atom, which has an excellent Pollen plugin, to write. Typing '@' then pressing tab turns into ◊{}, with the cursor between the lozenge and the braces.

alew1··on Pollen: the book is a program
I'm a CS teacher and use Pollen to write my assignments (sample: https://drive.google.com/file/d/0B9DAZWpkQIDuUlA4SU5lcHItRDg...). It allows me to type assignments as fast as I can think them, in a specialized mark-up language for exactly the type of assignments I give. I can then apply various post-processing operations (like doing syntax highlighting, converting straight quotation marks to curly but not when inside sample code, numbering of problems, inserting special CSS to make the assignments print with nice margins / without breaking up headings and paragraphs that belong with them, etc.) all with very little pain.

It's also neat to show students, after they've spent months learning Racket, that all sorts of useful things -- including the writing of their assignments! -- can be automated with their new skills.

alew1··on Why We Terminated Daily Stormer
They largely went up in two waves, in the 1890s and the 1960s, as explicit symbols of white supremacy. They were not erected shortly after the war to commemorate soldiers. They falsely evoke a time right after the war when Southerners held great respect for confederate "heroes," but that's misleading. I was surprised to learn this too.

http://www.townandcountrymag.com/society/politics/a12015570/... https://www.google.com/amp/jezebel.com/confederate-monuments...

alew1··on How to Design Programs, Second Edition
Images are also considered "fixed size data" in the textbook. I think this is for pedagogical reasons, the sort of simplifying-lie-that-is-cleared-up-later that is common in science education. In the first section, students are encouraged to think of strings and images as atomic data to be processed all at once using built-in functions, but in the "arbitrarily large data" section, the authors give you tools for converting images and strings to lists (of characters and pixel values).

(Note: since Racket supports exact bignums, in a sense numbers are not atomic either! Only Booleans ;-)

alew1··on Show HN: Proof Companion – Geometry proof practice for students
Neat! Is there one correct solution for each proof, or is there something more complex going on behind the scenes?
alew1··on For an Inclusive Culture, Try Working Less
You're making a lot of assumptions for someone who hasn't seen that Slack conversation.
alew1··on How Subtle Class Cues Can Backfire on a Resume (2016)
Recent graduates are encouraged to mention involvement in student organizations when applying to jobs; leadership roles in those organizations might speak well of a candidate. People might also put this information on a résumé because they want to work somewhere where they know they will be welcome. I am a teacher and I would certainly mention on my résumé that I am the faculty advisor for the Gender/Sexuality Alliance (even if applying to an engineering position). I am proud of my involvement as faculty advisor, and I also would not want to work somewhere where my sexuality would be considered any sort of liability.

Rather than expect applicants to take measures to whitewash their résumés (which also gives an advantage to those applicants whose extracurriculars are already "generic," i.e. upper-class and white), it seems we should be educating employers to be aware of their biases when reading these résumés, and teaching strategies for overcoming them.

alew1··on Ask HN: Anyone interested in building tools for showing bias in news?
What about a tool that allows you to find and start a chat with someone currently reading a differently biased account of the same (or similar) events? I can't count the number of times this election that I wished I could discuss a Times article with a Trump supporter; I am sure there are plenty who wish they could tell me about the contents of a Breitbart article.
← PreviousPage 3 of 3