Turtle examples for loops and variables, or even something else I'm going to teach using the well known drawing turtle, with one developed by me to fit my students, so in case it can also be modified. It features drawing movement, non-drawing movement and pen color change.

The main goal is letting them have a strong visual feedback and appreciate the decomposition of complex movements. I have some examples that use functions to represent "subtasks" and repetitions to generate nice drawings.

I'm anyway a bit stuck here, say at the visual artist stage, I'd like to show them the use of a while kind of loop instead of a statically limited for, but I don't have good ideas besides using the "while" condition to stop some recursion based for example on the next step length (imagine drawing a spiral with increasing step length and wanting to halt at some point).

It seems to me that my main difficulty has to do with the absence of interesting states from the examples, the only one that comes to mind being precisely the use of a step length.

The system also features 2 things.

A stack for saving turtle configurations, you can push the current position and pop it later... Fractals? It seems that those coming to my mind are more easily accessed by recursion than by a stack.
The ability to save a user state and access it, it can be used for example to keep a counter that changes when desired and is then used to choose a pen color from a palette. It can contain arbitrary data and the motivation was to use it as an aid for learning about mutating variables.

I anyway seem to not have good ideas for examples to link these tools to actual interesting problems. Any suggestions?

What can be easily computed by the turtle?

What your system is missing, actually, seems to be a feedback mechanism in which the turtle can "sense" something about the world it is in. If it, for example, could sense edge walls, then it could use that sense for conditional constructs. In Karel the Robot and its successors (Karel J Robot, Monty Karel, ...) there are a number of things that a robot can sense such as walls and "beepers".

while (karel.frontIsClear())...

If you can have multiple turtles then one turtle sensing something about another is another possibility for feedback.

But, until you get something like that (sensing about the world) you can probably only write conditional and looping constructs based on stored information in the program itself, such as counters.


Priority Queue practice vs examples After teaching Priority Queues, I want to give the students some notion of what it looks like when they are used in code.

I have two approaches and I am unsure about which would serve my goal better:

Show them a number of examples where a Priority Queue is used (task management, patient treatment etc.) and for each one discuss how the priority queue impacts the performance or efficiency.
Let them be creative and try to think of a use for a priority queue, and let them implement that usage on their own (a lab period).

Obviously, each option has its merits. I am wondering which one would increase understanding more. The first option shows them uses and the reasoning behind that usage, which is great for understanding the subject. On the other hand, option 2 lets them experience it first hand, which is (almost) always good.

So I am torn between these two.

Let them be creative and try to think of a use for a priority queue, and let them implement that usage on their own.

If you want something to stick, heed your own advice in bold: "Let them be creative ... on their own."

When students can use their own creative powers to synthesize everything they've been taught, then they've truly learned it. "Show and discuss" is not necessarily a bad approach, but it won't have nearly the same long-lasting effect as putting the onus on students. If you're the one working, you're the one learning, so if you're the own showing, you're really the one doing most of the work.

Plus, why not do both? Start with option #2 then analyze their own work with option #1. As with most things, it's not either/or. Imagine if the efficiency conversation were about their own implementations, not some you had shown them. That would be a powerful set of lessons.

One heuristic I apply to my own lesson planning is this: is this lesson giving students the option to take ownership of the material? When you challenge them to create, you are giving them that opportunity to -- and challenging them to -- take ownership of their learning.


Should I correct mistakes in student presentations? In my graduate programming languages course, each student is required to learn a different novel programming language during the course of the semester and give a presentation on it to the class at the end of the semester.

Learning a new programming language is hard, and, inevitably, some students present inaccurate information, sometimes in response to a question from another student or me.

In my private feedback to each student, I let them know any mistakes I saw in their presentation. My question is whether I should let the class know when some presented information is incorrect.

As an example, a student showed some code in a language related to Java. When asked by a student whether the break statement in a doubly-nested loop exited both loops, she said yes, which was incorrect. I kept quiet, not wanting to embarrass the presenter, but I wonder if I should have said, "Actually, like in Java, break only escapes from the innermost loop.

Do you think it is better to correct mistakes when they occur or to let them slide? I wouldn't correct an English mistake by a student. Should I correct a CS mistake?

Mistakes should be corrected, but the how can be finessed. You are already correct in giving the private feedback to each student, but you can add an additional level to the game.

Instead of you correcting the student in the live session or later, part of each student's total work product is to produce a report on their own that is distributed to the class soon after the presentation. Much of this can be prepared prior to the presentation and only updated after your private feedback. In it, you can require that the student correct any known defects in the presentation explicitly. They can admit to having made a mistake and provide the correct information without any confession of guilt or error. The info was wrong - here is the real skinny.

There are a lot of reasons for misstatements in a public presentation. You and I make them as well, and we correct them as we can. With students (and new teachers) some of this is actually just a result of stress. So the correction shouldn't increase the stress or give the student any reason to feel bad about themselves. The correction comes from them, even though it was information from you, perhaps, that set them straight.

To simply let it go, misleads the other students of course, so that is a poor solution. But lowering self esteem is also a poor solution. Make the experience a positive one, even though the student is cleaning up her/his own mess.

The written report has an additional benefit, of course, as students need to practice technical writing in any case.


How should I advise an undergraduate who wants a career teaching CS? I've faced this issue a few times as I've mentored undergraduate students and been unsure how to help weigh the options. A senior computer science major wants to teach CS as a career. However, they are unsure what steps to take to make it happen. The context is the United States, and typically they are open to considering teaching at any level, but unsure how to weigh their options.

What are the possible pathways? Should they get a teaching credential? In what? Should they get a Master's degree? Should they reach out to private or charter schools that don't necessarily require a credential?

What are the outlooks for the possible pathways? What's the prognosis for getting hired at a high school? Will they need to also teach math or another subject? Should they consider more creative teaching paths (maybe bootcamps or makerspaces)?

What would you advise such a student?

The Technical1
Across the nation, many states have either legislated (or are currently in the process of legislating) mandatory CS instruction, so this is a fantastic time to find a job in CS education.  In general, there are two paths into the classroom (at least in the public schools).
The first way is to go back to school and get a traditional education degree.  There are many graduate degree options available in every state to accomplish this.  The degree program will also typically walk you through the process of getting your teaching license within your state (though details for licensure in ever state is but a few search terms away!)
The second path is often called alternate route (though some states may have different names for it).  Typically, an alternate route position is created by working directly with a school that would like to hire you even though you have no license, and then working with the state through them. There may be a background check needed before you are even allowed to apply. Again, your students should search for "alternate route, StateName" to get a sense of the procedure and requirements for their target state.
The Emotional
Tell them to be prepared for a very steep learning curve when they enter the classroom as a teacher.  While attrition rates are nowhere near the fabled 50%, they are still quite high, and there are many, many reasons for it.
The first several years are physically and emotionally punishing. In my experience (at three schools so far), getting started at a new school or in a new position requires an absolutely breathtaking amount of work just to survive for a few years.  During my first three years as a teacher, it was not unusual for me to be in my school building from 7:30am until 11pm, only to report back the next morning and do the same thing all over again.  Weekends were for planning, and vacations were for catching up on mountains of grading.
Along with all of that work and exhaustion also comes the emotional roller-coaster.  The highs are exhilarating and the lows can be quite dark.  If you can make it through the first couple of years, it really does get easier, and you can switch out of "fight or flight" and really start honing your craft.  That is when the magic really starts :)
Finally
Tell them to join professional associations (like the CSTA).  And, no matter how much they need a break, go to at least one conference during their first year.  Those conferences will bring them a million ideas, give them a chance to meet other teachers, and also remind them of how very sweet that light at the end of the tunnel is.
And tell them to find some place they can go to with questions to help them deal with all of the bumps and pains along the way.  Perhaps even... this very site? ;-)
1 - My knowledge base is primarily in the state of New Jersey, but I have reason to believe that many states work very similarly.


Programming curriculum for elderly students I have created a basic computer education project for an audience of elderly students (over 50 years old).

The course is very basic, with lessons from "How to turn on/off your home computer" to "Create your first e-mail" to basic use of the Microsoft Office suite.

After the end of those classes, some students started to look for a more advanced course, covering topics such as programming. With them in mind, we were trying to define a basic CS/programming curriculum for them.

One of the challenges here is the students' expectations:

With a hands-on/bootcamp approach we can intimidate some of them who want the course just for curiosity and not to get a new career;
On the other hand, a very theoretical course will not meet the expectations of these students who want a career change or something similar.

I know that is impossible meet everyone's expectations, but does anyone have any previous experience in the creation of a programming curriculum for an elderly audience? How can we balance the students' expectations?

If the students in this course are the same ones, or similarly educated, that finished the last course, you could be over thinking the issue. They don't yet have the exposure to know they want to become programmers.

Design the next course as an Introduction to Programming. To borrow from the course catalog for KCTCS pg. 253:

  Computational Thinking

  Promotes understanding of computer programming and
  logic by teaching students to think like a computer. Covers
  skills needed to develop and design language-independent
  solutions to solve computer-related problems. Covers
  development and design basics including use of variables,
  control and data structures, and principles of command-
  line and object-oriented languages.

