# Tag Info

## Hot answers tagged imperative-programming

14

This is a topic very close to my heart. I think that the skeptical attitude you've alluded to simply comes from the fact that most people were taught imperative programming first (and some were never exposed to any other paradigms at all). Turing's Machine was easier to conceive of as a physical, mechanical device than Church's $\lambda$, and it is ...

5

The difference may be partially related to whether or not the student has a mental model of the machine (as in simple, possibly physically mechanical, computing hardware), rather than more abstract symbology (algebra). Changing the bits on a Turing machine tape, or the wheels on a Babbage engine, or the display of a pocket calculator, or the position of the ...

4

Some related research There has been some research into how to hire people: How do you select people that can do the job. The traditional methods reject too many “good” people, and accept too many “bad” people. It terns out that the best thing to do is to test them doing the job, and selecting for attitude. Therefore to test programming you should test ...

4

I undertook this study myself about a year ago. I started working through the Programming Languages MOOCs on Coursera (Part A Part B Part C), which are based on a UW course of the same name. I didn't really know what I was getting into, but it sounded interesting. Before I knew it, I was learning a radically different approach to programming first with SML ...

3

This is a really good place to introduce boolean variables (or just to use them, if they've already been introduced. It also introduces the idea of descriptive variable names. user_wishes_to_continue = True while user_wishes_to_continue: answer = raw_input("Do you wish to continue?") if answer != "yes": user_wishes_to_continue = False ...

3

When I created my course for Scheme (under not dissimilar circumstances from yours), I used The Little Schemer as my primary source. The book itself rapidly became too dense for my HS students, so I designed my lessons around each chapter. My course, then, like the book, took the students slowly through a very foreign landscape. We took no effort to ...

3

I taught a "Functional Programming" course on multiple occasions. It was basically a Haskell course. Phew, can't wait to teach it again. To answer you question precisely: you have no state, no classes and no usual OOP model. You have to abstract things much more than you are used. Oh, and there is this weird syntax. I mean--- uncurry f a b = f (a, b) But ...

2

I don't think there's a "best way." I do a bit of a shotgun approach. No research to back this up, but it works well for me. Lab Assignments Most of the assignments we do in class are small lab style assignments. Average students can finish a few of these in a class period. We do all of these online with an autograder. Students can submit their code as ...

2

I think that both the question and the answers to date conflate two things that can be separated: imperative programming and programming with primitive data. These are not the same thing and thinking of them as one leads to some of the difficulties. Programs don't all have to be C-like programs from 1980. Using modern languages (java, python, ruby, scala......

2

I think too much emphasis is placed on the "kind" of loop (e.g while vs. repeat until), and on how to structure a while loop if you need to pre fetch some values before you can consider exit condition(s). Instead, I tutor my students about the infinite loop construct. And then about testing for exit condition(s), and advancing the loop (e.g. fetching), but ...

2

Of the two alternatives listed, I prefer the second, because it Says It Once. (In this case, it's only a call to input() but it's easy to imagine a case where some computation needs to be done as part of the test). But there's yet another way to write it. If I were to describe verbally what I'm trying to do, I would say something like "Do some stuff (the ...

1

Some programming and coding workflows\patterns make the repetition rather insignificant. For example, if one teaches to have constants set from the beginning, something like: init: questionText="Do you wish to continue? accept="good" finished="good bye" main code: answer=input(questionText) while answer=="yes": print(accept) ...

1

There are different loop structures for very good reasons. In my early introductory programming examples, I stress at least three types of loops which are not interchangeable: 1. Loops that read data require a priming read before the test at the top. 2. Loops that test at the top can use a flag variable which is changed in the body. 3. Loops that test at the ...

1

I don't particularly care for either as a first program, but the second version makes the case for Say It Once, i.e. don't repeat code. However (a) it is awfully early to be stressing that rule and there are better examples that can come along soon, and (b) making the case for the rule requires showing (and discussing) both programs. Showing both can ...

1

Unfortunately exams of any kind advantage some students and disadvantage others. They also favor those good at exams, not necessarily those good at the subject matter. I was always (over 40 years) a big fan of using projects to assess students. Let me describe how you might be able to make it work, provided that the scale isn't overwhelming. The course I ...

1

My earlier answer focused on overall program structure, not assignment and mutable state explicitly. The originator was focused otherwise, on assignment. One of the difficulties for beginners, I think, is that taking a Turing Machine view, or a program stack view, or a mail-box cubby hole view is that it isn't natural for students. Without criticizing that ...

Only top voted, non community-wiki answers of a minimum length are eligible