What are some fun projects for non-CS majors? I'm teaching an undergrad Intro to Programming for Non-majors this semester (in Python) and I'm looking for some fun projects for my students that are engaging but not too difficult for them. This is my first go around with this course.
I've looked at their majors to see if I could come up with projects that might relate to it, but that didn't spark any ideas.
Maybe some games, like Tic-Tac-Toe? Does anyone have suggestions that have worked well for them?
Update: These are typical undergrad students at a US university, so about 18 - 22 year olds, with no programming background. The main focus is on imperative rather than OOP. In the past I haven't found an easy way to introduce graphics with Python or GUIs, but perhaps there's some nice stuff out there now. I don't think Turtle graphics would hold their attention very much or very long, also seems more age appropriate to younger students I believe.

Another fun game is "Spelling Bee" from the New York Times
(https://www.nytimes.com/puzzles/spelling-bee). You supply a file containing words. The student program reads the file and selects words that match the rules. The milestones are from a past project from Reed College.

Print all the words that can be spelled using a fixed string (e.g. "AZDIRWY"). The first letter is the required letter.
Prompt the user for a string and print a list of words or take the string as a command line parameter.
Generate a score for each word and the total score.
Generate the graphics to draw the string as it appears in the paper (six hexagons containing optional letters surrounding a central hexagon with the required letter), along with the list of words.

You could potentially go a slightly different direction and let the python program generate HTML output and view the results in a browser. This illustrates dynamically generated HTML.
Another variation would be to preprocess a "dictionary", removing all words that are too short or contain more that seven distinct characters. Then create multiple files, one for each possible beginning letter. You now have cut down the search space. You might also have the students sort the answers, perhaps by word score.


Counter-Example for Computability I am a retired college teacher, now trying to teach computing to middle school kids.  One of the parts of the definition of "algorithm" is that it must be "effectively computable."  I'm looking for an example that is not Turing computable.  I've used "solve world hunger" in the past, but but that seems fuzzy and amorphous.

Today I've spent some time with "Label an arbitrary statement as true or false," but I can't make it sing in a way that kids will say, "Yeah... that's right."  Busy Beaver and the halting problem are both too complicated to explain in a few minutes.  (I know about Scooping the Loop Snooper and have even assigned it as reading, but it would still take too much classroom time.)

Suggestions, either of new ideas or of a way to make "Label an arbitrary statement..." sing to the students would be most appreciated.

Strachey's proof for the Halting Problem is accessible to anyone who accepts reasoning by contradiction.

See
https://academic.oup.com/comjnl/article/7/4/313/354243


While giving an introduction to the Internet, should I talk about the risks? Privacy is a very big issue in the present world. People unknowingly share personal information and pictures on social media and have to face many issues. Nowadays even 14 to 15-year-old people have social media accounts. They tend not to be aware of the privacy threats (mainly for girls).

While giving an introduction to the Internet, should I give them a quick brief about the privacy too or should I give it later?

My personal opinion is to give it in the first time, but I am not sure what an expert would advise.

Yes.  You should absolutely identify the specific risks of each technology or tool that you are going to teach and discuss those risks before you assign students to use those technologies or tools.

The exact form of these warnings depends on what exactly you are introducing and the age of the students.  This is also a decision that should be made in the context of a school-wide policy on information technology.

If you're teaching TCP/IP to college freshmen, there's obviously no reason to go off on a tangent about the dangers of sexting.  If you're teaching sixth graders how to use your school's library databases, it's probably not appropriate for you to bring up many of the dangers of the internet.  So of course keep the warnings relevant and age-appropriate.

But if you're assigning students to create a class blog, you should give them instruction about not putting certain personal details on it, about dealing with spam, about creating and protecting a secure password.  If you're using a social media group (like a facebook group for the class) you should remind students about school policies that apply to the group (about swearing, offensive materials, cyber-bullying, cheating).  If you're teaching php development for a database app, you should warn students about SQL injection attacks and other common security risks.

Keep in mind that it's unlikely that you'll encounter students who haven't already used the internet.  My son is four and he's a big fan of YouTube already.  So remember that you aren't really introducing "the internet" - you're introducing a specific tool or technology.  Your obligation is to teach the risks of that technology.


This question is for anyone who has read Introduction to Algorithms by MIT press 3rd edition - Exercises, how to make them easier? I'm a student at a liberal arts college who has recently been taking classes at a tech school due to our schools cross-exchange program.

I did not do well last semester, so I have spent the summer educating myself. I learned C by doing all of the exercises in the previous book I read.

Now I'm doing something that a professor told me to do in a tech school, study algorithms in C. So, I bought a textbook Algorithms in C. But this textbook is asking me questions about algorithms I don't fully grasp how to answer, so I cracked open Intro to Algorithms 3rd edition and resolved to get through Chapter 3 at least so I know how to analyze algorithms properly.

Here is the thing, I have been reading textbooks all summer, this is the third book I have gotten to, and it's difficult. It's difficult because, I don't understand how to problem solve the questions in the book until I get to the answer key on the internet.

This isn't good, and I need a method or a way of seeing this properly. Without the online answers guide, I would have never solved most of the questions in chapter 1 and 2. I understand them now, but I'd rather be able to get through them on my own.

Another question: Is it important to do every exercise in this book?

While it isn't necessary to do every exercise in a book, it is important to be able to do every exercise in the book.

Similarly, while it isn't necessary to write every algorithm, it is necessary to be able to write every algorithm.

But learning is another issue. Reading alone isn't enough to learn something. I think you already understand that. You need practice with what you've read to make sure that you have a deep and long lasting understanding of the topic. So, as you've already discovered, you need to do a lot of well chosen exercises.

But even that isn't enough.

You need feedback on your attempts. You need someone to look at your work and tell you where you have done the right thing and where you need improvement.

Reinforcement and feedback are the key to learning.

I'm not sure where you will be able to find this feedback. That is the real value of taking courses - the feedback is built in. Unfortunately not every course gives enough feedback, of course. If it is just grades, it isn't enough. You need it pointed out where and why something didn't work so that you don't build bad habits. (Reinforcement without feedback can be counterproductive).

Perhaps there is a professor who would be willing to look at your work. Perhaps you have another more advanced student available. Some people create study groups to give feedback to each other. Even an online "buddy" who can evaluate what you've tried.

And note, also, that having the answers available isn't really sufficient feedback until you learn how to find the misconceptions that led you to the wrong answer. It is little misconceptions that can throw you off and someone giving good feedback can help you get the insight to avoid them.

Find someone.

As for making it easier, only reinforcement, feedback, and time will do that.


Projecting the In- class demo screen I want to do an in-class demo for students.
I am wondering if there's a way I can project my code editor for students to see, and still have a document with written code (like a cheat sheet) which only I can see.

Please suggest how this might this be done

Assuming you have a standard projector, here are two ways that I do this:

A printout.  Nothing like going old-school and having physical paper in front of you.  Your students can't see what you've got written down. As a side benefit, you can comment in notes about things to say.  Want to code in some errors and then fix them to make a point? It's easy to document a process this way.
Set your laptop to use dual-monitors, and use the primary as your laptop screen. And the secondary as your projector screen.  A side benefit here is that the text doesn't get as difficult to read on the projected screen.  A challenge is potentially having to turn your head when typing.


Testing students on recursion - tracing by hand After learning recursion in class, students take a test (a few lessons for teaching the subject, and then a test), and are then given a grade. The test is on paper, and I can't change that fact.
All tests are written on paper, but the questions on the test are subject to changes, and those are the changes being asked about.

These students are in a CS major in High School.

Besides asking them to write recursive functions for a variety of purposes (tree traversal\search etc.), their knowledge is also tested by asking them to trace by hand (on paper, without a computer) a given recursive function (usually one that does string manipulations).

For example:

public static int permutation(String prefix, String str){
    int n = str.length();
    if (n == 0) {
        System.out.println(prefix);
        return 1;
    }
    else {
        int sum=0;
        for (int i = 0; i < n; i++)
            sum+=permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n));
        return sum;
    }
}

and it is called in some main:

public static void main(String[] args) {
    System.out.println(permutation("", "abcde"));
}

This is an example for how their tracing should look like (this image is not related to the permutation example above, but it serves to explain how they trace the recursion)