That should give the enough knowledge to choose programming as a second career if they want. As an alternative, you could do web page development. That gives a faster return on their work, and allows you to also cover programming using JavaScript. Web page creation is something that more of your audience can potentially utilize in personal life, without having to make a career out of it.

As a third course you could get into the theory and "nitty-gritty" of programming.


How to deal with very low performing students? I saw a question about how to deal with high performing students, and although I think it is very important, the problem that we are facing in my school is the exact opposite.

We have a high number of ghost students (approx. 25%) and also a large number of students dropping or failing in a second year OOP Java class (approx. 50%).

Most of the dropping/failing students have passed CS1 (intro to programming with C) and CS2 (data structures with C). The problem is that they passed with a low grade (10 or 11 in a 0-20 scale) and in some cases, they are enrolling in the OOP class for the 5th or 6th time and have had CS1 and CS2 a long time ago. The main issue is that they've forgotten the most basic programming concepts, and each year it is getting worse.

What should the teacher do?

assume that the students know the basis and just keep on moving forward. (knowing in advance that most will fail)
reserve the first weeks to recap the “forgotten concepts”.
Advise the students to enroll in CS1/CS2 again.

Anyone else has this problem? What have you done? Did it work?

One elegant way to deal with this sort of problem (though it does take a lot of work) is to create a self-explanatory review packet (including a practice quiz!), give it out on day one, and promise that there will be a quiz on its contents during the second week of class.

You then don't need to spend another minute on the material in class, at least for that first week. (Especially for that first week. They should not feel hand-held at first! See below...) You might want to make help available during office hours, however.

This has a second benefit, which is that you can set a recommendation for withdrawal from the class. I would give this a soft sell: "if you can't achieve an 80% on this quiz, then the kindest thing I can do is to recommend that you drop the class. It's not to be mean, but you WILL NOT have a good time here if you haven't reasonably mastered these concepts."

By putting the onus of weeding poorly performing students back on the students themselves, you will (hopefully!) find that you get very little resistance. And folks who choose to stay on anyway will be making an active choice to work very hard going forward (or suffer the consequences).

The big brunt of the work need only be done one time; the review packet and the practice quiz can be the same every semester. It is only the quiz itself that need be changed.

While this should weed out some of the lowest performers (and give many others a much-needed review), if the students are as low-performing as you say, it might not hurt to touch on some of the harder concepts that people get stuck on when you come to them again in the class.

Hopefully you'll have much better performance in the course going forward. Best of luck!


Best puzzle type to foster logical thinking With my informal Coding for Teens group, I like to start each session with a puzzle that we do as a group. My reasoning is that programming is not primarily about semicolons and syntax, but about logical thinking. And logical thinking can be demonstrated and honed with puzzles.

So far I've used grid puzzles (Alice, Betty, Carol, and Dawn have dates with Roger, Steve, Tim, and Ulmer...), and I'm thinking about using the Towers of Hanoi (obviously that's a one-session puzzle), but I'm wondering if there are other formats that are good for this type of group activity.

Edit

To be clear, I'm not asking for a list of specific puzzles / links. I'm asking for puzzle types. For instance, if I were asking for puzzle types that hone language and / or lateral thinking, "crossword puzzle" might be a good answer.

A fun and useful puzzle type is logical operators. Anything and everything that uses logical operators, and the more complex your operator, the better.

Working out how a mysterious logical operator works is a great way to increase, well, logical thinking. You really have to figure out what's the logical output.

An example puzzle would be:

Input: A B C (binary values)

(((A or b) or (not C)) and (C or (not (A and B))))

And then they need to figure out how this thing works. Building a truth table, figuring out tautologies or how one parameter can completely change what the operator does. ( I think C is like that, in the above example).

A very, very important skill this teaches is tautologies. Sometimes programming needs to be tautologous. The question of whether the program works should be true for every input which is allowed. While that isn't always possible (practical-wise), striving for bug-free code is, as I see it, a good thing.

It's also interesting to show the students how a very simple set of blocks (and,or,not) can be used to construct unbelievably complicated things; and to work out how those things work, the students have to develop logical thinking.

So logical operators overall improve a number of aspects of logical thinking.

(It doesn't add too much, but my personal experience has shown me that puzzles such as these are one of the only things that taught me logical thinking).


What should be the difference between a university course and developer training? I teach university students and would like to start teaching prospective developers. As such, I have been thinking about the core differences between these two audiences.

I find that students are sometimes less motivated and less prepared, while developers are more experienced and sometimes really enthusiastic.

Is this correct? And if so, how should this difference impact my methods of instruction?

I teach and develop curriculum at a training-oriented nonprofit, and have taught in an academic setting as well. Here are some of the ways that I try to approach trainings for professional developers:

Remembering that trainings are for practitioners, and as such, the lessons should be oriented toward objectives that will be immediately useful in their work. So, for example, with entry-level developers we de-emphasize (and sometimes leave out completely) topics such as concurrency and algorithm analysis.
In general, relate the presentation of topics as much as possible to how they will be used on the job. With assignments, this can be essentially a linguistic slight-of-hand: state assignment tasks as user stories, provide a narrative for the assignment that aligns with workplace practices ("The client has asked for feature X, and your team lead has tasked you with this feature"), etc.
Using current, professional-grade tools: Git+GitHub, widely-used IDEs, professional-grade databases (e.g. not DBs like SQLite).
Using as supplemental (and sometimes primary) resources that professional developers use. In particular, we emphasize use of official documentation and references.

These approaches often are employed in an academic setting, but they are essential (in my view) in a training setting, where developers will highly optimize their own learning toward direct, practical application. As the instructor, it's my job to make clear the connection between the material and their day-to-day work.


How to teach the value of the command line in high school? Part of what I love about the particular adaptation I use for AP CS Principles — CS50 AP — is that my curriculum teaches students basic Linux shell commands in the Cloud9 IDE. Students learn things like cp, mv, mkdir, cd, ls, and zip (just to name a few).

However, at the beginning of the year, it is challenging to motivate why the command line is a powerful tool to learn. They just take my word for it even though it is a big struggle. It is much more frustrating for beginners than a GUI and has no forgiveness for a mistyped character.

How do you communicate the value of the command line to your students? Are there specific examples you use that effectively illustrate the power of a CLI?

Note: This question is not a duplicate of Command-line Java in AP CS A (although it is tangentially related) as that question asked whether or not a CLI should be taught in AP CS A. This one is focusing on how it can be motivated when it has to be taught regardless of course.

I can't speak to cloud9 but I've always taught on Linux and am a CLI wonk.

One thing I do is differentiate between user friendly and learner friendly. GUI interfaces are learner friendly - they're easy to learn but they're not user friendly because they're not that powerful. They're basically program loaders. You load your program, work in it, exit, next.

The Shell is a little less learner friendly (although the fish shell is amazing from the learning point of view) but it is amazingly user friendly because it allows the user to do all sorts of things.

I try to model this over the course of my classes and I try to provide examples.

For instance, if I wanted to resize a bunch of gifs in a directory, I might show the class something like:

ls *gif | while read i
do
  f=`basename $i .gif`
  convert $i -resize 200x200 smaller-$f.gif
done

If you make it useful to them, they'll appreciate it more and use it more.

I wrote a few blog posts over the years with examples including:

pre-processing and cleaning up dirty downloaded data
processing info from google forms (downloaded as csv)
operating on many files across directories

The posts can be found here: https://cestlaz.github.io/categories/cli/


Advice for becoming more confident in programming I apologize if this isn't the right kind of forum to ask this question, but I've been feeling helpless.

I'm in my 4th year in college as a CS major. However, I am horrible at programming (relative to my peers). I'm just not very smart in general and I'm extremely unconfident when given a programming assignment and during coding interviews.

Because of this, I've tried to go into finance but I'm already behind, starting so late (when all my peers have had investment banking, private equity internships for the past 2 years). Full time recruiting is going on right now, and I applied to both programming and finance positions, but I don't think I'm prepared for either type of interview. Even though I feel like I'm studying really hard, I don't feel like I'm getting any better.

Can people please recommend the best ways to study for these interviews in a short period of time?

I've tried HackerRank but I'm really slow at solving problems and I don't feel I'm being efficient. How would you advise someone who's a complete beginner, i.e., knows basic data structures in C++ (and is also unfortunately not a fast learner) to prepare for coding interviews, in say, a week? (Other than just for a different field :( ) How would you break down each day of studying like? What sources would you recommend?

And any other advice would be really helpful - thanks for reading through

I think you are probably asking the wrong question. You aren't going to become a good programmer in a week. Or a month. Maybe not in a year unless it is well structured.

My advice is to figure out what you are good at, not what you are bad at. Seek jobs that play to your strengths. Not every person that works in computing does so as a programmer, for example. I once told a student who was struggling in a hard course that she would probably wind up as the manager of all the superstar programmers in the class. Why? Because she asked the right questions. Often enough the question is more important than any answer.

You can't go back and undo the mistakes you made getting to where you are. But if you figure out your strengths and write applications that emphasize them and stress them in interviews you may be fine. Just don't suggest you are a programmer, nor stress that you are bad at it.


Teaching loop invariant choice This is in line with a prior question I asked about teaching induction, but this is specific to the loop invariant step.

I have not had great success helping my students see how to choose a loop invariant that will (1) always be correct (ie. actually be a loop invariant) and (2) create the structure that will allow them to actually prove that the algorithm in question will be able to behave correctly.

My personal mental process is simply to look at the final item you are trying to prove, and figure out what property of the loop will mimic that statement.  While this seems to work well enough as an idiosyncratic process for me, it does not translate into a clear thought-process for the students who don't 'get it' naturally.

Does anyone have an idea about how to approach this with students to make it obvious?

Let's start with the term "Loop Invariance". It is a property of a loop that is true before and after each iteration, thus in-variant, non-changing. So then, what is the purpose of the loop invariance in proving algorithm correctness? That is, it is a predicate about what the loop is supposed to do. Thus with proof by induction on this predicate shows the correctness of this algorithm. I know this is still very theory heavy so let's break this down even more.

A simple insertion sort. The purpose of insertion sort is to sort an array. Therefore the loop invariance would be that after each i-th iteration, the array is sorted up to the i-th element. The magic here is that instead of looking at the nested for i, j, loops of the algorithm you are choosing the loop invariance that contributes to the goal of the algorithm.

To answer (1). There is no sure guarenteed way to choose the correct loop invariance unless you are very experienced in algorithm correctness through countless examples. The best approach is to choose the segment of code that is actually doing what the algorithm is trying to do. Such as the example above, sorted up to the i-th element.

(2). I believe this has to do with the proof itself, rather than understanding the loop invariance. Structurally, to prove that the algorithm is correct, you would have to use proof by induction (either simple, or complete) to pove the loop-invariance and the fact that the algorithm actually terminates. Usually proof of termination is a 1 liner, such as when i > array.length, loop will terminate.

  simply to look at the final item you are trying to prove, and figure out what property of the loop will mimic that statement.

I can tell you are very intelligent as this is something only someone who truly understands algorithms and proof of correctness can say. It is actually very difficult for younger students to see this as they are tunnel-visioned by the actual loops in the code instead of the bigger picture. Instead, I think what you are trying to convey is to look for "what part of the code is doing what the algorithm is meant to do"


Should one study programming by doing hard problem? As one learns programming, how useful it is to spend time to solve hard problems? Like, I saw a problem solving site where one task is for example to find a regular expression for decimal numbers divisible by 9 or do regular expression for a particular problem that is as small as possible (in sense of number of characters in the expression). Is there worth of spending time to try those kind of problems or should one always try to solve problems as easily as possible?

It is probably a mistake to always do one or the other. If you are learning a hard task (becoming a competent programmer), it isn't helpful if you mix in another hard task as well (hard problems). Initially, it is good to write programs for problems that you already understand well, so that you can focus on the creation. A program has both form and content. If you work on very hard problems exclusively, it is possible that you will wind up just hacking a solution together without any elegance.

But if you never solve hard problems it won't become clear to you why advanced programming structures and paradigms are needed.

My advice would be to start out your programming education with fairly easy problems - that you can get your mind around easily. But mix in a harder problem or two as you go. Then when you become more proficient with the forms, move to harder problems and occasional very hard ones.

You are stretching your brain in two dimensions here. Eventually you want it to be very flexible. But you can stretch more in one dimension than the other at a time. If your problems are so difficult that you get frustrated then you may not make much progress on any dimension.

And, of course, problems that seem hard to a novice programmer, may not seem very hard to a pro. You learn a lot of tricks-of-the-trade as you go along.

Also the problem that you mentioned doesn't result in a very big program. It is a bit tricky, of course, but very small as programs go. You want to reach a place where you can intelligently create very large programs.


Self guided learning about audio processing I have student who is attempting an independent study next year in audio processing. Her goals involve detecting the meter of a song. Thus could be done through machine learning, or through other forms of AI.

While she will eventually be creating a science fair project, she has asked for advice on what to study over the summer in order to make the most of next year. I have no experience in this realm. I know that she had not yet taken AP Statistics, but I also don't know how much statistical knowledge is really necessary.

As some context, she is a rising high school junior who has already taken AP Computer Science, and a course on C and Assembly Programming.

Can anyone advise on how I can guide her?

Yes, it requires quite a bit of mathematical knowledge, and some understanding of the different AI techniques out there (neural networks etc.).

You could tell her that a good way to go about it is first choosing the form of AI she would like to learn (here you can mention neural networks).

Next, she should try to learn about the mathematics behind the AI form she chose (computers eventually only compute, so there's math in it). For audio processing, neural networks are, in my opinion, ideal because their input can only be a collection of numbers. The key point of this part is thorough understanding of the field, which is necessary for later understanding how to use those tools correctly.

The next step is learning how to convert audio (maybe .mp3 files) to something that the chosen AI can work with. From there it's specific to the AI that she would choose, but the previous step ensures that she'll know what to do with that converted information (for neural networks - train them on that).

It really comes down to the second step. That's the biggest part, and that's where the self learning really comes into play. From what you say, I doubt she'll find it overly complex and difficult.


Students seem to be unable to use code to express their ideas. Is the teaching methodology improvable? In my beginner experience as a teacher, the thing that's strucking me most is a sensation of my students' inability to express their (valid!) thoughts in code. Let me deepen it a bit.

I inherited a last year class that was supposed to know C from their previous years. Anyway they struggled in manually tracing the execution of the code they see, being it mine or theirs.
After some work I could test and evaluate them again and it now seems to me that they are actually quite good at reasoning about a sort of "abstract idea" of what they want their algorithms to do: they can use our natural language to say things like scan this, sum that, stop here or there, and they are pretty much correct. What they seem to have big difficulties in is saying the same thing using a formal language.

They moreover have this (to me, crazy) habit of writing huge blocks in main() without splitting anything, and even worse the only way they think about of producing output is writing to the world: they don't contemplate returning from a function. One (brilliant!) boy once asked me with big amazement after my seemingly strong assertion: "oh, so you mean that strlen() is a function?".
Of course I may understand where this comes from, but I suspect it's not healthy for their learning.

It seems to me that a possible reason of this observed behaviour might lie in having taught them to build huge state machines without making them have a clue that they are building huge state machines: they can reproduce some they have already seen but are really lost when needing to make a new one. Even having them apply small modifications seems to me more like a blind trial from their part than some reasoning about the meanings. The building blocks of the language do not play well together in their minds or they are just unable to think about the state transitions in the code.

If I have to push myself a bit more I can say that I suspect all this is a reflection of the non composability of state machines, making their use in teaching to absolute novices not effective, whereas functions are known to be composable and would presumably lead to better results, in terms of being a means for mapping an individual's thoughts to formal language.

Is my analysis plausible? Have you experienced anything similar? Is there any available scientific literature on these phenomena? How would you test them to investigate deeper their difficulties and how would you try to show them a more effective route? Is there anything you would do to improve the methodology for next classes?

Should state machines be introduced somehow more explicitly, with better examples, showing how do they actually solve problems before throwing them to the poor students with a burden of syntax that they know nothing about? They even told me clearly that syntax is the only thing they focused all their energies on in their previous years.

What I am doing in younger classes is proposing functions first (as in functional paradigm), to solidify the concept of building a small composable block that has input and output, waiting a bit more in the future to introduce state transitions using the classic drawing turtle of fame with the hope that its visual feedback might make things tangible.

There is a lot to unpack here, but first, YES, the teaching methodology can be improved, but that is always true, an unending quest.

Next, I'll note that C is a language with enough pitfalls that many people struggle with it at the detail level, finding it harder to think more globally. My preference, perhaps not open to you, is to start with a language at a higher level of abstraction generally and then, later in the curriculum, work both downward toward the machine and upward from where you start. An OO or pure functional language, if well taught, makes abstraction easier.

However, the biggest recommendation I'd make to address the problems you state is to introduce (at the beginning) unit testing and test driven development (TDD). Find a good testing environment for your language and insist on its use: No Code Without a Failing Test.

I normally start out a course with TDD, combined with giving assignments in an already logically decomposed way. Instead of a large program to write (large is relative, of course), I give them the "top down" decomposition initially that, in C they would be able to implement by writing a lot of functions.

Thus, at the beginning, I relieve them of having to face a blank screen with a large problem and nothing but 'main()' to work with. Later you can continue this, but making the pieces bigger, requiring some decomposition (helper functions) be developed. My mantra for a "too big function" is about five lines. My mantra for "too complex function" is nesting more than two levels. You can break these rules for especially boring code, but not for the interesting logic of a program, or it will be impossible to understand and maintain.

Note that breaking a problem up into parts is how Agile Development (Extreme Programming, Scrum, ...) actually work, with the Customer (in this case you) giving the Team (your students) manageable problems each of which contributes value.

Also, with TDD, you can provide some tests initially along with simple requirements. Teach them to stop programming when the tests pass. Or, write additional tests and make them pass. But the tests are small and simple, usually without internal logic, and the application code needed to make them pass should also be simple function and uses of functions.


How to teach beginning students how to find and fix syntax errors? Our college has a course entitled "Introduction To Programming", although I often tell the students that the real title should be "Introduction to Programming... for non-majors... who have never programmed before" (some people will take this course, decide they like it, and go on to major in Computer Science / Software Engineering / etc., but there's no expectation that any particular student will do so).

Given that there's no expectation of prior programming knowledge, we spend some time (in class, on homework assignments, etc) teaching students how to find and fix syntax errors in programs (both theirs, and instructor-provided programs).  (We're using traditional, textual programming languages like Java / JavaScript, and NOT visual languages like Blockly, etc)

My question: What techniques, exercises, approaches (etc) have you used to help students learn to deal with syntax errors?  What are the pros & cons of your approach?

I would start by showing them a few natural language examples, where changing one letter in a sentence completely changes the meaning, perhaps into nonsense.  Most computer languages respond similarly to almost any syntax change.

Then show students program lines with correct and incorrect syntax (of typical mistakes, perhaps taken from previous sessions of the same course), and the corresponding error message(s), and/or incorrect/unanticipated run results.  Quiz questions to test this might be, given a line of incorrect syntax, what is the corresponding error message (or bogus result) and a possible correction.

The important idea is to help students form a mental connection between changes in syntax and changes in (IDE/compiler/interpreter/runtime/etc.) behavior.


How do you assess students' understanding of abstraction? We've just uploaded a video of a presentation Simon Peyton Jones and I did about Project Quantum to CAS TV. Project Quantum is an attempt to crowd-source low-stakes formative assessment items for computing; we've just over 5,500 questions at the moment.

I boldly (and perhaps erroneously) claim that there's no bit of the computing curriculum for which we can't create multiple choice questions (MCQs). Note, this is rather different from claiming we only need to use MCQs to assess learning in computing, which is very far from what I believe.

My colleague Pete Kemp remarks on the Facebook that he's "still waiting on a Q for abstraction that isn't about definitions...". Here's what we have on the Diagnostic Questions site at present (free registration required).

So how do you assess whether your pupils understand, or indeed can apply, abstraction? Could you knit this into an MCQ?

Examples (of far from satisfactory questions) from https://diagnosticquestions.com/Questions?CurrentSubjectId=1688&OrderBy=Newest&IsByStudent=False All CC-SA

tl;dr: Just say no.

This question is difficult on many levels. I seems to me to be a land mine of misconceptions and has the possibility to lead to poor teaching practice.

First the difficulties

Only concepts can be abstract. Abstraction is about ideas. Animal is a concept. Mammal is a concept. Animal is more abstract than Mammal since it contains the idea of Mammal, but isn't restricted to it. The kitty sitting on my hearth is concrete, not less abstract than Mammal. The kitty isn't a concept it is a thing.
Given some ot the examples, there is a misconception about what is abstract and what is concrete. Physical things are not abstract. One can't be more abstract than another. Even things that aren't physical, but which can be manipulated, are concrete, not abstract. A LinkedList (Java) isn't abstract. It is concrete. List, on the other hand (an interface) is abstract.
In computing there are many, many different kinds of abstraction. Even the concept of a while loop is an abstraction. In OOP languages classes implement abstractions. Interfaces (even if the language doesn't have that explicit feature) are abstractions. So, Python has interfaces, though it has no language feature with that name. If two classes have the same interface they are realizations of the abstraction, but neither is more or less abstract than the other. If one interface contains another interface then it is more abstract.But we also have data abstraction. Lists and Maps define an interface (an abstraction). They can be implemented/realized many ways. Each realization is concrete, not less abstract.
The web site cited seems to be trying to test everything with Multiple Choice Questions (MCQ). I question both the possibility of that and the wisdom of it. Some thing are complex MCQ are simple. Trying to push the assessment of complex things through such a small funnel seems misplaced to me - even foolish. I'm pretty sure that MCQ also advantage certain students and disadvantage others. They are fine for rote memory and facts, but pretty poor for deep understanding. I have nothing against their use unless it is overdone. MCQ are also difficult to validate. The wisdom of groups isn't enough. It takes statistical measurement and cross validation to do a good job of it.
The Font Construction example given in the question also seem to be testing specific vocabulary. This example threw me completely. I think I could eliminate one answer, but also think I could justify each of the others if given the chance. If it is specific vocabulary it is just rote memory and hoping that the student "remembered" to remember the right thing.
Often, getting a MCQ wrong and then later learning the correct answer can sometimes leave students simply puzzled and frustrated. This results in a destructive game that I'd rather not play.
MCQ try to put a lot of thinking into the questions so that no one needs to put any thinking into the answers after the student finishes. This may scale well, but is a sub-optimal form of education. After all, it is the students thoughts that we want to get a handle on in assessment.

I don't believe that a single, or even a small number of MCQ could capture the student's understanding of abstraction or any similarly deep concept. I think that if you had quite a lot of questions (say 20-50 of them) you might be able to get a handle on it, but it would take very careful cross evaluation of the answers given to be able to say with any confidence. Getting a single question wrong likely tells you almost nothing. And that, of course, makes MCQ less valuable for its main use - quick and easy evaluation.

I could, on the other hand create a bunch of questions that start to get at the student's understanding. The ones I'd like to use are short response questions, but some can be simple choices.

Assuming that the student have a common language background, something like "Is java.util.List abstract or concrete?" "Is java.util.Collection more or less abstract than java.util.Map". One choice for the answers needs to be neither of course.

You can show code fragments and ask whether they implement an abstraction properly or not. But a follow up "why or why not" gives you better information. And some of those questions would necessarily be a bit long to be meaningful and thus take some time for the student to evaluate.

"How can functions be considered abstractions?" Well, that was poorly stated, since a single function is concrete, not abstract, so you need to be careful: "How can the idea of a function be considered an abstraction?" is better. You could probably give a few suggestions for answers to this to turn it in to a MCQ, but it would be hard to come up with four, of which three were viable and yet not correct.

However, I've only hit the surface here and only explored a very small part of the abstraction space in computing.

Caveat: I never had to teach or evaluate a hundred or more students at a go. My classes were always small enough that I could use better evaluation techniques than MCQ, though would be likely to use a few in a larger assessment that allowed the students more creativity. If you do have to evaluate 800 students I hope you have help. If you don't something is deeply wrong. I note that Harvard CS 50 is run by a team of about 80 people, with quite a number of roles. I hope that each student has some individual person responsible for them. It isn't the professor.

My initial "just say no" is to the idea that you can completely evaluate a student with MCQ, not that they can't be useful, dangerous drug though they are. And note that I have the highest respect for Simon Peyton-Jones.


Project based on game 2048 I'm thinking about an assignment based around the game 2048. This would be towards the end of a first programming course at the university level and assumes the students have been introduced to at least two dimensional arrays, loops, conditionals and methods. The purpose is to have the students practice these skills.

I would represent the board as a two dimensional array of int.

I would require a method (e.g. merge(int[] row)) which does the work on an individual row of the puzzle when the move is to slide left. The idea is to encapsulate the work of a slide in a single, testable method. This also emphasizes that a two dimensional array is an array of array, and that one can work on a single row at a time.

What are your opinions on the following ideas:

Should a single move in the game be implemented as (move(direction)) or as individual methods (up() down() left() right())?
One idea for completing the game involves rotating the board by multiples of 90 degrees. Then a move can be implemented as a three step process:

Rotate board to one orientation
Slide all rows left (merge(board[row]) for each row
Rotate board back to original orientation

Another idea is to show them that move right can be implemented by the process

reverse a row
slide it left (merge(board[row])
reverse the row again
For columns, copy the values from a column into a one dimensional temp array, then perform the merge(temp) and then copy back to the board. This may also require reverses, depending on the up/down selection.

Require a method to produce a list of empty cells for use in picking the location of the next "insertion". This could be a list of int to demonstrate how a single index can map to a row/col using div and mod operations. Alternatively, it could be a list of pairs of row/column.
The last wrinkle is to decide what to actually stored in each board location. The simple answer is just the value. However, an interesting variation might be to store the log2 of the value. By doing this, you get an index that can be used to select, for example, the background color of each square of the board. This changes the logic of merge(), so that
combining adjacent cells ups the value by 1, rather than adding two values together.

Am I trying to put too many different concepts into this assignment? Your opinions and suggestions are appreciated.

Thanks

First of all, it seems like rather nice bones of a 2-dimensional array lab. It does not strike me as being too many things at all.

The interface is cleaner with move(direction), but the internal logic is cleaner divided into methods.  Why not the best of both words?  Provide them with starter code that will utilize private methods:

public void move(direction){
  switch(direction){
    case UP:
       slideUp();
    case DOWN:
       slideDown();
   case LEFT:
       slideLeft();
   case RIGHT:
       slideRight();
  }
}

That is another way, also valid.
It seems excessively finicky to require implementation details down to this level.
Once again, I would provide the interface, but not these sorts of implementation details.  You can provide both ways as suggestions, but leave it up to them.  They may also choose a third option that you have not mentioned.
This fits very nicely if you are providing some sort of GUI starter code, which would justify an implementation detail like this one.


Lab Requirement in AP CS A The official course description for AP Computer Science A, a high-school level course focusing on OOP using Java, details a 20-hour lab requirement. College Board provides three labs ready-made for teachers to use in class -- Magpie, Picture Lab, and Elevens -- but does not specify that these have to be used to satisfy the requirement. This page gives an overview of the labs along with student guides. Completing year one with these labs (and indeed AP CS A as a whole), I am reflecting on my experience with them, and I am now curious about what else is out there.

This review from one publisher raises some serious questions about the inclusion of the three exemplar labs. In particular, their conclusion states the following:

  In our opinion, one or two activities from Magpie and Picture Lab
  might fit into a typical AP CS A syllabus. Elevens is best left for a
  team project after the exam (unless the Development Committee decides
  to make it a new case study). Implementing the labs in their entirety
  in an AP CS A course would wreak havoc in the syllabus and may derail
  the course.

Have you found these labs insufficient and/or overly time-consuming in line with this particular review? If so, how did you address this in order to meet the lab requirement?

I looked at them when they first came out and decided not to use them. Did go through and look at the topics and make sure that we're covering everything we need to in class. But between labs that I've written or purchased we've got a pretty good set of assignments that covered everything that the AP provided labs hit on.

The 3 AP labs also lean more towards projects instead of simple labs. I prefer to do a lot of small, single method labs. Especially early in the year. We do larger scale projects later, and they overlap a lot with what AP provides.

And not really part of your question, but I can't imagine only spending 20 hours on labs through the year. We probably hit that goal within the first month of the year.

Edit

Following up on a comment asking about lab sources...

The best labs are past AP exam FRQs. My goal every year is that by the AP exam we've done every past FRQ in class as a lab, quiz, or test. We start in September. Going back to 2004 there are 45 FRQs if you don't include the GridWorld ones. I generally assign them as in class assignments though since there are solutions posted everywhere online. If they're assigned to be worked on outside of class they'll be daily grades which have very little grading weight in our district.

Another good, and cheap, source are programming packets from old contests. UIL, the organization that runs academic and athletic contests in Texas, sells past tests on their website. You can buy a PDF with all the tests from a year for $4. There are 5 or 6 tests a year with 40 multiple choice questions and 12 programming problems in each test. Only downside is that they're not sorted, so you'll have to go back and figure out where they fit. And some are more data structures problems instead of AP-A. ACSL also sells past contests on their site.

And our district buys curriculum from A+ Computer Science. Best thing here is that it's a complete curriculum - labs, project, quizzes, tests, slides; everything. I use this mostly for the written tests because I hate writing multiple choice questions, but I also tweak some of the labs a little and use them.


Data and Database modelling books I need a suggestion for books for my University. I have a subject called "Data and database modeling" but we lack of books. Our professor gave as barely understandable scripts. This is an official explanation of the subject:Curriculum:
Introduction of data structures used in database modeling. The data structures include data objects, associations between objects and rules for performing operations over objects.
Modelling of databases regarding user demands.
Basic database concepts.
Configurations and commands for certain real databases.
SQL commands for working with databases.
Course goals/Competences:
Data Modeling and design of data structures suitable for optimum operation of databases.
Using the basic set of SQL commands for working with databases.
Any suggestions are welcome :D

I highly recommend Database: Principles, Programming, and Performance, by O'Neill and O'Neill. Learned from that book for my first database course and loved it.


Scheme - Which book To Use I am preparing to teach Scheme now, so I need a good reference book. I like books which can dig deep, with none of the beginner level introduction stuff that some books like to spend time on.

So, what is the best book to use as reference?

Note : In line with my usual style, I would prefer books that are available in both dead tree and online editions, with the online edition having a higher priority.

How to Design Programs is released under the MIT license, and has the distinct advantage of being integrated directly into DrRacket.  This allows you to work through bite-sized chunks of Scheme, and gives you an easy tutorial-style way to follow the textbook as you explore the language.

Within DrRacket, go to the Language Menu, and the Teaching Languages are in there.  They each reflect portions of How to Design Programs.  The instructions for utilizing the Teaching Languages are contained in the preface to the book.


Working on practical projects as a team - good or bad? We are trying to implement a course where students develop web apps using PHP+AgileUI (no HTML, JavaScript or CSS) with a strong emphasis on "object oriented" approach, designing business logic and reuse of UI components.

When it comes to the practical tasks, we are undecided. Should we encourage students to work in teams to achieve project together, or should we make them submit their unique work? Since most of the work is in PHP, there are no design/frontend/backend separation, we have a feeling that some students may "miss out" on some skills if another team-mate implements it.

On another hand - teamwork is crucial in software design.

What would you recommend - should we design material for teams or individual?

Ultimately it comes down to if the work can be done alone? The purpose of group work should not be so that everyone has less work to do, but rather if the original work could not be done within the given span by a single person. In the workforce, you're most likely to be working in a team and contribute to iterative releasts (Agile Methodologies). If your expectation is that because you're in a group, you don't have to work as hard compared to working alone, then you are set to fail.

My suggestion would be to design a project such that bi-weekly or monthly iterations are presented, building up towards the final product. Incorporate Agile Methodologies into this as it is very useful in the workforce and teaches team management / tracking. Groups should be no bigger than 3-4, otherwise it is too big to be efficient. The number of hours required for the project should be big enough that everyone is kept busy. Of course some will do more than others, however one person should not be able to do the entire project.

If this is too heavy for your course, then I'd suggest stick with single person projects as there is no merit to group work.


Introducing Pair Programming I'm currently reading a book, Polymorphism: As It Is Played, which has introduced me to several new instructional ideas.  I am particularly intrigued by Pair Programming, which seems like it could benefit everyone.  However, if I simply describe the idea and tell my high school students to go, I feel like there is a very good chance that it won't really take.  The Navigators might not remain fully engaged, or the kids who are more advanced might just take over the Driver position and not bother to explain what is going on.

How, then, can I handle the introduction?  What are the pivotal ideas that can enable my students to use this tool effectively?

Edit: I understand that a similar question has been asked here, but my question comes from the perspective of a teacher who is far less familiar with the source material, has never used it in a classroom, and is specifically about the introductory lesson.

If you haven't used Pair Programming (PP) before but want to introduce it, there are two additional books you should read for background. They aren't textbooks for your class, but put PP into context. Extreme Programming Explained gives the complete context of PP in the agile development process. Pair Programming is one of the "small scale" practices of  Agile Development - a personal practice, that is used in most agile methodologies.

The second book Pair Programming Illuminated focuses more on PP itself.

Since students may do much of their work outside your view, they need to be convinced that it gives them something or they won't use it. The alternatives seem too enticing to them (e.g. splitting the work...). So the classroom demo suggested here (points 3 and 4) is probably necessary: Techniques for encouraging pair programming.

The problem is that they already have programming habits and they will fall back on those in a pinch unless they see a compelling reason to do something different and develop new habits. The classroom demo can help with that. But you have to play navigator yourself, not just driver, in your demo.

The wisdom of the profession on PP is that the driver takes a microscopic view of the project at hand. If the navigator is behaving correctly he/she will take a broader view, thinking about how what the driver is doing fits into the whole of the app being developed. When you work alone you only get the micro view, which often enough leads you astray.

The navigator is not just an after the fact reviewer, but an active participant. That takes practice. This is the key to making PP productive. You have two minds on the problem and each has a slightly different perspective.

Another advantage is that single programmers often get stuck and have to think for a while about how to proceed. But two programmers seldom get stuck at exactly the same point. That is the time to switch roles. The navigator notices a change in the pace and, perhaps, takes over the driver role for a while.

I have a picture in my head of 10 programmers, each working alone in a cubicle, and each stuck on something, making no progress, but the person in the next cubicle having the key to continue.

Another good practice, if you are always using test first programming (TDD = Test Driven Development) is that one person writes a test, which fails. The other person builds enough of the app to make that test pass and then writes the next (failing) test. The first person takes over to make that test pass, etc. Back and Forth. Clockwork.

To understand when and why the driver and navigator roles should switch, think about what a solo programmer does quite naturally. You are programming and have been for a while. You are in the grove. Things are flowing. You are focused like a laser on your work. The solutions are coming naturally. And then... suddenly you hit an obstacle. The next thing isn't obvious. At that point, you naturally widen your focus and look at the wider picture. You eventually "get it" and move back in to continue. Or, perhaps, you take a break.

On the other hand. Consider what is natural for someone looking over your shoulder as you work, making occasional comments on things like naming, or structure. Perhaps reminding you of some method or tool you might employ rather than building something new. They are taking a wider view since they don't have responsibility for the progress. And then, suddenly, they notice a change in the pitch. You aren't making progress and seem puzzled. At that moment, their instinct is to focus more closely on what you are doing to try to resolve the issue.

So, one person widens focus and the other tightens it. That is generally the moment to swap roles as the role is determined by this level of focus.

If you try to switch roles by some arbitrary means, such as time, you will likely lose the advantage of the "dual focus" view of the project. The most likely outcome is either (a) the navigator becomes disengaged altogether or (b) both take the laser view, losing the broader, overall, view of the program.


Course for the more practical aspects of software development By default, I approach every training I conduct ( I mostly conduct sessions for folks who are in their final year, or finished graduation but looking to upskill for a better career) with a simple underlying goal. If you learn xyz technology, will help you (eventually, if not right away) to make a little more money than what you do now.

I have noticed that there are a lot of students (defined above) are pretty good in what they do (coding stuff). However, they lack certain essential skills that are really warranted in a work atmosphere. Taking my own example, at best, I am a below average developer at best, but somehow somewhere, I end up working in some high level projects. When I self analyse, I notice that my communication skills, presentation skills and simply the ability to discuss without fear with the key stakeholders (like the VPs, CTOs and CEOs) allows me get assignments that otherwise would not.

So, over the years, I have made it a point to provide feedback about non-technical skills to my students. Now, after so many years of training, I want to take this to the next level. instead of just giving feedback, I want to make it part of my curriculum. There lies my challenge.

In a session I conducted last year, I noticed that an entire team of developers were just straight up bad with their English. This may seem strange to other community members, but English, the preferred language of communication itself is a huge challenge for many of us folks here in India. When I finished my gentle tirade by concluding that the reason why all of them being billed lowered rates despite being technically competent (and I was one of the trainers who made that happen) is because you guys cannot speak and communicate in general.

Eventually, despite maintaining excellent ratings for all the previous ratings, for the last day, I got 1 out of 10 ratings for every point in the review sheet.

So, a very long story short, like the English example above, there are so many other qualities that are lacking in developers in general. I want to make it part of my training, but at the same, I don't want to end up with negative reviews either. You folks are in the education domain. Have you faced this issue? How can I handle this?

Right now, the only solution I have is, just give up on that. My pay is linked to my reviews. At the same time, I feel strongly about this. As always, if this is too broad, I hope the mods will flag it, or I can break it up into individual questions.

What you are trying to do is entirely laudable; helping your students to not only be better engineers, but also better hires, could help them in tremendous ways in the long run. However, since you are in a situation where your rating numbers matter very much to you, be careful that you always attend to your own professional needs as well. You would be in no position to help others if you simply lost your job.

Usually, people are okay with instruction that meets their expectations. Therefore, I agree with G. Ann that telling the students that this will be a part of the course is an important first step.

However, students signing up for a specific technical course might already have fairly fixed expectations before they enter your classroom, and, as what you are doing may differ from these expectations, you may find that your review marks still take a hit.  Thus, I might recommend two alternatives as well:

Develop a course in soft skills for developers. Include a full evaluation in order to address areas of weakness that you cannot reasonably cover in class (such as English), and spend the course time talking about the things that you can do. The advantage here is that students who sign up for the class will clearly want it.
Keep incorporating the material into your regular coursework, but make some of it optional for students who want it. And, as already said, always pay very careful attention to setting the expectations of your students with clear communication.

It sounds like your circumstances may preclude you from doing this sort of work if it causes a hit to your salary, so you may need to carefully monitor the effects of taking these changes, and communicate with your own administration to be sure that any temporary drops in your numbers will be understood correctly (eg. you won't lose your job).

Good luck!


How to prevent dictating the solution when tutoring My girlfriend is currently in her final year in college, and is following a first-years programming course, learning C++. The class is graded partially from homework exercises. She is struggling with them, mostly at a point "I don't know where to start" or "I don't know how to approach this." So I try to help her with that, but I don't want to end up doing her work for her.

One recent example was the introduction of classes in C++. They were supposed to create a class that simulated game of life. After pointing her to representing the world as a boolean matrix (array of arrays), the thing she got stuck on was printing the world (or a part of it) in the console.

So there are a couple of questions she might have:

How do I do X? How do I create an instance of a class? How do I define a member variable?

These are all questions that would be easy to look up. As such I am hestitant to rightout give the answer.

How would I approach this? How do I print the world? cout << world; prints the pointer, so what should I do instead? How do I account for the edge of the world?

If I were to directly answer these questions, I would essentially be making the assignment myself. So this is not something I want to do.

So instead I try to ask pointed questions, questions that should put her somewhere closer to the solution.

  How can we print things to the console? In which direction does the cursor move? So where do we want to start reading from world?

I find it hard however to ask these questions clear enough to not get a puzzled look, but also vague enough to not flat-out give the answer.

Afterwards, I feel like I have essentially dictated the entire assignment. Additionally, I feel that if I were to delete the entire assignment, she would struggle very much to reproduce all of it on her own.

Question

How can I improve my help in such a way that I don't end up doing the assignment for her?

After I wrote what is below, I realised that most, but not all, of it is for her. Your role is to help her take on this practice, to stop her jumping ahead, and to slowly get her asking herself the questions.
Separate algorithm design and coding.
Help her to separate, designing the algorithms and programming. It is too much to learn a language and to learn to program at the same time (Even if the language is not C++).
To do this try physical and paper activities. E.g. for displaying the world. Walk it out. She is the cursor, see walks the path of the cursor placing sheets of paper (characters), on the floor.
Break the task up

We need a 2d world. I don't know how to do that, but I think I could do a 1D world, and I think I could then build on that to make a 2D world. So I will create a model for a 1D world, and write a display method for it.
Let me change the values in the model, does it display correct?
What if I change the model after it is displayed? it should change the display. So do that.
Now let me try 2D.
That is the display (output part) done.
That next.
…

Ask these questions. On each question don't look ahead (don't try to do too much at a time). Get her asking herself what the next step is.
In general start with the output, then the input, then the process. (on more complex systems, you will not do all of the output first. You would do  repeat { output, input, process }.
The difference between an expert and a novice is not that the expert can keep complex ideas in her head, but that they do one thing at a time, so only keep one thing in their head.
Summary
Repeat this 4 step process

repeat until complete

Thing about what to do next e.g.

First it compiles but does nothing
Second displays 1 line of world.
…

Use a physical activity to design the algorithm e.g.

Embody the cursor.
Use a checkers board, or other objects to model the model.

Decide what done looks like (for this iteration only: e.g.

program compiles,
Computer displays -----*-----)

repeat until done {Write code, test}


What are good models for an Honors Program for CS students? One way to extend the reach of your best students is to have an Honors Program that, perhaps, runs over several years.

One model is to have a special program to which students are invited. Participation extends over several years, perhaps with separate classes.

If you have experience with such a program, either as a participant, faculty member, or creator, what was the model and what worked and didn't in your program.

I was a faculty member for students in one such program but had little influence on its general structure. Students could designate any course(s) in the curriculum as honors option. If the professor agreed, then the student and prof made a mini contract for extra work in the class. This was sort of small scale from my perspective but worked well in my (limited) experience. There were no special lectures for these students and the other students weren't affected. The honors student had to do more to earn an A in the course, but that was part of the contract. I had to design a more complex project for the (compiler course) students was the only real difference.

When I was an undergrad at a liberal arts college we had a general honors program. I studied math and philosophy, but the program was tailored to the liberal arts. Students were invited at the end of the first year (of four). A faculty committee was responsible for invitations, though I suspect that a student could petition for entry. Every term the program had a different theme, literature, science, psychology, history, etc. depending on faculty interest.

The students read a book on the topic of the term each week and met in seminar for a few hours once a week. The faculty said little as the students discussed the book. At the end of the second year of the program (third year of study) one of the seminars was public, held in an auditorium, with a reception following. These were well attended.

The final year was different. We developed a "thesis" paper in our major study area, so mine was in the philosophy of math area.

Since my major was fairly narrow (but also required science study) I cam away with a nearly perfect Liberal Arts education. The only area of the Medieval University course of study that I missed was Astronomy.

However, the honors courses were in addition to the regular student load. The courses were pretty intense, so could lead to burnout. Also, someone already studying, say philosophy, didn't get as much "broadening" as I did since they already studied many of the HP topics anyway.

I liked that Honors Program model, then and now, but here I'm more interested in something specialized for Computer Science students. I think that both small scale and large scale programs are interesting and might serve as models for others to consider.

Much later, I helped design a doctoral program in computing that had many features of the above honors model. Three years, two of study and one of dissertation. The years were calendar years with no breaks and dissertation topics were expected to be ready to go by the beginning of the third year.

My personal context is the United States where undergraduates take many courses in many fields with one chosen as a specialty. My examples are from the US of course. However, other places, in which students are much more specialized as undergraduates have, in my view, similar needs: foster a good learning environment for the best students who want to go beyond and can use faculty guidance. What would an "honors" program look like in such a situation?

First, I will describe my university's program, and then I will give my thoughts on its efficacy as a participant of this program.

My university makes a distinction between the general "University Honors" program and specific "Honors in the Major" programs. Students are invited to the honors program based on particular GPA requirements, which then need to be maintained to remain in the program. You can complete University Honors without completing Honors in the Major (although the latter fulfills the second criterion for the former, which I will elaborate on below), but not the other way around. Honors in the Major has specific requirements for each particular major (although almost always means writing a thesis on some form of undergraduate research), whereas University Honors is standardized.

The criteria for fulfilling University Honors are two-fold: First, the student must fulfill 12 semester hours of honors courses. This can be done in several ways: taking specific honors courses/seminars (which are intended to provide a broad, liberal arts education), courses in their major which have been designated as honors, or as you describe, contracting a course to count for honors credit. This entails approaching a professor and agreeing on an honors project to complete by the end of the semester.

The other criteria that must be filled is what is called "experiential learning". This involves getting "12 semester hours" via doing things like participating in undergraduate research, getting internships, being a TA, etc. It's a fairly extensive list, with each particular experience counting for a different amount according to the duration/time commitment involved.

In my experience, I think the latter portion of this program is much more effective than the first. It incentivizes students to apply themselves beyond immediate academic rewards, a trap that I have noticed many honors students fall into -- obsessing over their GPA at the expense of everything else. The first is relatively trivial -- the requirement can be fulfilled during a single semester, and often is -- and honors courses are not excessively difficult when compared to their regular counterparts at my university.

I think the purpose of an honors program should be aligned more towards the second criterion if the intention is to create exceptional students. If the focus is mostly on courses, you risk trivializing the program (in my case) or burning out your students through excessive work (in your case). I think putting the emphasis on ensuring students apply themselves, rather than just taking more difficult courses, is a better model for developing students personally and professionally.


Note-taking for self-studying What is the best way to take notes when self-studying? I myself swing rather wildly between writing down everything and writing nothing. Obviously, neither is a good approach. I also have troubles with the neatness of my notes, especially because my handwriting isn't exactly pretty. What tips do you recommend for taking good, neat, understandable notes?

There are two reasons (at least) for note taking

creating a shorter, abstracted, version of your sources that you can save to return to later without recapitulating your whole education.
learning something about the topic - getting it in to your head.

For the former, you can type up notes as you go. Try to focus on the main points, not the detail. Leave lots of references in your notes so that you can easily return to the source as needed.

However, if your objective is to actually learn the material from an operational perspective - using it - then typing up notes doesn't help nearly as much. Writing out things long hand is much better - but you may need to practice with the pen. And the fact that it is slow is also an advantage, since you engage with the material over a longer period.

If you are studying for a field in which you want to become a professional, take notes by hand with a pen on good paper. In fifty years you will still be able to use those notes whereas the computer notes are likely inaccessible.

The reason for long hand writing (even printing) is that your brain is more engaged in the process than it is with typing. That is how you learn - engaging the brain, not the motor muscles in your hands (unless you are learning a physical act like rock climbing or a martial art, where muscle memory is equally important.

Moreover, to learn some subjects you need to also use the knowledge you are gaining. In math you solve a lot of problems. In CS you write a lot of programs. I History you pose a lot of theses. Whatever is appropriate, but it involves problem solving and creation in some way.

See https://cseducators.stackexchange.com/a/1168/1293 for additional comments, including the other answers to the same question.

If you search this site for "changing the brain" other hints will reveal themselves.


Interesting Programming Exercises to Teach Inheritance? I originally asked this over on Stack Overflow, but they suggested I look here instead:

I'm currently teaching my students about the concept of inheritance (we're using Python 3) but am unable to think up (or find) any meaningful programming exercises. Everything I seem to find online as a teaching resource rehashes the same forced examples: Employee() inherits Person(); Dog() inherits Animal(); etc.

While these are great ways to drive home the basics of inheritance, I can't help feeling they are a bit hollow as programming exercises. In the end I don't feel like I've made anything. Unlike, for example, the myriad of different exercises out there that can be used to teach recursion.

Anyway, I'm sorry for the rather "soft" question, but I'm just desperate for some better examples that could actually be tackled by a student who's still learning the concept. Thanks.

I'm not as familiar with Python as I am with other languages, but I'm sure your students have played Minecraft.

If you haven't, I suggest taking a few minutes to find some introductory "Lets Play" videos on YouTube first.

Let's talk Blocks.

Minecraft has dozens of blocks. Dirt, some, water, colored wool...

All blocks can be broken, picked up, placed, stacked, stored in chests, and crafted together. But not all blocks do just those things.

The chest let's the player store items in it. The furnace smelts some blocks into other blocks. Grass, when broken, drops a completely different block. Stone doesn't drop anything at all unless dug out with a pickaxe.

Minecraft can do this because of all of those basic methods that subclasses inherit and override.

Take this method (not pulled from source, just based on):

public List<ItemStack> getDrops(World w, Pos p, bool harvest, int fortune, Random rand) {
    //basic implementation
}

The default implementation puts a single item (the block itself) into a list and returns it.

BlockGrass would put dirt into the list instead.

BlockStone would check to make sure that harvest is true and the put cobblestone in the list.

BlockDiamondOre checks harvest and fortune, putting a different number of diamond items into the list, even determining how many based on the Random supplied.

And so on.

There are roughly 100 different methods in the block class to handle all of the possible functionality. Update ticks (crops), neighbor updates (observer, torches), interaction (doors, chest, furnace, crafting bench), whether or not a block has a tile entity (chest, furnace), and on and on and on. Most of them are blank and do nothing, entirely up to the derived class to add to, if it needs it.

The same goes for items, some of which (like sticks) don't even have a derived class of their own because they do nothing special. They just exist and do everything any item can.

This is why the are so many mods for Minecraft that add so many new things: no one1 has to implement anything special in order for everything to Just Work.

1Well, except Minecraft Forge, who maintain the official unofficial mod API. But Forge is a special kind of magic that isn't important here


How to handle students who excel at coding but aren't interested in theory There are some students who are very good at coding. They can crack any logic problem at their level. But they aren't very good at CS theory. They can code better than their classmates, but they're indifferent about the theory, displaying an attitude of "I don't care".

In this case, theory means there are various theory papers are presented in the syllabus such as "Theory of Computation" which talks about NFA, DFA, Turing machines, etc. Another example is Artificial Intelligence, which talks about ES, Fuzzy logic, etc.

How can I handle such students?

They are at a 17-19 age group.

I suggest 2 possibilities:

Talk to them. Explain that at some point, they won't be able to rely on just being able to code well. For AI theory, at some point the algorithms are dependent on so many parameters, making it impossible to write working code without knowing what each parameter does. (A simple example for this is neural networks. The simple ones have ~5 or more parameters which need to be fine tuned). If they know the theory, then they'll be able to write good code much faster, with fewer bugs and mistakes.
Throw them in the water. If the other approach doesn't work then you can just give them an assignment, an assignment to show them that they simply can't go too far without learning the theory. I personally like examples from machine learning theories (Also, it's one of the fields I'm more familiar with). If you ask them to write a genetic algorithm, they'd quickly find out that they need to learn the various methods in the field. They'll be lost without learning those. The same is true for anything in the field of Deep Learning. If you give them such an assignment, and let them work on it for a while, they might produce results that are not too bad. However, if they were to read and learn the theory, they would produce far better results. As pointed out, it's important to give them an assignment that is authentic, and preferably something that is used in "real life" (like advanced search algorithms, which require heuristic functions, which in turn require1 knowing some theories)

The main idea is stressing the necessity of knowing the theory, and making it clear that as the project becomes more complicated (and as the project they make are at higher levels), the need to know the theory grows exponentially.

Another nice example is heuristic functions. Most students find these very difficult to learn and use, without in-depth learning of the theory behind it.

PS:
I used to be a student like the ones you described, and I went through 1 (self-reflection-ish) and 2 and I fully understood that theory is necessary.

1Well, maybe not require, but sure makes it easier and faster to write and debug.


Recommended IDE for teaching web development to beginners I have been assisting an IT teacher who has recently started teaching computer science to year 7-9s (11-13 year-olds). This year they will just be covering basic client-side web development: HTML, CSS and a bit of JavaScript.

I was shocked to see him, and the kids, writing their HTML in Notepad- it makes code a lot harder to read, and simple typos, such as a missing bracket, almost impossible to spot. Which isn't ideal, especially for beginners.

For my own coding, I always use InteliJ or WebStorm, however, I would worry that this might go in the opposite direction, and actually over-complicate things.

Anyone got any suggestions of a simple free IDE or text editor for web development for school kids? (It would need to be possible to install on school network).

I'm thinking maybe something simple like Notepad++, Sublime, or possibly Atom. But would love to here your feedback or suggestions on what might be good for school kids.

Thanks very much,
Alicia Sykes

I find that the best introductory IDE is a lack thereof because, for the most part, the features that an IDE offers (code completion, organization, etc.) are more hurt than help and tend to promote completely unrelated questions, for example, "What is this dropdown under the word I just typed" and other questions about IDE function rather than language functions. Generally IDEs are a distraction to beginners.

I would use a text editor with syntax highlighting such as sublime text, but nothing with too much many extra features. You certainly don't need a full fledged IDE.


How do I teach problem solving and logical thinking to students of age group 12-18yrs through online session I am currently researching some good content/problems to teach my students. I am referring to Mensa's Book on Logical thinking, which has a good amount of puzzles for all age groups. Is there any other site I should refer to? And what are your suggestions on teaching methodology through online session?

I would go back through old copies of GAMES magazine (libraries may have a stash somewhere).  They go the whole way back to something like 1977 and generally have lots of puzzles of various levels.  Apparently they merged together with another company back a couple of years ago.

https://gamesmagazine-online.com/product/vintage-games-packs/

In particular, I'm thinking of some puzzles where you are given a bunch of statements about a group of people and then have to derive all the information about them from logical inferences.  Generally, you'd have to lay out a diagram of some form and use that to either associate or block particular combinations until you figured everything out (much like sudoku but with logical constructions of words--this stuff predated sudoku by a long way).

As the teacher, you can "run the diagram" while the students can try to discuss the various implications of the statements.

Good luck.

(Edit: I just remembered a book I had a long time ago called "Puzzles for Pleasure" by E. R. Emmet--also a good source).


Introducing the MVC pattern along with JavaFX This year I am planning to shift from teaching Swing for graphics, to teaching JavaFX. As JavaFX ideally uses the MVC design pattern, I thought it would help students understand how to use JavaFX if they learnt about MVC.

While teaching the various controls, views and goodies in JavaFX is relatively trivial and straightforward, teaching MVC isn't so simple. So I am trying to intuitively explain MVC in the context of JavaFX.

What example applications in javaFX can I use to show them the MVC cycle?

That image explains what the cycle is, but students have difficulty in seeing how it works in practice in a javaFX application.

I'd use the following analogy connecting MVC to a teacher's gradebook.

In the context of MVC, the actual gradebook with a complete record of every student's grade on each assignment is your Model. Students may have their individual grade rendered in the View, but they would never have access to the entire database (for obvious reasons). A Controller, say in a school's learning management system, would select the appropriate grades to display to the specific student. A student could then choose only to render her quizzes or her homework assignments to focus on specifically those grades. In that instance a user action in the View, through say a dropdown, would modify what appears thanks to logic in the Controller.

As with all analogies, it is an imperfect comparison. However, this general concept will be something (nearly) all students are familiar with.

The iTunes U course on Developing iOS 10 Apps with Swift has a great lecture on MVC. The lecture video and slides are available here.

The image below from Apple also gives a succinct summary of the relationships among the three components.


Why some students think that programming is difficult and hard to learn, how I convince my students that programming is not difficult as they think? Some students think that programming courses are tough and hard. I personally know some teachers who say to their students that programming is not their cup of tea. How much percent this thing is true that learning programming is tough. According to me if people interested in this then nothing is difficult for them. How can I convince my students that programming is not as difficult as they think?

Careful! That's a pretty aggressive statement, and is liable to make folks who really do have trouble feel pretty bad about themselves.

You may want to take a look at this question. Whether you believe the answer to ultimately be yes or no, you will find that even the most adamantly "no" teachers admit to some number of students who have enormous difficulties

Interest is highly important, of course, but how your brain is wired matters a great deal as well. Don't discount real difficulties that people face. That's the kind of thing that causes people to beat themselves up mentally, when they're alone with their own thoughts.  Interest is important, but may not be sufficient, and dismissing the problems others face can be unkind.


Choosing Java-like language for teaching web development I just started teaching an introduction to web development to high school students (they have the most basic knowledge of java) and this year my school has decided to make a change in the curriculum.

Previously we used JSP to dynamically generate pages, but now we decided to look for a different technology to replace JSP.

So, I am looking for a language for dynamically generating webpages (again, a replacement for what JSP does: servlets in Java). Bearing in mind that they know a bit of java, it would be highly preferable to use a language that is similar to Java.

I am well aware that there might not be a Java like language for this (other than JSP), but the more the language is similar to Java, the better.

If they end up learning a new language (not necessarily one for dynamic webpage generation), all the better.

I would recommend:

Starting by teaching students just plain HTML, CSS, and perhaps JavaScript and focus on teaching the frontend first.
Once students are ready for the backend, switch to using a minimalist framework such as Spark. Have them first construct HTML using plain old string concatenation, make a big deal over how sucky that is, then switch to using a templating engine (any one will do, so it's probably best to pick one with the best documentation).

Teaching the front-end first does require you to make a "clean break" and switch away from Java, but I do think it's for the best for several reasons:

It's essential context for the students to have. Many backend tutorials will assume you already have a good understanding of the frontend, so it'll likely be more confusing if you don't start with the frontend.
Starting from the frontend lets students get instant gratification.
Starting from the frontend lets you move from simplicity to complexity: you start with static websites and gradually progress to something more complex (dynamic page generation, AJAX hijinkery, etc...).

I like using micro-frameworks such as Spark (for Java) or Flask (for Python) for teaching the backend. There's minimal ceremony, and micro-frameworks tend to closely mirror the HTTP request-response model, minimizing conceptual overhead. And since Spark is Java, you don't need to spend unnecessary time teaching a similar language.

In fact, there's even an argument to be made that the best thing to do is to ditch even micro-frameworks and start with just plain CGI or something: you literally manipulate strings, and that's it. Then, time permitting, you have students write their own framework/templating engine/what-have-you on top of that.

Basically, I view web development as one giant exercise in working with abstractions, and I feel one of the best ways to make students understand an abstraction is to have them build it from the ground-up/start without the abstraction. Web frameworks and trends come and go at a ludicrously fast pace, so I think it's particularly important in web development to focus on the fundamentals rather then trends. (You can see more about this philosophy here)

In particular, I like emphasizing that web frameworks are just complex ways of processing and sending strings: I think it helps demystify a lot of things, and gives students a concrete footing to help build their understanding of these abstractions.

(Tangent: you can work in all kinds of interesting CS topics depending on how much you want to commit to this "build everything yourself" model. For example, you can talk about compilers, parsers, and DSLs if you have students build their own templating engine; you can talk about NFAs, DFAs, regexes and such if you have students build their own regex engine to match routes... This is all probably overkill if your focus is just on teaching web development though.)


Why don't more universities teach revision control? In the answers to this question, it's suggested that one of the most common things that CS graduates still need to learn to be employable developers is revision control, and by inference that many CS graduates don't learn how to use it while at university.

This surprised me, because on my CS* course we started using revision control (git) on literally the first day of the course, and a lot of the work we did during our degrees would have been much more difficult without it.

Taking this claim at face value, if knowledge of revision control is both a) useful during the degree and b) desirable afterwards, why don't more universities teach students to use it?

I understand that this could be seen as primarily opinion based so, if possible, I'd be particularly interested to see actual reasons given by the institutions themselves or people who teach CS (particularly software engineering) courses.

*I should clarify that my course was in actuality a Computing degree (BEng) and so contained more practical components than others may do.

I suspect it's a combination of several factors:

Version control isn't that challenging to learn (assuming you know how to use the command line). It's something you can trivially understand by following a few tutorials online -- I'd argue the hardest part is actually finding the right tutorial (there are tons of garbage "how to use Git" tutorials out there, and surprisingly few good ones, for example).
Despite that, it can be hard to find time to fit in the command line and git. You'll probably need to spend at least 30 minutes talking about both things, and if you have a lot of material you need to cover, it can be hard to squeeze that in without compromising on something else.

In particular, it's worth noting that you can't necessarily just add in new material somewhere and shift everything over. You need to make sure your change maintains the overall tempo of the course, make sure no topic "overlaps" oddly over a  weekend or a holiday, need to make sure students are still being taught the material they need a sufficient amount of time before you make related HW due... If the original course was competently designed, it's probably a well-tuned engine where every minute matters, so adjusting it will require some degree of effort.
If your university didn't find time to squeeze in version control, you'll be told to learn it on at least day 1 of your first internship or job.

(And they'll probably do a better job of teaching it! It's hard to teach the value of things/give students the opportunity to practice things like branching, rebasing (if you're using git), using specific workflows, etc. in a university setting -- those sorts of more advanced operations are really only useful in larger teams working on a long-term project.)
You mentioned that your intro course covered git on day 1. I can see an instructor considering against that approach if they want to prioritize moving to programming as soon as possible to try and "hook" the students in with instant gratification. (If you're completing new to programming, I can imagine learning to use tools like version control would be relatively dull and sort of a bother -- you don't really get to see the payoff until you start tackling more complex projects later on.)

So basically, it's material that's difficult to fully cover (where the subset you can cover is easy to learn yet still takes up an awkward amount of time), and that the student is going inevitably run into and learn without any real difficulty anyways.

None of the issues I pointed out are insurmountable, of course, but if you toss in inertia into the mix, you can see why some schools would never get around to rejiggering their curriculum to fit version control in.

I personally think it's worth teaching version control anyways (I'll go even further, actually -- I think schools that don't teach version control in some capacity are doing their students a major disservice), but can't deny that it can sometimes be logistically challenging to work that material in.