They essentially trace the call stack (and they know this; they know that effectively that's what they are doing).

However, I have some doubts about this method of testing (specifically the tracing).

So, would testing students like this be useful? By that I mean: does it actually indicate understanding of recursion and\or increase their ability to understand recursive functions they see?

If not, then how else can their knowledge of recursion be tested in a written test?

The tests are given because that's how the students are taught:

They study a subject (in this case, recursion)
they are tested on that subject.

There's no bigger goal, no project that they use it in (yet). They learn it because it's part of the curriculum.

Clarification

My question isn't about teaching recursion, nor is it about the specific example I gave. It's about whether the described test method (on an exam) would actually be able to test the students' knowledge about recursion.

No

This may be a good way to test understanding of function calls, and the stack. However I don't think it helps much with recursion. As when we design we need to abstract. To do this we need to be able to think without having to keep all of the detail in our heads. We need to focus only on externally visible behaviour, not internal details.

Yes

Having said that. I think it could be useful to look at the stack, if we are considering the consequences of different algorithms, and recursion patterns.

For example both of your examples, the recursion only reduces by one. Therefore the recursion depth is O(n). If you do not have tail-call optimisation then this could lead to a stack-overflow.

Nether of you examples would allow for tail-call optimisation:

The first is not linearly-recursive, but as long as the input data is small, would not be a problem.
The 2nd, has all of the complexity in the return path, and in practice n could be very high. This would be a problem. This example could be rewritten to allow for tail-call optimisation.

Note: Java, C#, Python … do not have tail call optimisation (I heard Java may now have it for direct recursion). C, and C++ may have it (gcc does). Scheme and all functional languages do have it. If your language does not have it. Then a tail-call recursive function can be re-written using the trampoline pattern.


Order to Teach Topics in an Intro Programming Class This is a question for those of you who have an intro class before AP Computer Science (or maybe even just an intro class). What order do you teach the topics in your intro class? I start with if statements, then go in the following order:

While Loops
Variables (I do some hand-waving with variables before this point)
For Loops
Arrays
OOP

I used to start with variables a few years ago, but students seemed to have trouble getting the concept that early in the course. I'm not sure if I should go back to that now that I have more teaching experience and have a better idea of how to teach variables.

I think this depends entirely on the programming language you use. Or maybe more accurately, you should choose a language that allows you to introduce the concepts in the order you want.

I would use a language called Processing, which is built on top of Java and allows you to create visual, animated programs without any boilerplate code.

I'd start with calling functions. Here's an entire Processing program:

ellipse(20, 30, 40, 50);

This program shows a window and draws a 40x50 oval at coordinates 20,30. There are other functions in Processing. Have the students draw a basic scene.

Then I'd talk about using variables. Processing has a few predefined variables that come in handy:

size(500, 500);
ellipse(width/2, height/2, 200, 200);

This program creates a 500x500 window and shows a circle in the middle of it. Have the students modify their scenes so they stretch to fit the screen, using the width and height variables.

Then I'd talk about creating variables. Have students create their own variables that allow them to move their scene around, or easily change the color, etc.

Then comes creating functions. Here's an example program:

void setup(){
   size(500, 500);
}

void draw(){
   ellipse(mouseX, mouseY, 25, 25);
}

This program shows a window that draws a circle wherever the mouse is, 60 times per second.

Hopefully this gives you an idea of Processing and the general approach. From here I'd cover these topics:

Debugging
If Statements
Animation
For Loops
Arrays
User Input
Using Objects
Creating Classes
ArrayLists
Images
Libraries
Deploying your code

Shameless self-promotion: I've put together a series of tutorials that cover all of these topics, available at HappyCoding.io. I'd be happy to help adapt these tutorials into an introductory curriculum.


Research question thesis I am now in high school and have to do research. But I am not sure which research question to choose. I would like to talk about programming languages and therefore something within computer science. Can someone give me some examples of research questions where you don't need a lot of prior knowledge? Thank you very much in advance.

Rather than try to give you an answer directly, let me direct you to a web site that is full of ideas, not for research, but for how programming and programmers can affect things. Paul Graham is a computer scientist, mostly associated with the Lisp family of languages and has done some very interesting things with Common Lisp.

But his essays are just ideas that are interesting, if nothing else. Reading them is likely to give you ideas as well.

Poking around in them might give you some ideas. But, you might also want to think about not making your research too narrow. Not just programming or programming languages, or even just CS, but how it all relates to the wider world and the other things you've been studying.


What are the essential ideas that students need to know about Artificial Intelligence? I am my school's new AI Program Architect and I also serve on the national AI4K12.org working group that is writing K12 AI Standards. I would love to ensure that we are broadly including CS educators and their ideas in writing programs and curricula that encompass the field of AI for K-12.

What AI resources do you use in your class?
What are the essential ideas that students need to know?
What should students be able to do at the end of class?
If you incorporate AI in cross-disciplinary courses, please share those ideas as well.

Computers are stupid
Do some role playing.
Have students describe how to draw a house, they can not use house words, just geometry words: line, square, triangle, etc.
Get one volunteer to  take a pen to the white board, they don't know what is being described, and follow instructions (I normally take on this role first. I do what they say, but not what the mean).
Dangers of AI
The evil, or not so evil overlords: AI does what it was asked to do. AI algorithms but us into silos, make us vote for trump and brexit, advertise to us, etc.


Making Technical Presentations Safe for Novices One useful skill in CS is presentation of technical material to peers and/or superiors. Novices, however, often come to computing as introverts for whom public speaking is difficult and even frightening. I want my students to become better speakers, especially in presenting their own work since it is often the loudest speaker who is heard, not necessarily the one with the best ideas.

How do we make a safe and comfortable environment for novices to learn to present their work to their classmates?

One of the aspects of this, of course, is to learn to accept feedback from the listeners and to evaluate it properly.

In a class of novices this may also require some training of the listeners so that they offer constructive advice and not just negative comments. It may also require finding ways to quiet those who offer inappropriate feedback, but to also teach them better behavior.

The goal is to give the students practice so that they become more comfortable with doing this.

You need to start early
You can not expect them to just one day, stand up in front of the class. You need to prepare them for it.
Encourage mistakes
Encourage students to take risks. Give permission to make mistakes, but not just permission, make it a goal.
At the start of term, when I set out the class rules. I have a few don'ts. I also have some dos: collaborate, work hard, make mistakes …
I tell them that computer programming (and learning) is about making mistakes. In a one hour lesson, if you only make 100 mistakes, then you are not working hard enough.
Get them making mistakes, get  them celebrating mistakes.
One way to celebrate errors, is «test first»: Write test; run test, test fails, celebrate; write code; run test, test passes (maybe); repeat.
Austin's butterfly
So how Austin improved his drawing: He got feedback from the class after each drawing, and used this feedback to make a better drawing. It took six attempts before he drew the final image.

Mind set
Teach them about mind set — Carol Dweck “Whether you believe that you can do it, or believe that you can not, you are correct.”
People with a growth mindset

believe that mistakes are an indication that they are learning.
believe that they are in top set because they work hard.
like challenge.
learn more.

People with a fixed mindset

believe that mistakes are an indication that they are stupid.
believe that they are in bottom set because they are stupid.
like easy work, that they can get correct. Or very hard work that gives them an excuse.
learn less.

Get them helping out with the class.
Build a culture of helping / talking-to each other.

Peer help
help desk
answering class questions
explain to the class


Motivation for learning C++ when you know Java I am going to teach a C++ course to students who already know Java. From  answers to my previous question, I learned that C++ is substantially harder to master than Java, particularly because of the need to manually manage memory allocation. Thus, I expect my students to ask:

  Why do we need to study C++ at all? Why not use only Java?

Two general answers are:

Because C++ is faster (but I am not sure the difference is substantial enough)
Because C++ is already used in many companies where you might work in the future.

But I am looking for a more convincing answer. In particular:

In what kind of applications is C++ considered a better choice than Java?
In what parts of the software industry is C++ used more than Java?

I think you're having trouble justifying the study of C++ because of the way that you're thinking about it.  If you are aiming towards the practical benefits, then you immediately get to the following trap: neither you nor your students has any idea what languages they will work with in the future, so neither you nor your students have any idea what languages would be the most practical to learn.  There are no good answers when you begin this way, and the motivations will always seem to fall a bit flat.

I might steer the students (and you!) towards a slightly different model of thinking about benefits here.  What foundational ideas about programming and Computer Science are easier to grasp in C++ than in Java?  These foundational ideas will important later, regardless of the development environment, because they are the building blocks of computational thinking.

When we teach CS, we are concept-focused and language agnostic.

This lens also provides you with the beginnings of a map through the topic itself.  You can quickly sketch out a curriculum at this point, which is best done backwards:

What are the most important concepts that you want the students to learn?

Fair warning: I am not a C++ programmer!  There may well be more important topics than these to get into, but I know that C++ gives students an opportunity to learn about pointers, pointer arithmetic, and memory management.  You could also get into casting and bit-operations, which forces the students to learn about data representation.  Each of these concepts are fundamental to computers, and much harder to learn about in Java, which abstracts them away.

Selling the language to the students is now a comparatively easier task.  You're using C++ because you get to show them some very cool things about how computers really work.

The best time to do such selling is on the first day.  By explaining #1 to them at the beginning, you alter their motivation going forward.  They want to do well on the tasks you've outlined not only because it gets them a better grade, but because they are also mastering deep, important concepts that will help them understand computational thinking.  Computational thinking will help them regardless of what they do in the future.  Heck, they could leave the field entirely; they would still have mastered a rich and powerful tool-set for thinking about problems, wherever they go.

Now we get to the planning portion:

What is the most logical ordering of those concepts?
How will you (and the students!) know that the concepts have been learned?  This could be some combination of projects and assessments.

I've grouped these together because they are a little interdependent. Sometimes step 3 will cause you to go back and modify the order in step 2, but these two steps are how you arrive at a well-organized semester.  The best tasks for #3 are also rich and interesting in their own right.  (One resource I could recommend for help finding great, motivating tasks for a given concept is this very site.)

It is extremely important that you really get a good answer for #3.  If you've done these three steps well, then the projects and assessments will now be sufficient to prove that the students understand the material.  If you've truly answered #3, and you have total trust in that, then it frees you up to spend the entire course doing one thing:

Prepare your students to do really well on those tasks.

The reason that #4 is so important is because of the social dynamic that results. You really want your students to feel like you're on their side, pulling for the same team. And if your goal, every day, is to help them master the material, then they will be able to see that you are putting tremendous effort into trying to help them.  And there are also benefits to you here; as a relatively beginner teacher (who will certainly make some mistakes along the way!), having students who are willing to cut you a little slack can make your life a lot easier as well.

Now we have a strong course structure!  Tell the students about the cool concepts they will be learning, and tell them that C++ is a great language to focus in on these concepts.  Map out the order of the concepts that you'll be covering and tell them about the projects, tests, etc.  Then come in every day, and focus in a rather laser-like way on making sure that the students are well prepared for the important tasks that you've designed.

(Apologies for the length of this response.  I wasn't trying to write a book chapter, but I am leaving the information in in the hopes that you will find it very helpful!)


What is a good way to explain computer viruses? As part of my class, pupils have to learn what a virus is.

I am looking for a better way to explain viruses or a better metaphor than the biological virus. The problem with a biological virus as a metaphor is that if we follow it to its logical conclusion, then if there is even the slightest problem in the metaphor, it will interfere with students reasoning down the line, which could lead to false conclusions and confusion.

When I was at university in (1991), we were told some simple rules for the computer lab:

No drinking or eating in the lab.
Don't hit the computers, poke anything into them, or try to take them apart.
Don't switch them off (someone else may be using it).
Don't worry, if you tell it to do something and it breaks then it is our fault not yours. Our job is to keep them from breaking, we do this by using good quality software. These is security to stop you from breaking it for any one else. If you break it for you, then come and see us, and we will fix it. If you break the security, and we encourage you to try, then do not do anything malicious as this is immoral and criminal, just come and see us and tell us, so we can fix the software bug, and give you your prize.

We are now telling students that they can easily break the computer by clicking the wrong button. This includes infecting a computer with a virus.

I am not happy with the normal descriptions of a virus, as these put all of the blame onto the virus writers, and all of the responsibility onto the user/children.

Some descriptions that I have seen.

“each requiring a different cure”
Why? There are thousands of viruses, but only a small number of vulnerabilities. Viruses take advantage of vulnerabilities. Would it not be easier to fix the vulnerabilities.
“prevention better than cure” (true). But goes on about how a virus scanner can check programs before you run them. This is putting the blame on to the viruses, and the responsibility on to the children.

A better description?

Does anyone have a better way to describe a virus. How can we link it to real life; what the pupils already know.

Viruses, worms and other malware are actually just like physical infections in enough ways that I still think metaphors are the best way to educate from a basic level. Even the average home user knows that a virus scanner stops a large number of infections from ruining their PC.

The challenge comes with explaining why virus scanners are so limited - most up until now only catch what they know about. So I like to use the following:

Malware is written to control your PC or to steal your login information for online banking etc.
Your virus scanner will protect from tens of thousands of pieces of malicious software that it knows about.
Behavioural analysis tools will pick up more malware, based on what it appears to do.

But because code is written by humans, there will always be vulnerabilities, and because there are criminals, there will always be malware that will get past these, and this is why layers of security are essential. These include:

User awareness (don't visit dodgy sites, don't click on suspect emails etc)
Secure architecture (secure by design)
Extensive monitoring and logging
Understanding the threat environment
etc.


Popular demonstration of cryptographic tools I'm looking for an activity for highschoolers/college-freshmen that will demonstrate crypto topics (e.g., encryption, signatures, zero-knowledge), and will be fun and motivating. It is supposed consist of small tasks that the audience can do by themselves (=no complicated math).

I vaguely remember seeing a website with suggestions for such activities, but I cannot find any information now. Any suggestions / ideas?

There are some engaging lessons on encryption in Unit 4 of the AP Computer Science Principles curriculum from Code.org.  Lessons 5, 6 & 7 take students from the concept of encryption using a caesar cypher, to a vigenere cypher, and then through the concepts of public key encryption.  Students usually have fun with the widgets that interactively demonstrate the caesar cypher (https://studio.code.org/s/csp4/stage/5/puzzle/2 ) and vigenere cypher (https://studio.code.org/s/csp4/stage/6/puzzle/2 ).  There are lesson plans with student worksheets and videos that support and extend the ideas the students are exposed to when they play with the widgets (https://curriculum.code.org/csp/unit4/ ). The materials are free to access.


Is it possible to teach selection (`if`) before variables I was looking at the CAS progression pathways, and noticed that in column 2 (Programming and development), it has selection (if) before variables.

https://community.computingatschool.org.uk/resources/1692/single

I realise (from talking to the author), that the colour bands and the arrows were added with protect, and should be ignored. They were added for an era that was obsessed with levels, the day before levels were abolished (for key-stages 0-3).

As a lot of teachers still teach in the order that is in this document, I was wondering: Is it possible to teach selection (if) before variables.

I am asking this, as I am creating a dependency graph, so that I know what has to be taught before what.

When I teach Python, I teach both much later, after iteration, procedures, and functions.

From a practical standpoint, rather than a theoretical one, there are at least two pedagogically defensible ways to do this. Spiral curriculum, and Scaffolding

Use a Spiral Approach

I won't assume that you never mention variables early with this approach, but you just don't teach all that needs to be known at the first introduction of variables (or any other topic). To teach like this you mention things that need to be known deeply early on, partly to introduce terminology, but partly to permit simple uses in which deep knowledge isn't needed. Then, for example, variables but without reassignment could be used in setting up some sort of selection or iteration as your lecture focuses on those ideas rather than the variables. At any given point in time students know a little about a few things and a lot about some other things. Then, in the next cycle you go a bit deeper in some topics but also introduce, very lightly, other topics.

The implication is that a student never needs to completely understand any given topic the first time it is presented as it will be seen again. Everything is reviewed constantly in such a course.

For purposes of this particular question, a variable could be initialized somehow and then used within a selection structure. The student need only have the idea that the variable refers to a value and can be thought of as a temporary name for that value.

Teaching a course in a spiral way requires some pre-planning, of course. It isn't enough to put each important topic into the syllabus only once. Neither is it enough to expect that every student will get a lot out of the first introduction and you don't, therefore, need to obsess that everyone is on the same page before moving to the next topic.

Use Scaffolding

An independent way of teaching is to have students first programming experiences done within a pre-defined richly endowed virtual world. The world is constructed so that interesting things can be done early without necessarily building up everything from the beginning. Often these world are simulations. For example, in Karel the Robot and its successors, programs consist first of writing sequences of statements to direct an existing robot. The robot's capabilities are built in and the student simply invokes existing functions/methods to achieve some complex effect. Next the student learns to write methods or functions as just abstractions over some sequence of such pre-build actions and other actions already built by the student. In this way it is functional abstraction that is the first real topic of importance. You can introduce variables or not, and you will certainly do so when you want several robots acting together. But these variables are just object references and little needs to be known about them, including whether they can be reassigned or not. Selection is certainly a reasonable topic in such a world, as is iteration, polymorphism, recursion, or whatever you need to teach.

However, careful thought needs to be given to the characteristics of the simulation world. How rich is the environment. It can be simple, for example, and still be Turing Complete.

Some teachers might choose this path with a single simulated virtual world, and others might choose to use several worlds of increasing sophistication and, perhaps, increasing complexity. I'll note that Greenfoot was built precisely to provide an environment in which such simulations and virtual worlds would be easy to build.

Both of these techniques are very powerful and have been used by many instructors over a long period of time. Of course, they may be combined to good effect.


What are the tradeoffs of allowing students to submit test corrections? Do you allow students to submit "test corrections"?  Meaning, do you allow them to take the questions they missed on a test, denote the correct answer in some way, and give them partial or full credit back if they then get the answer right?

If so, why?  If not, why not?

I'm wondering, because I have a colleague who has ALWAYS allowed test corrections in her CS courses for half credit.  I NEVER have.  But this year, for some reason, I am getting a lot of lip from students like "What! No test corrections?!  But Ms. Xxx always let us do test corrections!"

I believe allowing test corrections (which is essentially a retake) does a disservice to the student because it allows them to be lazy.  They don't do it right the first time. They don't study (or don't study as much as they should have) and depend upon "corrections" to make up for their laziness.

My colleague believes allowing test corrections at least forces the student to "discover" correct answers to questions they may have never revisited otherwise, and that therefore they have another opportunity to learn.

Am I being too hard?  What do you think?

Our district has a policy that any student that scores under a 70% must be allowed to retest. You take the retest score, average it with the original, and cap it at 70%.

Catch is that I teach all AP / Honors classes. Typically these aren't students that score a 60% and want to bring their grade up to passing. They're the kind of student that gets 88% and is unhappy they didn't score an A.

I go beyond that and let anyone who wants to do test corrections instead of a retest and they'll get half their points back. We have another AP teacher that does a square root curve if they turn in corrections.

To get credit they turn in a document with a screenshot of the question (tests are all in Canvas), explain why they picked the answer they did (sometimes "I guessed" is okay), what the right answer is, and most importantly why it's the right answer.

3 reasons why I do corrections.

1 - It lets me throw a few harder questions into a test. I start putting in AP style questions early in the year, which students may not be used to. As the year progresses more and more AP style questions get put in. If the longer questions go in, especially early in the year, the tests might be a little too difficult.

2 - I don't really care what they know Tuesday at 10:30. I care what they know when they leave my class at the end of the year. If they can come back after a test and prove they know the material, that's much better than just leaving it unknown.

3 - Everybody has a bad day. Maybe their dog died last night and they're not in a good mindset to take a test.

With all that though, I'd rather do retests. Still for half credit. The problem I'm facing with that is I'd essentially need at least one more full test for every unit. Otherwise they're retaking the same test. What I'd really like is to have enough questions banked that students could take a retest 2 or 3 times and I'd average everything together. But that would take hundreds of questions for each unit.


Uses of selection in programming (if, switch etc) I am an experienced programmer that has just started teaching. I am struggling to see how to introduce selection to my programming classes. None of the examples that I have seen so far are good.

I am struggling to find examples other than the ones below. (These are more advanced than I need.)

Termination condition for recursion (We don't do recursion until upper years of school, exams do not need it).
Input validation (Again the exams say don't worry about checking input (I think this is a mistake, as it leads to cowboy programmers)).

Both of these are only in the syllabus from UK year 12. I am teaching from UK year 7.

Can you help with good examples, and exercises that my younger pupils can use?

year 7 is age 11-12
year 12 is age 16-17

There are endless examples that illustrate selection. As you know, most useful programs have at least one selection statement. I've found that some students struggle with the concept, so I start small and pick examples that resonate with students, for example:

    if (hungry)
        System.out.println("Eat a sandwich.");

    if (age > 17)
        System.out.println("You can vote.");
    else
        System.out.println("You cannot vote.");

For a switch statement, I like to show some type of menu:

    switch(choice) {
    case 0:
        System.out.println("Balance Inquiry.");
        break;
    case 1:
        System.out.println("Transfer");
        break;
    case 2:
        System.out.println("Withdrawal");
        break;
    case 3:
        System.out.println("Deposit");
        break;
    default:
        System.out.println("Quit");
        break;
    }


What are good models for a Tutorial System for lagging CS students? Some students find themselves falling behind in a course but still have the desire to do well. Some colleges provide a definite system of tutors in which such students can get additional help. What are good models, in your experience, for such systems?

Some questions you might want to answer in giving a model are

Are the tutors other students or professionals?
How are the tutors selected?
Are tutors or sessions supervised formally in any way?
Are tutors paid? If so in what way? (money, academic credit, ...)
What are the scheduling issues? What works and what does not?
Are the tutors and tutees matched with each other in any specific way?
Is tutoring one-one or one-many, generally?
Does the student need a "ticket" to join, say a recommendation from a prof?
Can you get any measure of success?
How do the tutors benefit other than formal pay?

What models have you seen or been part of that might be used elsewhere?

When I started my last job, there were many problems with the CS "tutors" at the CC and university I worked at:

Tutors actually didn't know the content that well themselves.
Tutors "explained" a lot, and used the sessions as hangout time with other buddies, or as a sort of show-off time.
Attendance at tutoring sessions was (unsurprisingly) low.

If no one knows the content, no one knows how to teach the content, and no one is welcoming to new students, what can you do?? I opted for a fairly time-intensive solution because it fit within my role, but others may benefit from at least parts of this model.

I started a Peer-Led Team Learning program, with training in

CS content
CS pedagogical techniques
supportive culture

PLTL Leaders didn't just hold tutoring hours. They also led weekly PLTL sessions where they helped students learn CS in a structured setting. This provided a way for students to meet the Leaders, and a context that ensured the students learned something and that the Leaders were trained. PLTL leaders also helped out in the classroom.

PLTL is a proven model with a handbook, a research tradition, and support. I had to make my own exercises for CS1 / CS2, but the model for how to run a PLTL program is already well-established---simply follow the handbook. PLTL emphasizes collaborative work (usually on paper), and Leaders prompt and direct students, but do not give away the answers.

Being a PLTL leader was advertised as a high-status position, a leader in both content knowledge and professionalism. I was inspired by Section Leader programs at many universities. PLTL Leaders were paid hourly. At the university, I was able to set up a system of interviews to hire new PLTL leaders--this gave another level of professionalism, and also gave students much needed practice in whiteboarding and interviewing, even if they didn't get the job.

Weekly trainings bootstrapped the tutors' content and pedagogical knowledge. We worked through the packet of problems for that week's PLTL session ahead of time as a group. This ensured that everyone knew the content, and also knew how to prompt students to solve the problems. We practiced pedagogical techniques like tracing code, drawing memory diagrams, and prompting students to collaborate. We typically spent 30 minutes talking about issues like making sure students didn't feel afraid of looking stupid or asking questions.

This model does require buy-in from instructors to motivate PLTL attendance. Some CS1/CS2 teachers made PLTL attendance mandatory, others offered extra credit. In an ideal world, the CS1 / CS2 teachers would write the PLTL materials and help run the program, but it fell on me in my setting.

Over time, student coordinators took over running the training sessions. Once problem sets were developed, they were re-used.

Starting this program was one of the highlights of my job. I'm happy to say that these students did become a strong part of the department's culture over the 2.5 years I ran the program, raising the bar for what professors thought their students could be capable of. Many of those students now have great jobs in industry. I miss 'em :')


The Tao of TeaChing (Making Mistakes in Front of the Class) How do you handle it when you make a mistake while teaching? I used to get confused, stammer, blush, etc. But now I just pause and notice that something is incorrect, then correct it if I can figure it out, or say that I will get back to it.

In one of my questions on this site, I said that I taught something wrongly and a student raised a question about it. I stopped and said I would sort it out, but didn't try then to correct it because I wasn't sure why I had made the mistake. The students have a very limited capacity to handle ambiguous or conflicting info while they are learning new things, so I usually try to say only what is essential at the moment. Dijkstra wrote about "the limited size of our skulls" and I mention that frequently.

My skull is definitely limited, and I forget more than I know at any given moment. So every year I need to refresh my memory of details. That is why if something doesn't work or I can't recall something then I demonstrate how to find it again or figure it out. Every year the software changes, the textbook is different, I am using different teaching notes or web sites, and on and on, so I am never completely on top of what is about to be shown in class. I used to reprimand myself, try to prepare better, make more notes, try out all the examples first and so on, but really, the workplace (to which they are going) is not a rehearsal, so I am "modeling what I am teaching". Maybe I come off as a 'cowboy' sometimes, but I enjoy teaching a lot more than I used to!

  "I am a man foolish in heart, dull and confused.
  Other men are full of light; I alone seem to be in darkness.
  Other men are alert; I alone am listless.
  I am unsettled as the ocean, drifting as though I had no stopping-place.
  All men have their usefulness; I alone am stupid and clownish."
  -- The Tao Te Ching of Lao Tzu

What I really enjoy is figuring out why I made the mistake and saying that, not to pass blame or even blame myself, but because understanding is what matters. How do you, by example, teach your students to "learn from others mistakes, because you haven't got time to make them all yourself"?

If I catch it quickly and can easily explain the error, I use it as an example of failing up. "Ooops, look at me, here's my mistake, here's how I can learn from it."

If students catch it, and I'm not immediately sure who is right, I make a note to do some research and come back to it in the next class.

If I don't realize it until class is over, I make sure to correct it the next day so that I don't reinforce a misconception.


What could be the possible advantages of teaching Scheme as first programming language? When I started my Computer Science studies, Scheme was the first thing we learned in our first programming course. Almost 8 years later, I ask a friend of mine, and it seems that they are still teaching Scheme for beginners. Besides the annoying amount of parenthesis, I found Scheme helpful, and I was able to understand important concepts as how interpreted languages work, anonymous functions, recursion and so on.

My question comes, because, except for that semester, I have never used Scheme again, and even though it was helpful I have always thought why not teach another real world use language.

Wouldn't, for example, Python help in the same way? Why Scheme?

I think that the purpose of such a course is not to teach you a language. After all, Scheme, with its abstract syntax, is pretty minimal as a language. The purpose of a course like that is to teach you to think abstractly. If you can do that now, several years later, you can probably thank the course for getting you started. Abstraction, after all, is the big idea about computer languages.

A course in Python or another language can do similar things, but not in quite the same way, since in those languages you also need to learn the language syntax, idioms, and other structures. Scheme pushes all that aside for the opportunity to focus on abstraction. The things that are not in the language make it easier to focus on the big ideas.

This isn't really related to your question, but I note that many language designers start out with a lisp- (scheme-) like syntax to try out ideas in the language before they think very hard about its concrete syntax. It turns out to be very good for such experimentation.


Decorators in Python How to teach decorators to Undergrad students? I mean how make the concept crystal clear?
Sometimes it becomes complex as :
"functions passing another functions in argument, adding new functionality to existing functions or classes without modifying the existing structure" and using "@" symbol confuses students.
I know decorators are very powerful tools. Any suggestions for teaching them effectively?

Although it should probably be only one strategy among many, you might teach it through practical examples.  In this short program that uses flask_user (and
which students can install in just a few minutes) the decorator ensures that only authenticated users can use the route:
https://flask-user.readthedocs.io/en/latest/quickstart_app.html


How many lines does your code have? This question was prompted by observing a faculty member in projects evaluation. Before asking anything else, the very first question she asked from every student was: "How many lines does your code have?"

So I need to know how important this question is and is it really worth asking the nervous students who have just arrived to present their full projects rather than a routine programming assignment?

P.S: While I am neither in favour nor against this question but I have been coding since 2009/10 and my personal experience reminds me that I still don't remember the lines of code for even my own freelancing softwares (even for my thesis program - by don't remembering I mean I even don't remember whether it was 1200 lines or 1800 lines).

What's the point?

Why does the number of lines in the project matter all that much? Unless the code is extraordinarily long or short (i.e. orders of magnitude away from what is expected), lines of code aren't a good indicator of whether a project is good or bad.

I've heard of one example where some students were set the task of creating a Caesar cipher1 program. If you're aware of it, you'll know that it can be trivially solved by using modular arithmetic2:

def encrypt(ciphertext, shift):
    output = ''
    for character in ciphertext:
        output += (character + shift) % 26
    return character

So, the 'smart' solution uses 5 lines.

One student submitted a solution to that function with 1382 lines.3

Wait, what?

I suppose you'd quickly realise that this student's solution was... sub-optimal... if you asked them how many lines when they presented their project.

And here's why:

def encrypt(ciphertext, shift):
    output = ''
    for character in ciphertext:
        if shift == 1:
            if character == 'A':
                output += 'B'
            elif character == 'B':
                output += 'C'
            ...

So now you can see the merits of using code length to spot solutions that are over 250x longer than necessary.

But when the difference is much smaller, why bother using lines as an indicator of anything? Hopefully, students are writing clear, maintainable code, not playing code golf, so a longer, explicit solution may actually be better.

Equally, treating a higher LoC measurement as a better project is a bad idea. If you do that, you're encouraging unnecessarily verbose solutions, like our student who wrote 1400 lines for a 5 line problem.

Summary

LoC can be useful for spotting really badly wrong solutions, but setting 'targets' with it can be harmful.
Asking for the length directly is probably pointless—instead, just take a look at that when you review the code and mark it.

1You might also know a variant of this as the ROT13 cipher where the shift is 13. This has the convenient property of being self-inverse, so you don't need to subtract to decrypt in a separate function. If our student was really clever and wanted to implement that in Python 2, they could have just written input().encode('rot13'). It's a whole new world up here!

2There's a bit of a lie-to-children here, if you're not paying attention. That code assumes that all the letters you want to encode are encoded from 0 to 25 (e.g. 0 = A, 1 = B). That's not how character encodings work in reality (there's an offset in ASCII before you get to the capital letters), but it's not relevant for the example.

3I cheated and calculated the amount of lines you'd use from that approach, rather than actually writing the whole thing and counting the lines.


Platform for annotating students' code assignments I'm about to start teaching a class of 10 people. I do it for free, and I search after a platform for home assignment.

That platform should be:

 1. Free
 2. Support multiple users and multiple assignments
 3. Allow me to comment on specific lines of their code
 4. (Ultimately) allow them to change their solution without cleaning the comments
 5. Very simple for solution submission (no SCM systems involved)
 6. Could be or not be self-hosted

Is there any known system that has these features?
Thanks!

I was not aware of GitHub ClassRoom as mentioned by @Ryan_Nutt above, but I have been using repl.it for classroom coding exercises.

It will do auto-correction (based on unit-tests or output matching) and will allow commenting.  Students do not need to be able to use git, and can code their solution in an ide or online. Pasting their code in will let them test if it passes.  You can view and comment on their code, albeit not an inline comment you can reference the line.

It is free.  I link to it from Moodle and with the link the class can "join" my repl class.  It also lets them save code in the cloud so that code from class can be saved online and therefore accessible from home.

It's worth a look and could be built up over time (exercises etc.). I have 10 in my class at the moment, am teaching with Python, and was able to import 115 questions another teacher had created, so there is opportunity to get up an running relatively quickly.

As an aside, I did find that creating questions from fresh a bit cumbersome but some of this may be because I found it difficult to even get started making a classroom at the beginning.

Hope this might be of some benefit to you.

Sean.


Is there evidence of differences in the outcomes of objects-early vs objects-late? Here is the essential parts of a (HS) Junior level question from one of our (Canadian) national computing challenges.  (http://www.cemc.uwaterloo.ca/contests/computing/2017/stage%201/juniorEF.pdf)
Problem start
Input Specification:
The first line of input contains the integer x (−1000 ≤ x ≤ 1000; x != 0). The second line of input contains the integer y (−1000 ≤ y ≤ 1000; y != 0).
Output Specification
Output the quadrant number (1, 2, 3 or 4) for a specific x,y coordinate.
end
I have long suspected a difference in the outcome between objects-early and objects-late.  For instance, a student who was given an objects-early approach might create code like this:
public class Point
{
    public Point( int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    public int getQuadrant()
    {
        if(x>0 && y>0) return 1;
        if(x>0 && y<0) return 4;
        if(x<0 && y>0) return 2;
        if(x<0 && y<0) return 3;
        return 0;   // origin or no quadrant
    }

    private int x = 0;
    private int y = 0;
}

Whereas a student who was given an objects-late approach might create code more like so:
public int determineQuadrant1( int x, int y )
{
        if(x>0 && y>0) return 1;
        if(x>0 && y<0) return 4;
        if(x<0 && y>0) return 2;
        if(x<0 && y<0) return 3;
        return 0;   // origin or no quadrant
}

And similarly later in the same challenge students were asked if there could arrive at a destination (coordinate) using an exact number of moves (energy) and I noticed these types of solutions:
public class Point {
      public int distanceTo( Point p )
      { return | x – p.x | + | y – p.y | ; }    // math notation used }

While Late Objects students continued to approach the solution as functions with:
int getDistance( int x1, int y1, int x2, int y2 )
{ /* same math */ }

What I think I am seeing is a preference for Early Object students to employ objects and services in their solutions from the start, while Late Object students kind of ease into it if at all.
I have additional examples from questions later in the challenge that seem to support this.
Is there evidence, either published or anecdotal, that I am correct?  Do we know that the order of instruction matters here?

tl;dr/ Students tend to do what they have the most practice doing. But timed contests can advantage/disadvantage some students independent of skill and background.

I have to admit I'm not a big fan of timed contests for programming. I don't know if that is the situation here, of course. The problem is that they favor quick thinking over deep thinking. If you don't have time to get something for every question your score likely suffers even if your solutions to the ones you work on are brilliant.

My advice to a student taking such a challenge would be to get something for every question.

That said, I would expect that students who have seen a lot of OO, and, in particular, have written a lot of classes themselves would naturally (and quickly) put down a class framework and then write methods. Less likely (given time constraints) would they do a problem decomposition into appropriate helper objects and composition of objects to solve any problem. It just takes too long, unless they have an IDE that will produce class/method templates at a click, or use JUnit or similar to build the application scaffolding for a given test.

Likewise, I'd expect that a student with little experience in creating classes would be more likely to just write functions, even if they had seen objects/classes. In a way, assuming that the test judging criteria allow either approach, these students may have a bit of a time advantage since there is less to type.

The psychological effect here is that you tend to do what you have the most practice doing. So Object-Early students automatically start by writing class ..... and Object-Late students may not. But there is little time for reflection on the quality of your overall structure in any case. And likely none for refactoring.

A possible countering psychological effect, since the competitions/challenges take place during the school year is that there is a tendency to repeat what you have most recently been focused on, being fresh in your mind, though less settled.

My bottom line, however is that programming isn't best tested in a timed environment, especially when the questions can be tricky in some sense, where you get an advantage, perhaps serendipitously, if you just think of the trick involved or have seen it before. Some students (my history says I'm one of them) is disadvantaged in this situation.

On the other hand, I can write code very quickly (hundreds of correct lines of code per day) with good tools and practices, including test-driven development with a good IDE (Eclipse). But if you give me a variation of NIM or some other mathematical puzzle, I'll stare at it for too long.

I also teach objects from the start (before if and while) since I value large scale structure over small. That is, providing a solid framework for the smaller scale issues.


Order of learning formal languages, automata, compilers and parsing What is the most traditional or meaningful order for learning formal languages, automata, compilers and parsing, if there's one at all?

Would students benefit from a parallel course in formal languages/automata, so as to highlight the connections?

I'm happy to stand corrected if someone else comes in with a more experienced answer, but automata and formal languages are typically taught together as two aspects of computational theory, since different sorts of automata represent different sorts of languages.  Among other reasons, it's hard to have a discussion about the computing power of modified automata without having the languages to refer to.

As for compilers and parsers, if the goal of a compilers course is to show a student how written code can be translated into machine code, how could you approach one without the other?  "This compiler takes a... tree... and turns it into machine code." The topics are significantly enough interrelated that I would have trouble imagining a sequence where they don't get mixed in together.

I believe (though I have not done a thorough search of course sequences to back this up) that compilers is typically taught sometime after computational theory, since it helps to be at least nominally familiar with the notion of a grammar before you begin.


What advantages do students who learn how to touch type have? Would a student's overall CS education benefit by having such a skill, and if so why not make it a required prerequisite?

An editor notes that there are three (at least) different ideas here that may be confused.

Does the user hunt and peck searching for each key for each use?
Does the user look at the keyboard/hands rather than elsewhere?
Does the user use (usually) nine fingers to type or three?

Touch typing itself suggests using nine fingers and typing by "feel" without looking at the hands. But there are different combinations possible. In particular, some three finger typists don't really hunt and peck, having internalized the keyboard. Some may not need to look at their hands at all.

Note: "Nine" fingers as the left thumb is often not used at all. "Three" fingers as one of the thumbs is often used.

Actually, there are a lot of things that benefit a student in CS, such as a degree in Mathematics or Sociology. Likewise interpersonal skills that help a person work in groups. Others are too numerous to mention.

However, a true prerequisite is a block, preventing advancement if you don't have the skill, so no, it should not be required.

Some data points. I was lucky enough to take a course in touch typing (on a typewriter) in about 1960. I was the only boy in the class intended for girls who would likely become secretaries. Not especially enlightened, of course. But touch typing has benefited me most in writing rather than in programming, and any CS professional writes a lot, even if they aren't book authors. But there are technical reports, grant proposals, system documentation, etc. that makes typing skill useful.

On the other hand, I know a lot of professionals, who are also authors, who still use two or three fingers to type and it doesn't inhibit them. The world would be a poorer place if they were prevented from entering the field for the lack of such a low level skill.

Also, modern hand held devices don't adapt well to touch typing. On a phone, I usually use just one finger since the keys are too small and my fingers are too big for me to use even two fingers.

But, students should be encouraged to type effectively, of course. But not as a block to advancement. Students should, of course, also be encouraged to develop good handwriting skills so that they can read their own hand-written notes. But that skill is being lost, unfortunately.

tl;dr: Prerequisites should be required only for required things, not just helpful things.

I'll also note that it isn't typing that makes programming hard. Neither is it typing that makes writing hard.

But if a student's typing skills are so bad that they seem forced to used extremely short and uninformative names for entities, then they need to improve. Readability is required.


Using online courses instead of / in addition to traditional lecturing Some time ago, I needed to teach git in the class. So I took a 6 hours course in one of the online courses websites (I think it was udemy or coursera). The course was so good, that I was wondering why I have to teach this myself at all? Why not tell the students to view the course at home and ask me if they have any questions? The online course has many advantages that I cannot hope to have in class:

Each student can learn in his/her own pace;
Every several minutes, there is a pause and a short question so that the students can check their understanding before proceeding;
Every hour or two, there is an intermediate summary with a quick quiz that is graded automatically;
The lectures are very polished, clear, with many examples. And, they have more time than me (I had only 3 hours) so they can elaborate more, and the students can choose whether to go deeper.

Of course, I cannot just say that I do not come to teach, because it is against the rules of the department. But, from the students' perspective, it seems much better to learn from home.

So my questions are:

Should I recommend to my students "learn everything at home before the class, and come to class only if there is something you want to ask"?
Is there another way to combine online courses with frontal teaching in a fruitful way?

What you have described is about half of what is known as a flipped classroom. This concept has been explored in other questions here and at the Academia forum. The idea is that instead of lecturing, face to face time is filled with activities that can only be done face to face and the students are given "assignments" to read or explore video and other online information outside of class.

What would normally be practice and experience on the student's own time (standard classroom) is now done during the class periods where you get a chance to observe them. You also get a chance to permit group work and sharing, but in an environment in which you can see that any rules are adhered to.

The flipped classroom is very handy in the beginning CS courses where students need to get a lot of practice, but also get stopped when they get to questions that they can't answer and then wait for a chance to have them answered.

But your face time needs to be more (much more) than just you answering questions. That is only serving one or a few students at a time. You need to design activities in which they can all benefit. Group work in a flipped classroom is also useful as many of the questions that arise in the course of an activity can be answered by the students themselves and their team mate(s) and so don't need to come to you.

Many instructors flip the classroom for the entire course, never lecturing in the traditional sense, but you can also apply it to specific topics. The upside of doing it just a bit is that you get practice with it yourself, but the downside is that the students will be awkward with it initially and won't likely do enough outside class periods.

On an orthogonal track, online courses are a mixed-value resource. For certain kinds of learners (like yourself) they can be valuable. For others, they don't work at all. The typical drop-out figures for online courses are appalling. I don't think that is primarily due to the quality of the material but rather to a mismatch with learning styles of the students. I don't have research on that, however, but would love to see it. One problem with video is that a student can't ask a question in the middle of it. If they miss a point, they can replay, but can't really get a clarification. I also question whether students are able, in such courses, to get appropriate practice and (more important) feedback on their practice.

But combining an online "course" with good practice-and-feedback can be a plus, provided that you design it properly, taking account of the different needs of different students.

Here us another question on Flipped Classroom. A simple search for "flipped" at Academia will turn up a wealth of information.


How to learn computer science from bottom to up? I know that most computer science students learn things like they are assumed some basic knowledge of programming and they are learning gradually more accurate reasoning and ways to produce more reliable code. But on the other hand, I studied myself to be a mathematician and found it very interesting to learn axioms and build the whole theory to just a few assumptions, rigorous definitions and I was sure that everything works if there is no contradiction between axioms.

Is there anything similar learning curve for studying computer science for math majors? Can one learn first Turing machines, then to build core of OS, then hex editor, then C compiler, the some theorem proving software like Coq and then prove that the OS is free from bugs etc.

Yes, it is possible to do that, but it is terribly inefficient. It will take you approximately forever, partly because it is no longer true that any single person can now understand all of Computer Science. The boundary was passed somewhere around the turn of the century, just as in mathematics it happened around the turn of the previous century.

If you start from the very beginning, ignoring everything that came later, you will deny yourself the possibility to benefit from the big ideas that developed along the way that the history followed. One of the biggest ideas in computing is the idea of abstraction and understanding that buys you a lot in understanding and also in guiding your learning.

A Turing Machine, just like pure Machine Language, has no abstraction facilities whatever. Assembly language adds a bit. Fortran and Cobol added more. But it was the Algol family of languages that really solidified the importance of abstraction and it was languages like Lisp and Smalltalk that extended it to modern levels of understanding. But if you have a good understanding of abstraction, such as you would learn from programming in Java or Python, then you can more easily move down to simpler (less abstraction) languages and move upwards to higher levels (database, AI, etc).

I think you have a misunderstanding, actually, and are conflating Computer Programming with Computer Science. They are not the same. Programming at a high or low level is just a tool for understanding more important and more interesting things. (I'm not claiming you have this misunderstanding, but your question leaves hints of it, at least.)

Most students of computer science start with some high(er) level language, often Java or Python. From there they move up and down the abstraction scale. I've built (finite) Turing Machines and explored them deeply when studying Algorithms. But I didn't start there. I'm old enough that Fortran and Basic were my first languages. But then Pascal taught me about a certain kind of abstraction (procedural) and later Smalltalk taught me object abstraction.

I've never built a full OS, but have built a kernel. A micro kernel is really only a few lines of code, actually, but to understand that you have to take a layered view of an OS (abstraction again).

I've built a lot of compilers, but always in higher level languages (C and higher). I've built editors, but not text editors. Graphical drag and drop editors are more interesting in today's world. Think Scratch, though that wasn't me. But my higher level view of what constitutes a program (abstraction) enables me to build any of those things as well as future things for which the need might arise.

So, again, while a purely historical, low level to high level, approach is possible, it isn't, in my well-formed and long-held opinion, the best way. In particular, you don't have to independently re-develop the idea of abstraction to become a good programmer and to use abstraction effectively to get to the "interesting" things.

But that is just the programming part. There is much more in Computer Science and you won't get to that soon enough if you recapitulate the entire history of computing.


Are there companies that allow to be free when learning and teaching? I'm currently a trainer in a kind of "expert" domain: a web-programming backend framework.

However, what I truly like is to help people regardless of their level, mostly online or at conferences. The sad thing is that I have no time for this, because my employer makes a business of this, our clients pay us to train them and get more skills in this open-source tool.

Question:

I'm wondering whether there are companies in the world that just recruit people that will make learning & teaching a full-time activity.

Let's take an imaginary example:

This company would have any kind of activity in the IT world, whatever business, and a few of its employees would spend time going to conferences to learn, or even give talks at conferences or in schools, and the rest of the time on Github, StackOverflow, public Slack, Gitter or Discord channels associated with this technology or in schools.

Is this even something that does exist, or is this pure utopia?

What you describe is pretty close to a university professorship. We are paid to learn and teach. We go to conferences and present our work there, as well as work with colleagues. We don't normally have strict no-compete clauses, though teaching for two different universities isn't normally allowed. Courses we develop can be used by others in many cases, online or otherwise.

You would need to pick your field, however, since technology in itself is a pretty narrow subject. Study for a doctorate is normally quite theoretical in most fields, but there are programs, likely in engineering, that focus more on technology.

Companies in industry have different rules. Normally they want to create a product and are focused on that. There are education-focused companies of course. However, most such companies have strict no-compete rules, some of them attempting to bind you for life. This is especially true if you learn proprietary material as part of your job. Also, the "normal" work day has expanded to the point where you likely just want to have a life in the time that you aren't "on the job".

University professors, too, are always at work, but the work they are always at is normally thinking.

Locally, you might want to visit Arts et Métiers ParisTech, and talk to one or more of the professors there.


Placement of App Inventor in high school CS curriculum Over the past couple days I've had my first opportunity to dive into App Inventor. It has quite frankly blown my mind. I had always (mistakenly) grouped it with Scratch, Snap!, etc. as "just another drag-and-drop environment." It is that but so much more (I can finally see that now).

Now I am wondering where it best fits into a typical high school sequence of CS courses. I could see it being anything from a semester-long intro elective for students with no background to an advanced app development class for students who have completed AP CS A (and thus are quite competent with OOP and Java).

Where does a class focused on App Inventor fit into the high school CS curriculum, and what are the merits of it having said placement?

The AP course that @AlfredThompson referred to is the Mobile CSP course. It's a
complete College Board-endorsed course for the new AP CS Principles course and is entirely based on App Inventor.  It comes with a complete set of lessons for students (Creative Commons-licensed) as well as lesson plans and professional development (PD) resources for teachers.  The MobileCSP project has been providing PD for high school teachers throughout the U.S. since 2013 and has now trained around 500 teachers. For more information about the project, see this site.


Best Practices for introductory teaching Literature states that there are particularly difficult issues with introducing programming, and that many of the issues are still not well understood. But some results indicate that these are some effective methods:

Presenting worked-out examples in lecture
Providing partially worked programs for lab exercise
Asking for an explanation of a complete example in tests

These methods reduce cognitive load, so that the students can focus on the relevant ('germane') details while learning or demonstrating proficiency. Other details and distractions cause 'noise' which make the cognitive load too high. Another factor is that methods that work for beginners are inappropriate or hindering to more advanced students, and in a classroom with varying abilities it can become difficult to structure material or present it properly.

Perhaps the biggest variation is in student's predispositions towards problems solving. This quote points to a major obstacle to most programming learning:

  A weakness of worked-out examples is that they may not engage the
  learner enough to induce germane load. The effectiveness of the
  examples is negated if the learner does not study them attentively and
  explain the given solution to themselves. The literature suggests that
  many learners are not naturally inclined towards effective spontaneous
  self-explanation of worked-out examples.

Self-explanation is a skill or tendency which is thinly distributed in the population. Can it be promoted somehow?

What methods have you found most effective with beginner programming students for showing new material and having students practice it?

I think you have left out two essential elements here. Your first two points leave the students passive consumers. The last is about testing. But there is no guarantee of any learning in between.

In some ways, the two most important pedagogical ideas are

Active Student
Constant Feedback

You need to ask your students to create things and you need to give them individual feedback on how they did. The fraction of students who learn by listening to lecture is actually quite small. Taking notes (by hand) makes them more active, but using the face-to-face time to work with them in artifact creation is much-much better.

But students are unlikely to get everything right the first time and each student will need individual direction, whether they are struggling or excelling.

Note that teamwork is an attempt to combine these two things. The team creates something and give each other feedback as they go along.

My constant mantra while teaching was "It isn't important what I (the teacher) do. It is only important what you (the student) do."  Focus on their activities, not yours. Perfect their exercises, not your lectures.

I'm not sure how relevant this is to CS, but one of the most important and memorable courses I had in my first year of college was a writing course. The prof never talked about the process of writing, but pointed us to a lot of good writing. However, the crux of the course was that we wrote a theme for every class (3 per week). We spent quite a lot of the time in class reading these aloud and getting feedback. His particular trick was to pick out the best ones in his judgement for review, not the ones that needed the most work. We also got detailed feedback in writing. No lecture at all. Lots of activity, lots of feedback. He did his job.


How to explain the int() function to a beginner It was suggested I cross post this question from the main Stack
  Overflow site as it may be of interest here too

I am tutoring a neighbour's child and we were exploring the int() function before using it with input() - which returns a string. We tried the following:

int(5)
int(5.5)
int('5')
int('5.5')

The first three returned 5 as expected; the last one threw the error

  ValueError: invalid literal for int() with base 10: '5.5'

Given the behaviour of the first three lines how do I explain the error to a 14-year old (background = speaks 4 languages but is poor at maths)?

UPDATE

C# exhibits the same behaviour: Convert.ToInt32("5.5"); throws the error

  Input string was not in a correct format.

First the reason for the failure. Function int wants either a number or a string that represents an int (from the Python 3 docs). The first part covers your first two examples and the second part covers your third.

However '5.5' isn't a "string that represents an int", hence the failure. It is, of course, a string that represents a number, but that isn't the same thing.

But

int(eval('5.5'))

will return 5 since eval will return a number that int will be able to work with.

Now, how to explain it. There are two options (at least). The first (worst) is just to tell the kid that the world isn't magic and int only works for some things, but doesn't handle everything.

But it makes more sense to treat it as an exercise in careful reading of specifications. Read what the specification does say and what it doesn't say. Specifications are meant to be precise.

You can make it a lesson about reading the manual when you get confused, or writing test cases to explore the range of possibilities.

You can make it an lesson about searching for an alternate solution (i.e. eval) when something you try fails.

You can make it a lesson about "when you are older and get to design things, spend some time getting it right." I haven't explored whether there is logic behind the decision to not include such a case as your fourth example, but I doubt that it was an oversight.

See the note by @ctrl-alt-delor. Function eval permits the evaluation of arbitrary code, not just simple expressions. It shouldn't be used, for example, with unexamined user input strings. It is safe, however, provided that you have control over the argument in some way.


How to stress the importance of testing code? I've run into the issue in the past that students don't test their code, and get into a huge mess when they can't find out what's not working. How can I prove to them (before something like this happens) that testing code is important?

This is a class of high school students, grades 9-12 (ages 14-18). The class is mostly made up of sophomores, but has students from all grade levels.

This is in the United States.

Introduce test-driven development.

TDD and agile methods of development are very popular at the minute, and for good reason — you know, ahead of time, exactly what each part of the program must achieve, and you can confidently say that the program will work as intended as long as your tests are thorough.

I think that sometimes, the confusion begins when students aren't actually sure what they're trying to achieve in the first place, so they're reluctant to test because the code is already so fragile. TDD helps to ensure that there is a clear specification of behaviour for the code, so the students are clear on what should happen, and that the code they're written fulfils the specification.

Make it clear that testing is part of the project in your lessons, and it should help to solve some problems. When students are asked to write a program, they may not realise that writing some tests along with the project (or even beforehand, as in TDD) is a good idea. Having the red-green-refactor cycle would seem helpful here; it will give your students confidence that their code works as intended, and then the ability to clean up and improve their code without breaking it.

Test-Driven Development Goes To School was interesting reading while I wrote this answer. They evaluated the effects of teaching using TDD at several university courses, with generally mixed/positive results. At Virginia Polytechnic Institute:

  Code correctness measured as the number of defects per
  thousand lines of code was only 38 for the TDD group compared to 70 for those not using
  test-driven development
  65.3% of students either agreed
  or strongly agreed that TDD increased their confidence in the correctness of their code.
  67.3% either agreed or strongly agreed that TDD increased their confidence
  when making changes to their code base.
  Test completeness was 93.6% for
  TDD; 90.0% for non-TDD.

Of course, there is the overhead of writing the tests and understanding how to use a unit testing framework. For smaller projects, this might be an excessive overhead, but for most non-trivial projects, test-driven development can still be useful. If you're only developing a few functions, you might only need a few tests, and it's great preparation for industry, where TDD is very common.

So, in short, don't just stress the importance of testing and hope they listen, integrate it into your teaching. If writing good tests is the norm in your class, it's far more likely that rigorous tests will be written.


A beginner example of xor, that is functional (does not switch to procedural) I have been trying to think of an example of xor to connect with what students already know. I did some searches. But everything I found, seems to have unconsciously switched to procedural.

For example:
They say for and "the lights are on and my eyes are open".
But when they get to xor, they say "Choose this xor choose that". This is not a boolean predicate that evaluates to true or false. This is a selection.

So the question:
Can you provide an example of use of xor in a boolean statement, that is accessible to students, that are new to boolean?

I am not yet interested in all the beautiful things that can be done with xor. That is easy. At this stage I am trying to connect to what we say in English language.

I can't tell whether I've missed something in the other answers or comments, but the natural language equivalent of XOR is to ask "is there any difference?"

Used in a sentence which follows the broad format of those in the question, you'd be saying something like "the light is on differs-from the door is open", with the compound 'differs-from' element being the XOR operator.

Even in computer science, the XOR and XNOR operators typically go by other aliases, such as Not-Equal and Equal operators, respectively.


What teaching techniques can be used, in teaching students from a medical background, to improve their programming? Students from premedical background feel difficulty in programming. They have no basic concepts of programming, so they are unable to do good programming. I have searched but didn't get any solution which help me to improve the programming skills of medical background student.

To get the premedical students involved you can tell them that by the end of the course they will be able to dissect a program. It may not be as gross as a frog, but it will be more interesting. Unlike the frog, when done dissecting the program they can bring it back to life.

The next thing requires that you mean what you say, and follow through with actions that match. Tell the class that their marks in the course will be based on their performance in the course and their apprehension of the course material, not upon their major or program of study.

Final thing is to forget which students are pre-med, chemistry majors, fine arts students, or comp-sci majors, and teach the class as if all the students are willing and able to learn.

The one thing that did catch my eye in the question was that the students in question have no basic concepts of programming. That causes me to wonder if some students are taking a course which should have a prerequisite course and does not, or if the course has been designed, unintentionally perhaps, based on the premise that incoming students have those basic concepts even though it is listed as an entry course.

Perhaps it has been the history of the course that students arrived with prior experience even though it was an entry course, and the faculty has grown accustomed to that and adjusted the course accordingly.


Coding assignments for algorithms and data structures? Do you know of any online resource with ideas/projects for an Algorithms and Data Structures course? Topics in the course include: basic data structures (array, list, stack, queue, priority queue, graphs, trees), sorting, hashing, etc.
Such a course is typically for freshmen and grading is based on:
1. Correctness
2. Documentation
3. Use of abstraction and design patterns.
4. Efficiency.
It's becoming more and more important for assignments to be somehow auto-gradable, at least with respect to correctness and efficiency.

I'm not aware of any singular, central repository for assignment ideas.  My sources for project ideas when my own well begin to run dry are:

Textbooks.  Often, a problem in a problem set will trigger an idea for a full-blown lab assignment.
Other similar courses posted by other professors.  Obviously, it is important not to simply steal someone's idea.  I will adapt the assignment and make it my own.  If it is still substantively similar to the original when I am done, I will credit the original professor with a link to the original assignment.  (I have also on a small number of occasions reached out to a professor directly for permission to simply use one of their assignments directly. It has been my experience that people have been very gracious in these situations, both granting permission, and sometimes providing additional supporting materials such as rubrics, exemplar answers, and autograder test cases.)
I just generally keep an eye out for fun lab ideas and write them down when they come to me, even (especially!) if they are for classes that I am not currently teaching, because I have found this to be a useful resource when I begin to teach a new class.
We assign a fair number of open-ended projects.  I have not historically used these as source ideas for future lab assignments, but there is no reason that I couldn't do so, and thinking upon it now, I probably should.  I would, of course, share this with the students in question.  Most students would probably be flattered at the idea of their project being adapted to a full course lab, though if someone had objections, I would not press them.  Ideas are hard to come by, but not that hard.


How to retain technical information about new features? I'm going through an online training on Apex and Salesforce (trailhead), and I don't know how to retain all this info. I'm memorizing it, and trying to build stuff, but I'm still not retaining it.... Does anyone have any recommendations on how to retain all this info?

Ex - https://trailhead.salesforce.com/modules/apex_triggers/units/apex_triggers_intro

I know that this isn't the right channel for this question, but I couldn't find a more suitable one. If the mods want to close this, I ask that you point me in the direction of the right channel (I've posted this on Reddit too, without much success).

"Memorizing" doesn't do much to help you retain information or build skills. In order to really remember it you have to move it from short term memory, where it is pretty volatile to long term memory. The trick for doing this is to practice it. The reason teachers give students lots of exercises is to help them with this process.

In order to learn anything, the brain needs to be physically changed, connecting neurons with synapses in a new way. This is only done with repetition and practice.

See The Art of Changing the Brain by James E Zull  for a run-down on the science behind it.

Do, if the course provides exercises do them all. If you have a book available that also has exercises on the material, do  those as well.


Is it worthwhile for college professors to join SIGCSE? When I had grant money or worked in industry, I was a member of the Association for Computing Machine (ACM) and the Special Interest Group on Computer Science Education (SIGCSE), which holds several annual conferences and publishes ACM Inroads. Now that I'm no longer publishing in CS education, am focused on teaching, and would have to pay for membership out of my own pocket, I'm wondering if membership is worthwhile. What do SIGCSE members or non-members in situations similar to mine think?

I would say yes, definitely. It is a great bunch of well informed and friendly people. The conferences are very valuable, including the panel discussions, demos, and tutorials.

The SIGCSE conference is also a place at which some of your students might publish and, if they are interested in teaching as a career, meet people who can help them. The people who go to the conference have broad interest in CS as a whole, not just teaching.

Some of the questions that you ask here would find ready answers in the SIGCSE community. Many things done and discussed in the community would enhance your own teaching.

SIGCSE also has an international conference (ITICSE) at which people from lots of places, but mostly Europe, come together annually.

If you don't care to get conference proceedings, etc, on paper, an electronic only option is available and very inexpensive.

I'm a long time member, never an officer, frequent reviewer. I've maintained membership even after retirement, though I've withdrawn from other, more technical, SIGS. Worth it, always.

Let me add that ethics and related topics are often in the Inroads magazine and a number of members are strongly focused on ethics (say, Don Gotterbarn)


How to tell a student that s/he should enroll in a different program? Through the years I had several students that clearly were not fitted for computer science. Some of them ended up by dropping the program after a few years, some of them are still there struggling year after year.

I guess that one of the main problems is that they shouldn’t even have started the program, but due to unemployment of other programs, and the permanent media coverage on the lack of IT professionals, they end up enrolling.

Right now I am aware of 5-10 students that are on their 7th, 8th and further years on a 3 year program. And some of them are getting worse every year. So, they are basically spending their parents’ money and could be doing something more productive instead of just being there.

In some cases, it just makes me sad to see that they are absolutely unable to progress.

So, my question is: has any of you ever had to tell a student that s/he should probably enroll in a different program?

Note: I am aware of this question about CS class, my question is about the entire program.

Don't tell them anything. Ask pointed questions.  Ask why they chose this course, or this major.  Ask where they expect to be in a year or in five years.  Make them talk through their plans.  Let them find the gaps in it.

This past semester, I asked every single student that came in to my office to change majors to CS (or to IT) the same first question: "Why?"  Some students had a great immediate answer, and I signed the form right away.  With others, we had a 20 minute conversation.  Some of them said they're in it for the money, and I would say things like "You'll make more money as a plumber, and you don't need college for that."  "Oh, but my dad said-"  "But what do you want?"

It's like helping them learn to debug.  Let them come to the decision.


Teaching coding paradigms and concepts with specific context Teaching programming is a great part of mentoring FRC (FIRST Robotics Competition) teams. For teaching how to program a robot (Specifically, a RoboRIO), I first (unintended pun: FIRST) need to teach various paradigms (OOP, Generics etc.). There is a need to find ways to teach necessary but general concepts before diving into programming the robot itself (e.g. motor controls and such).

Teaching Java paradigms in the classical and rather abstract sense usually confuses the students because they don't see any connection to robotics. As a result, students have difficulty understanding the subject (they aren't exactly at a level to learn that, so older team members try to teach it in a way that would make it easier). If they saw how these concepts integrated into programming the robot, then they would hopefully understand the subjects and their applications better.

So my question is this: how can I teach those programming concepts in the specific context of FIRST Robotics?

The students have a bit of experience with loops and types, but nothing more complex.

Based on my two years of involvement with FIRST, I have a few suggestions:

Teach students to read the documentation. This site covers Java programming for the 2017 FRC Control System. FIRST programming, while requiring general programming skills, is specialized for the roboRIO and for the competition as a whole. We ran into a couple issues this year whose solutions were found by methodically reading through these documents. There can be a rush to jump right to coding, but it is essential to understand the WPI library and its API fully. This also serves the purpose of seeing which programmers have the discipline to follow documentation to the letter. Having the patience and thought to do so is a necessary condition for being a successful programmer.
Use a simple chassis for coding/driving practice. Each year's game has its unique twists and challenges. However, underneath the superstructure  is a drive base that in many cases can be used from year to year with slight modifications. Treat this as essentially a learning robot. Give it working code, let students drive it, then teach the code itself. Make changes from one run to the next. Since the code has immediate, real-world consequences, show the results of minor changes in action. This way you can then go back to the classroom/IDE knowing that students have a context in which to operate. Have them observe and reflect on what happens from run to run when one variable, say, is changed.
Research other teams' code. Most, maybe all, strong FRC programs have well-developed websites and numerous GitHub repositories. Look at best practices from these teams. Reach out to them. Have students try to read and understand their code.

Ultimately, students need to know Java, and understanding classes and objects, inheritance and polymorphism, will be as needed with FRC as anywhere else. However, to help them see how Java applies specifically to FRC, start with something that drives and work backward from there. Maybe start with #2, move back to #1, and lead them to #3, maybe even with examples you have found of how teams use the WPI library in different ways.