Command-line Java in AP CS A Context: Over the past school year I spent a significant portion of my time preparing to teach AP CS A next year. From choosing textbooks to writing the College Board syllabus, I essentially started from scratch in designing my course. I'm pleased with all aspects of it as it currently stands, but there is one nagging element: the programming environment.

All students taking AP CS A next year have experience using Cloud9 because that's what we used for C/Python/HTML/CSS this year in AP CSP. Only in the last couple weeks did I discover how easy it is to install the JDK in a Cloud9 workspace and write, compile, and execute programs in Java from the command line. (I had read somewhere a while ago that Java and Cloud9 didn't play nicely.) I had been BlueJ all the way until that point, and I do still very much like BlueJ. However, not having taught the class before, only designed it, here's my (hopefully specific enough) question:

Will students lose anything in their understanding of and proficiency with Java, especially in terms of the AP Exam, if the class only uses a command-line environment for program compilation and execution?

There are many pros/cons to one IDE over another -- a topic which I think is too broad for this community. I just want to make sure, from those who have experience with this course, if there's something that the command-line environment lacks for students that an IDE like BlueJ doesn't lack. I don't want to end up doing students a disservice with respect to the objectives of the course based on this decision.

Edit: Cloud9 is a cloud-based IDE, which makes it ideal for my 1:1 Chromebook environment (however, I do have access to a PC lab for additional software, so that is not a restricting factor for me). As they define it, "Cloud9 combines a powerful online code editor with a full Ubuntu workspace in the cloud." You essentially get a text editor and a terminal for compiling and running programs. I've found that anything I can do via a Linux command line, I can do in Cloud9. It has a number of additional features that make it great for classroom use. I originally chose it because it's the environment used for the CS50 IDE. See more here.

Similar to @ncmathsadist, I use both command-line environments and IDEs, and I have only found them enhancing each other.  We do most of our work in IDEs, but a few assignments are done in CLIs every year to ensure that students slowly gain some familiarity with those environments.

Reasons for IDEs:

Convenience
Easy integration with GitHub
Error highlighting (though I have some issues with this)
Ease with packages and project integration

Reasons for CLIs:

There are still plenty of important computing platforms (including both iOS and Windows!) that ultimately reduce down to CLIs.
Good luck explaining the string[] args in public static void main(String[] args) if students don't have any experience in CLIs.
Even a little POSIX familiarity goes a long way.


Java or Kotlin for beginners (procedural programming knowledge is existing)? We are teaching an "introduction to cs" course (bachelor level) and in the first half of a year students are learning the fundamental principles of procedural languages. We are using python 3 and C as exemplary languages for this part.

Up until now, I moved on to C++ and the object oriented part of python 3 in the second half of the year to demonstrate object oriented languages.

Java is currently tought in the third semester.

All three languages will be needed by the students later on, so the pros and cons of C, C++ and python 3 are not part of the question...

Now we decided to start introducing Java one semester earlier instead of C++.

While we were discussion the course design I joked "why don't we just skip Java and move to Kotlin", and since I had this idea I'm really considering it.

Do you already have experiences with Kotlin in teaching? Would you consider replacing Java entirely by Kotlin? Or would you just mention its existence?
Any pros and cons? How about GUI design etc. (I used qt in the old course)?

Our students might develop smartphone apps as well as webservices in those languages.

I've been using Kotlin for two years now on an introductory course on imperative programming (bachelor's first semester) and I'm very happy with this decision. Before Kotlin, I was using Java for the same course.

Here are some of the benefits:

No need to explain what are classes on a imperative programming course, since Kotlin programs can only have a main() top level function (like C)
It is a "safe" language in the sense that it prevents most novice mistakes at compilation time (uninitialised variables, type conversion errors, etc.)
For simple interactive programs (e.g., ask two numbers and compute their sum), you don't need all the complexity of the Scanner/BufferedReader classes, just use readLine() and println() (without the System.out). This makes the initial learning curve much more pleasant.
It forces the students to think about the little things that are essential when you are taking the first steps in programming: mutable vs immutable variables, nullable vs non nullable types, mandatory variable initialisation, implicit vs explicit types, conditions as expressions, etc...
It is easy to jump to Java in later courses (than say Python or Javascript)

Most of all, from my experience students find it more motivating to learn to program in Kotlin than Java, since they have to write less to accomplish the same things while at the same time feeling protected about runtime errors.

My advice: go for Kotlin.


Video Games during class My school is BYOD (Bring Your Own Device).  This has a lot of benefits in terms of technology, but it also gives us no control over what is on the laptops kids bring into class.  During lab time, kids will often try to sneak in game playing.  This year, I made a policy that, if I catch someone playing a video game during class, they will owe me a small project.  This has reduced game playing quite a bit from my previous technique (which was just telling them to cut it out), but the problem persists.

How do you prevent kids from playing games during lab periods and during lectures?

I semi jokingly tell my students at the beginning of the year they can play any game they want on the computers, as long as they write it first. It at least gets a laugh.

For me it takes two things.

One, I need to be able to see their screens. Given, this is probably much easier with school provided devices. When I moved into the classroom I'm in all of the student seats were facing forward with the monitors facing away from the teacher. First thing I did was push all the desks to the wall so that the monitors are facing the center of the room. I can see almost every monitor from almost any spot in the room. This also helps getting to students to help them since I don't have to squeeze through rows. It does help that I have a pretty big classroom though.

And two, I need to keep them busy. What I've found is that once there's a student playing games it spreads. And the first one usually isn't playing because they're screwing around. They're probably done with their assignments. I throw more assignments at a class than most students will be able to finish - some are extra credit. I also have a list of enrichment activities that they work on when done with labs - Coding Bat, Code Combat, Project Euler, making their own game, that sort of thing. That way there's always something CompSci related to work on.

We are partially BYOD in that kids are free to bring their devices, but aren't required to. There's always a handful of students that prefer to work from their own notebooks. My rule on that is that they're free to do so, until I catch them screwing around on something else. Then, they have to use the school computers. For most, that's enough incentive to keep on task.


Finding tutoring in Maths / CS I am technically enrolled on a university course but lack basic maths ability and have fallen behind in trying to catch up. Therefore I need to explore self-learning to improve my position while continuing my university course.

I'm looking for a math / computer science tutor to cover areas of discrete maths; number theory / proofs and counting plus others. Other suggestions for helping me come up to speed in these areas might also be helpful.

I'm a mature student and am keen to put the hours of work that are needed. I have some materials but there aren't enough examples provided to help me to understand better.

How does one find tutoring and other supplemental aid for otherwise engaged students in these areas? Does online tutoring exist?

I realize that this isn't a perfect answer since it may lack the personal contact with an instructor that may be the most valuable. However Coursera has a number of courses that might provide the necessary background if you can match their schedule.

In particular Combinatorics and Probability should teach you sophisticated counting techniques.

They also have a series of courses on Discrete Math for Computing that probably covers the rest. (Combinatorics is one of the courses in this sequence.)

The downside, however, is that you don't get much in the way of a personal touch that you get in a face-to-face environment.

Some of the various online course sites provide some tutorial help and more provide peer-to-peer contact, but the quality of the help you get with that is likely spotty. It may help you get over some of the humps, but will be less valuable for building mathematical insight.


Why is computer science hard? Data pretty regularly shows that computer science programs have among the highest failure and dropout rates of any college program. A number of sources all echo the finding that roughly one-third of incoming CS majors do not progress to a second year, higher than most other majors.

Computer science undergraduates most likely to drop out (ComputerWeekly.com, 2019)
Concern over drop-out rates in computer science courses (The Irish Times, 2016)
Why are computer science drop-out rates so high? (Trinity News, 2016)

I teach computer science majors at a U.S. community college, and the non-passing rates are even higher in this context. A few times in my introductory programming course, I will mention this fact (that computer science is among the hardest majors), partly to set expectations that students will need to work hard to succeed.
This semester I had a student in my virtual office hour ask, "Why is computer science harder than other majors, as you say?", and I was a bit flat-footed for a good response.
So: What would be the best reply to a beginning CS student who asks, "Why is CS hard?"

The difficulty of CS (true or imagined) and the drop out rates are not the same thing. Let me start an answer, but it might take several iterations to get all my thoughts together on the two ideas.
Two themes come immediately to mind.
The first is periodic and I don't know where we are in the period at the moment. But in certain combinations of economic factors and media hype, a lot of students go in to CS not really understanding what they are getting in to but are lured by the, perhaps elusive, draw of big salaries. There is a lot of hype out there about AI at the moment, and self driving cars, and going to Mars, etc. People get in for the wrong reasons and decide they really didn't understand what it was and that they don't really like it. It doesn't need to be hard to drive people away, just boring.
The second major theme is that there is a lot of bad teaching around CS as has always been the case. Some people teach it as misspelled mathematics, which it is not. Some people in elementary and secondary schools are forced to teaching CS and especially Advanced Placement CS when they have little understanding of the topic and just try to stay "one week ahead" of the students. This is, and has always been a recipe for disaster. I don't blame the teachers who have to do this as many are forced in to it (in the US) simply because schools are underfunded and understaffed with too few specialist teachers.
WRT the second theme, it might even be that the current push to teach "CS" in elementary schools is actually part of the problem, not the solution. A serious college level course in CS might be shocking to someone who has only dabbled in trivial elements of programming. In particular CS is NOT programming, though skill in programming is needed.
Too many beginning students and teachers think that programming is "if" and "while" and "assignment" and nothing else. The current AP curriculum, I think, is seriously flawed (dropping interfaces, in particular). Students program in "rich" languages and environments using only the lowest level concepts, never really understanding abstraction or (gasp) polymorphism. Compare that with big ideas that you find in a philosophy or (hopefully) history course.
And if you combine that with asking them to write programs that they find boring, they aren't likely to stick around for long.


Advances in CS appropriate for CS1 and CS2 made by female computer scientists Over the course of the CS major at my school, especially in years two and three (roughly equivalent to years 1 and 2 at a university), as I introduce my students to significant advances in Computer Science, I include some information about the scientists who were instrumental in making those advances. This includes people such as Church, Turing, von Neumann, Knuth, Babbage, Chomksy, Dijkstra... all prominent CS luminaries. They are also all male.  Over the three years that I teach my students, I want to be able to paint a more accurately balanced picture of the field than there have been zero contributions by women.

There is also research that back up the assertion that, in the interests of helping to encourage females to enter the STEM fields, it is important to include "people who look like me".

Who, then, are scientists that are, or were, prominent in the field of computer science and whose important work is appropriate to incorporate into the early years of a CS degree?

I do not intend to hit them over the head with this, and I do not want to emphasize interesting biographical excerpts, since it is not a history of CS course. I want to emphasize the CS itself and only introduce the relevant scientists as part of the CS concept being discussed. This means that not every female computer scientist is appropriate, even if they did prominent work. Even with these more limited choices, the clear subtext should be that women really have added important things to this field.

I think Rear Admiral Grace Hopper is perhaps the easiest to explain to new students, and to tie in with an important advancement in computer science.

I try to discuss the transition from early programming in machine language to programming in higher level languages. I'll usually show the students some machine code that I will tediously decrypt. Then I show and talk about assembly languages. Then I'll make a point that "there has to be a better way". Then I'll introduce Grace Hopper and her ideas about compiled languages. Showing a little COBOL code with English words and contrasting it to the equivalent machine code is striking.


Working around language quirks I find javascript to be a very pretty and neat language, once you understand how everything fits into a larger structure, which takes a lot of time and experience to understand. For many who haven't seen this inner beauty (for example, many of my JS students), they notice all kinds of "language quirks", which you can find enumerated all over the internet:

""           ==   "0"           // false
0            ==   ""            // true
0            ==   "0"           // true
false        ==   "false"       // false
false        ==   "0"           // true
false        ==   undefined     // false
false        ==   null          // false
null         ==   undefined     // true
" \t\r\n"    ==   0             // true

Source

Every language has its quirks (although few are as famous as JS in that regard), so what are some ways you've found effective to get students to focus on larger concepts instead of getting hung up on language quirks?

One strategy that's sort of similar to the "embrace" strategy described in the other answers is "acknowledge" -- not only do you explore the quirk, you explicitly acknowledge that it's a flaw or mistake in the language.

After all, languages are designed by humans, and humans are ultimately fallible creatures: I think it's ok to acknowledge in some cases that the language designers messed up, or were working under assumptions and constraints that are no longer relevant today. This lets you work in teaching moments about:

The importance of planning and the realities of software maintenance/backwards compatibility
The fact that everybody makes mistakes and its ok
Demonstrate what balanced technical criticism looks like (as opposed to the annoying sort of "language fanboyism" some students seem to pick up)

You can then amp back up the enthusiasm after you've moved past the quirk and returned to the actual content to help emphasize what you ultimately think is important and worth focusing on.

To return back to your original question, I think whether or not you actually discuss quirks or brush over them depends on to what degree the quirks impact your students' ability to successfully write code.

For example, take the a == b vs a === b thing in JavaScript. I would argue that sort of quirk is ultimately irrelevant in the grand scheme of things: the "always use a === b" rule is almost always what you want, so I would probably spend only a minute or so talking about the quirk (I'd probably spend most of that minute cracking jokes about JS, honestly), finish by mandating students must always use a === b, then move on.

In other cases, trying to paper over or ignore quirks would be irresponsible. One example of this might be JavaScript's Byzantium rules on how exactly the this keyword is scoped. This issue actually does come up fairly frequently in practice (especially once you start mixing together object-oriented and functional style code), so is something you probably do actually need to cover in some detail -- at the very least, you need to give students a good set of rules of thumb they can apply.

Another example might be a == b vs a.equals(b) in Java -- this distinction strikes at the core of several fundamental Java topics and so must probably be taught in detail at some point.

There are unfortunately some quirks that fall into a middle ground: not so easily brushed aside, but not really worth spending time explaining (for example, the broken interaction between Java arrays and generics). In those cases, it might be worth just engineering your homework assignments so students simply never run into those quirks, or just writing that portion of the assignment for them, with comments for the curious.


Is there any pedagogically motivated reason to teach quadratic probing? I'm currently preparing a unit on the implementation of hash tables for a data structures and algorithms course (this is a university-level class, if it matters).

Specifically, I'm focusing on preparing a lecture on different collision resolution strategies, focusing on mainly on separate chaining, linear probing, quadratic probing, and double hashing.

My question is this: why do we teach quadratic probing at all?

I initially added quadratic probing to my todo list mainly because previous instructors of my course taught it and because it's listed in several textbooks I consulted (Data Structures and Algorithm Analysis in Java by Weiss, and Introduction to Algorithms by Cormen, et. al.)

However, I'm not really seeing the pedagogical value of doing so. While it's true that it does offer some minor theoretical speedups over linear probing which I suppose might be interesting to discuss, I don't think those speedups are actually "good enough" to be used in the wild (especially once you take into account things like cache locality, which can sometimes make linear probing surprisingly competitive).

Based on my (admitted informal and ad-hoc) survey of hash table implementations in popular programming languages, people seem to either use separate chaining (Java and C# (sort of)), double hashing (gcc's C++ stdlib implementation), or a linear congruential PRNG (Python).

In that case, is it worth bringing it up at all? I wouldn't mind covering it if I could use it as a vehicle to teach some more general CS concept in some way, or if it had interesting theoretical properties worth exploring, even if only briefly, but at the moment, it just doesn't seem worth the class time.

I suppose at best, I could use it as a stepping stone to bridge the gap between linear probing and some slightly more complicated technique, such as double hashing, but that's all I can think of.

Is there something I'm missing?

Yes, you should at least introduce the idea to your students.

That said, it is also a truism of education that you need not explain every concept at the same level of detail. In this particular case the first couple of paragraphs of the Wikipedia article on the subject is probably enough. A couple of minutes could be well-spent.

Students need to know that there are a range of solutions to any given problem and that those possible solutions have trade-offs. This is an excellent opportunity to stress that. Linear probing creates bottlenecks in some situations (poor hash functions for example). That can be a problem. Quadratic probing, while more complex, does a bit better. It might be easier to implement than trying to guarantee better hashes over which the programmer may have less control. Even if that particular solution is never used by your students they will encounter such choices in the future. Help them get ready for it.

By pure serendipity, Eugene Wallingford's blog post just yesterday discusses a related topic. Blog: Jan22-2018, "Same Footage, Different Film"


What should be included in student portfolios for CS? Should CS students be keeping a portfolio, and if so, what should it look like? What would you, as a potential employer or college recruiter, like to see in/on a potential employee or student portfolio? Are there ways other than portfolios to showcase a student's work?

Many high schools, mine included, are encouraging, if not requiring, students to build an online portfolio showcasing their achievements and growth through their high school career - and not just in the arts. Many of the students at my school have built web sites for themselves using free services such as Weebly and are adding pages and tabs for every year and every class. Each page or tab displays work completed for the class (sometimes but not always their best) - an essay, a math test they did well on, etc. - with their reflections about what they learned, what they could've done better, how they worked in groups, etc.

What is the best platform for this showcase? Is Github good enough, or would you like to see something a little more formal, like a Weebly page (with embedded code or links to code)?

The answer is Yes, but be careful.

As far as employment goes, no recruiter is going to want to go through a student's completed homework.

Professional Portfolios do NOT include practice

However, these students are not professionals. Keeping a website to showcase their practice and skills is good. It's good practice.

When these students graduate, the skills they learned in developing a practice portfolio will help them build a professional portfolio.

To clarify: Professional Portfolios can still contain neat little projects, but they must be built with a use, or even as a proof-of-concept. Certain college projects may qualify here, but pretty much all coding homework will not.

Here are a few random tips:

Practice portfolios might help with college recruitment.
If a student really feels the need to include a practice portfolio as part of a professional resume or job application, make sure it is completely separate from real-world projects and labeled as practice.
Github is normally sufficient. Designers and those who are interested in visual careers would benefit greatly from a website portfolio with links to a Gitbhub (all programmers should demonstrate they can use source control, though).
Having a website portfolio is also a good place to show off soft skills in writing and communication.
Make sure to get good information to help the students. This is serious stuff. A bad portfolio is worse than no portfolio
Include the project and technical details for portfolio items. Don't include tests, reflections, or "what I could have done better". These become useless as soon as the student receives a final grade. You're goal is to prepare them for the real world, not make them type a lot of words no one will read.
Portfolios are for projects. Not classes. Relevant classes belong in a resume, in tiny font. No one is ever going read a paragraph about what the student "thought of the class", or even "what I learned". Portfolios are demonstrations, not promises.
The other answer by Buffy suggests it will be good for the school to showcase student work. Okay, cool, but forget about that. Portfolios are meant to help the students convey their skills to employers. They are not trophies, so don't give yourself a conflict of interest.
Similarly, the permanence of portfolios do not concern the school. You're not a portfolio factory. Keep example portfolios if you must, but ask the student and make a copy of it to demonstrate, privately, to future students.

I'm going to add to my answer, as you seem to have a lot of misconceptions about what a portfolio is.

A portfolio is a concise collection of tangible projects created by or in part by the author of the portfolio

Classes, tests, homework, personal reflections, etc do not belong in a portfolio. Not even a practice portfolio. Do NOT do this, please. This is the opposite of the real world.

No one wants to read about someone's entire educational experience. Ever. Not to say it isn't useful information, but that's what interviews are for. Interviews go over the candidates experiences.

Please remember that resumes are promises of your skills. Portfolios are demonstrations of skill. Interviews are insights into experiences and live demonstrations of skill.


Trying out the concepts of machine learning during teaching from home I came accross this handout of aiunplugged, specifically the topic of reinforcment learning (on page 12). I planned to do this boardgame, where students experience the concept of reinforcement learning. They play a simplefied (3x3 field) version of chess only with pawns. The goal of each player is to either reach one pawn to the side of the opponent, by capturing all of the figures (of the opponent) or blocking the opponent (no moves possoble for the opponent). One player is the machine and one is the human. The machine player has an additional sheet with possible moves based on the game state, which he/she first randomly chooses from. In the beginning the machine is losing a lot, however over time, when it starts to win, it will keep this move. Over time, when the bad moves of the machine are getting eliminated, the machine gets better, and after a while impossible to beat.
So now my question: Since teaching from home is still ongoing, is there any digital equivalent of this game or does anyone know anything similar, where students should experience machine learning in a simplified manner?
Thank you

While I don't know any digital equivalent of that particular game or neither I was introduced to RL this way either. But, still there are other games and videos that might help you to teach your students RL. Some of them were actually very useful when I was a beginner.

EVOLUTION (By Keiwan Donyagard)

It's a downloadable Android App based Game where the players create creatures with bones (represented with Black Stick), joints (represented with Red circle/spot) and Muscles (red , connecting the bones). The organisms starts hundreds of thread and learns to walk bit by bit and after each iteration by iteration, they become perfect learners after few minutes.
Link : https://play.google.com/store/apps/details?id=com.keiwando.Evolution&hl=en_US&gl=US

Flappy Bird Video (Uses a bit of Deep Learning Methods, an example of Deep RL)

https://www.youtube.com/watch?v=WSW-5m8lRMs

Google's DeepMind Playing Atari

https://www.youtube.com/watch?v=V1eYniJ0Rnk

There are some experiments where AI did outsmart their creators and performed unexpectedly well too.
Here are some videos:

https://www.youtube.com/watch?v=GdTBqBnqhaQ (By Two Minute Papers)

OpenAI Hide and Seek which actually breaks the game (https://www.youtube.com/watch?v=kopoLzvh5jY)

Motivation: Reinforcement Learning and Deep Reinforcement Learning is an important field of study in AI because it is a general way to Build an AGI and ASI. (AGIs called Artificial General Intelligence and ASIs are called Artificial Super Intelligence.) The core development and framework of such systems have already been put in form of AIXI and AIXI-tl and they would definitely change the way whole humanity looks at it. Some of the notable researchers claim that Artificial Super Intelligence would be the last ever the biggest invention of Humanity and the most terrifying thing is that we still don't have a proper framework and ethical standards set for use of such super intelligent systems (Superintelligence: Paths, Dangers, Strategies, Nick Bostrom.). While some theoretical paper do have measures of frameworks on dangers of such systems (https://arxiv.org/abs/1607.00913), but we still are far from specific idea about the matter. This is primarily because of lack of researchers here in this particular field. We hope more and more people join and contribute to the emergence, control and setup of ethical standards of such super intelligent Systems.


How to answer "functional programming is useless"? I'm a TA for several Bachelor level functional programming courses at my university. In every edition we have problems with some students that have the idea that functional programming is useless, because the industry doesn't use it. The more nuanced students add that some functional programming techniques are useful in any language (they think of lambda expressions in Java, map in Python, etc.) but that there is no point in learning pure functional programming as you cannot use it to build real-world applications (and if you can, nobody does it). These students usually tend to infect others and that can bring an unpleasant atmosphere.

I have read Hughes' 1990 paper Why Functional Programming Matters, where he explains that people in arguing for FP often tend to show what it doesn't have (assignment, side effects, ...) instead of what it does have. However, the things he mentions that FP does have (higher level of abstraction through gluing functions, lazy evaluation and thus easier modularity) are hard to grasp for mid-Bachelor students. In the end of the course they should be able to understand those advantages when you talk them through it, but the problem is motivating them from the start.

I know that most students will not end up as a functional programmer. But, learning one language means getting more proficient in others, and analogously for paradigms, so I think it is still helpful for them to study it. Yet when I explain this to the students the inevitable question is "why don't you teach us FP in a language that we can actually use later?".

What can I use to show the usefulness of functional programming?

Note: like many universities we don't use Haskell in all courses but a lesser known more academical functional programming language. This explains in part the complaints, however, we receive these complaints on Haskell courses as well.

What can I use to show the usefulness of functional programming?

This is the wrong question, and by trying to answer it you're falling into a trap of accepting and reinforcing the students' misunderstanding of what university is. If I had applied that standard of value to the courses in the bachelor's degree I studied, I think I would only have attended 30 hours of lectures over the three years.

You may be right that most of them will not end up earning their living by programming in functional languages, although given current industry trends I wouldn't be entirely surprised if you turn out to be wrong in the long term. But if their goal is merely to gain a superficial knowledge of whatever is currently popular in industry, they're not just in the wrong course: they're in the wrong institution, and should drop out and find a bootcamp.


Thoughts on language for Intro to Data Science? Next term, I'm going to teach an introductory Data Science class for the first time. In the past, others have taught it in either R or Python. My first inclination was to teach it in R because the language is specifically for statistics (and not a general programming language like Python). However, I see a lot of promise in Python's Pandas library. I haven't used Pandas myself, but I have more than enough time that I could familiarize myself with it.

What are your thoughts on R vs Python vs a bit of both?

Ultimately, the Data Science curriculum exposes students to both. Which do you think is more appropriate to begin?

Course details:

Prereqs include CS1 (C++) and Statistics
Topics include the analytics life cycle, data integration and
modeling, relational databases and SQL, text processing and sentiment
analysis, and data visualization. Emphasis is placed on reproducible
research, code sharing, version control, and communicating results to
a non-technical audience.
First of two DS classes as part of a DS certificate (Minor is <
Certificate is < Major) with predominantly Comp Sci and Stats majors
enrolled
I am currently teaching the Advanced DS class (the follow-up course)
with a concentration on R, but that could potentially change in the
future as well. Sooner or later, if they complete the certificate, they will get experience in both R and Python. The question is which comes first.
I can choose the textbook, but will give strong preference to free,
online resources

The biggest strength of R when it comes to Data Analysis is in its data visualization. As you've mentioned it is a more or less dedicated tool for statistical analysis.

The thing with Python is that you can easily go a bit off course with the lectures because for Statistical Analysis you'll have to understand, install and work with different libraries/APIs for plotting (matplotlib/pandas/plotly) and processing your data (scipy/pandas again/numpy). These may take different approaches for installing and working with besides being tools on their own.

RStudio already sets up everything for you for the most part so you can just focus on implementation; if you happen to need something extra installing packages from CRAN is incredibly easy letting you do it from the script itself rather than opening a terminal with conda or pip or whatever.

My notes:

If your interest is teaching more Data Science, as a tool in itself, go with R. It will let you focus more on concepts which are general.
If you're interested in teaching General Programming as a tool for Data Science and maybe other things, go with Python.
If you like both ideas, I'd start with R and replicate results with Python later to show its integration with different tools. This way your students will see both approaches are feasible in the case they go out there and see it in the job market.


Objects Lab Before Inheritance and Polymorphism I am finding it very difficult to create a lab for Objects in Java before we've involved Inheritance and Polymorphism.  The problem, as I see it, is that Inheritance and Polymorphism are basically the motivators for Objects in the first place.  As a result, the labs that I've created have all felt stodgy and artificial.

However, as an instructional reality, waiting until we have all three ideas in place in a high school environment simply means biting off too much material.   Are there other ways to think about creating labs for Objects that would support the early understandings required while still being meaningful?

Inheritance and Polymorphism are basically the motivators for Objects in the first place

I think this is where you're getting stuck. Neither of those are necessarily first-class motivators for Objects, but they are useful things you can do when you have objects.

Work-in-progress textbook chapter on OOP (aimed at students aged 16-18) and why we use it: https://en.wikibooks.org/wiki/A-level_Computing/AQA/Paper_1/Fundamentals_of_programming/Object-oriented_programming

Some alternatives:

"Object = Code + Data"

It's easy to show examples where global functions cause problems because they accidentally trample on each other's data (they're using the same data, but making assumptions about it)
...especially easy/fun to show how two unrelated functions can accidentally choose the same name for their variables (they're using different data, but happen to have chosen same name, e.g. "x" for x-co-ordinate, but also "x" for number-of-items-to-multiply)
Via encapsulation (and optionally: hiding) objects wipe-out many of these common, painful, frustrating bugs that beginner programmers often discover themselves when using global functions

"Object = aggregation of functions"

How do you organize your source code when you have more than a few dozen functions? Objects help enormously

"Object = classification of data" (Object as ADT)

How do you organize your data when you have three different meanings of "x-coordinate": Position, Velocity, and Acceleration? Objects make it easy to create ad-hoc, named, data-types that massively simplify this problem
i.e. Objects-as-Abstract-Datatype


Constructing a curriculum from multiple resources for complex subjects I was recently asked to teach someone OOP and C++, to a relatively advanced level in the former and an intermediate level in the latter.

After one half of a private lesson, it became clear that the student isn't good at learning in this way. Instead, I tried to give the student some links to explanations and examples (mainly so that the student could learn the remainder of that lesson's material).

That proved to be so effective.

For the next lesson, I won't "bother" with teaching the student. I've found a satisfactory collection of websites that cover the relevant material for the lesson, but I am at a loss on how to order them (and, indeed, the curriculum in the broader sense).

This made me think of the following:

There are probably many students that learn from websites and links etc. much more effectively, as opposed to learning in a classroom (mostly self-learners)

So my question is how can a teacher (or student) find resources that both cover the material, provide example and exercise and are ordered in synergy?

Specifically, OOP and C++ each have many subjects and points of interest that are built on one another. For complex subjects/paradigms, it is much harder to find fitting resources. So the methods (for constructing a curriculum built upon resources and websites as detailed above) I am looking for should be able to tackle such a complex combination, meant for less than 5 students.

At this scale (fewer than 5 students) lectures are a poor choice of educational methodology in any case. Lectures were created as a way to scale up education for the masses. They are driven by economic considerations, not educational ones.

What you have here is precisely the scale of an Oxford University Tutorial in which a few students meet a few times a week with an expert who guides them. Students prepare work in advance. The tutor comments and guides them. He/she can suggest readings, possibly different for each student, and sets new tasks or re-work on existing tasks.

You can also investigate Inquiry Based Learning (Thanks to User skull for proposing that idea in the classroom). This is essentially the same concept as the tutorial, and emphasizes Active Learning.

Thirdly, you also have precisely the scale for a small Agile Software Development team that could be set to a building task using one week iterations that also required that they learn about the language, process, and OO principles as they go. You become both the product customer and the learning Coach. When their code could be improved, show them how in your meetings and have them update it in the next "iteration". With this idea, perhaps combined with the tutorial idea, you can encourage them to teach one another so that not everything they learn comes from you. This can also take Active Learning to the "next level."

As an undergraduate in Maths (shortly after Plato's death), I had at least one course with such a small number of students. One of our tasks was to periodically prepare a topic for presentation to the rest of the class. This might also be possible. Their "lecture" might only require a few minutes and be accompanied by a Q/A session. You can do a wrap-up yourself. This technique can also, over time, helps students overcome their natural reluctance to perform publicly. Many of them will eventually go in to careers in which such performance can be a valuable skill, so you can advance their skill/knowledge on many fronts simultaneously. For some of the students you might need to review their mini-lecture prior to their presentation, both for content and for reassurance.

The real issue is that different people have different ways of learning. You already recognize that and have made adjustments for it, but you may be able to go farther.

I'm not sure that this scales to as many as ten students, however. But some of it might for relatively advanced (i.e. experienced) students.

For a more direct answer to your question (finding resources), you can have the students assist in this. Some sort of computer mediated communication (email list, wiki,...) can be used and students can contribute helpful resources to it. You can reward them for this, also. If it is something like a wiki, you also preserve the resources for the future. You also have a handy way to toss in resources as you come across them and students will have immediate access. Students can also, perhaps, comment on the helpfulness of their peer's contributions, aiding your eventual evaluations.


Using physical activity to explain the nested for loop I have been rewriting my unit on nested for loops for AP Computer Science (thus, we are using Java).  I would like to use some sort of physical activity to drive home the differences between roughly these three ideas:

Fully Un-nested

for (int i = 0; i < 10; i++) {
            // do something
}
for (int j = 0; j < 10; j++) {
            // do something
}
for (int k = 0; k < 10; k++) {
            // do something
}

Partially Nested

for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
        // do something
    }
    for (int k = 0; k < 10; k++) {
        // do something
    }
}

Fully Nested

for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
        for (int k = 0; k < 10; k++) {
            // do something
        }
    }
}

How can I get kids out of their seats for this one?

Your pupils are already be doing nested loops.

foreach week {
   foreach weekday{
      wake up
      clean teeth
      eat breakfast
      goto school
      foreach period{
         goto class
         do lesson
      }
      go home
      do evening stuff
   }
   do saterday stuff
   do sunday stuff
}

What about some formulaic music.

Music has a lot of repetition, could you get them to play some music based on a nested loop algorithm. I am thinking drumming on tables, and a lot of shouting.

e.g. something like

Repeat 4 times:

Teacher says: “say yo 3 times”.
Teacher says: “clap 4 times”
Teacher says: “…”

Sorting algorithms — dance, or just moving about.

Get pupils to act out sorting algorithms. And identify the loops.
Here is how to do it in the form of dance http://youtube.com/watch?v=lyZQPjUT5B4


How do you structure broad, open-ended, freely chosen projects so that students use class time wisely? If we are to believe Daniel Pink, autonomy is one of the fundamental aspects of motivation, so integrating student choice is extremely valuable if I want my students to remain highly engaged.

I have found that at certain times (such as after the AP test in AP Computer Science), it is very nice to allow students to choose a project in a very open-ended way.  Want to work in Unity?  Go for it.  Want to create an Android app?  Perfect.  Want to make an SMS-based game using Twilio?  No problems here.

If you also occasionally make room for highly open-ended projects like this, how do you ensure that the lab time is not wasted?  I will place my answer below, but I am extremely interested in how others do this.

The first step is for the students to design their own projects.  I give them a timeframe, and make clear that they will be held accountable (within reason) for finishing the project.  I don't just accept the project proposals blindly - there is a negotiation here.

There's an odd twist to this step, actually: I often have to persuade the students to lower their sights a little bit, because they often have a poor sense of how long their grand idea will actually take.

Any changes after my approval, however, must run through me.

Every other Monday, the students and I negotiate/create biweekly mini-milestones.  They know how many weeks they have to complete the entire project, and they then tell me what they feel they can get done within a week.  It has to be highly specific (so that it can be evaluated), and both the students and I must feel that it would mark sufficient progress towards their overall project goal.  (In my experience, I find that I simply accept their goals directly about 75% of the time, and in the remaining 25%, I have to steer students towards easier goals about as often as harder ones.)

When the actual evaluation takes place, if they have met the goal, then they only need to tell me what they intend to accomplish for the next week.  If they have not met their goal, then we have a more in-depth conversation to figure out how to recover so that the project still reaches completion.

That's the mechanics of it.  A few interesting takeaways:

One of the greatest joys of the entire enterprise is just getting a chance to ask them questions during the weekly check-ins.  I've personally never created a Chrome extention, a Unity game, a Flash game, or an iOS app, so getting to ask questions about the model code they've found, and the changes that they are making, teaches me quite a lot.
Using this structure, I don't have to weight the final project itself as heavily as you might think.  If the mini-milestones are well-formed, then the projects almost always come out very well.  In the few instances where it does not, the mini-milestone structure has ensured good work throughout, and there is typically some external factor that got in the way.  The grading seems to be more fair this way.


What thought process would lead one to invent object-oriented programming? A big part of understanding an idea deeply (such as a math theorem, for example) is being able to imagine a thought process which would lead one to invent or discover that idea. Michael Nielsen sometimes calls this "discovery fiction". The goal is not necessarily to understand the true history of how the idea was developed, as the true history might be unnecessarily complicated, and might involve many wrong turns before stumbling onto the right idea. Rather, the goal is to imagine a thought process that would lead someone naturally to the idea, in a way that seems almost obvious.

Question: What thought process would lead to the invention of object-oriented programming?

There are a number of different ideas that are all called OO.  I'm going to focus on the Simula-style OO.  Here's my fiction which I think isn't too far off from reality:

As computers became more powerful, the amount of entities in an model started to grow.  In addition, the different types of entities in these models was also increasing.  These models had the concept of the data for these entities which represented their state called 'structures'.  They also had the concept of behaviors that could be applied to these entities called 'methods'.

Because these entities were heterogeneous, the data in the structures wasn't always the same.  While all the entities might have some data elements such as a position in space, there were other data elements that were specific to some types of entities.  This presented a problem.  Some methods were common to entities such as movement.  But since the data structures had inconsistencies, making sure these common methods worked for all structures was difficult especially when a common method might need to work with properties that didn't exist on all entities.  Additionally, there were methods specific to entities and if a method used with an incompatible entity the results were unpredictable and possibly disastrous.  While careful programming could overcome these challenges, this was tedious error-prone work.  Productivity slowed dramatically as the complexity of the models increased.

What was needed was a way to organize the program in order to eliminate the need to manually keep track of all of these competing concerns.  The first idea was to classify these objects into hierarchies.  Then the methods wouldn't need to understand every different  kind of entity, they would only need to consider the classifications that were relevant to behavior and the structure of the data.

The next idea was to reorganize the methods so that they were aligned to the classes themselves.  This removed the need for lots of special cases inside of the methods for different classes.  The method was already specific to the class.  Within a hierarchy, a class could 'inherit' behavior from a more general class in it's hierarchy or 'override' the behavior to make it more specific to it's needs.  Note: inheritance was later determined to create more problems than it solved beyond very limited use.

These approaches resolved most of the problems with the complexity of these models.  Now the data structures could be modified for a given entity without having to consider the entire design.  New entities i.e. 'classes' could be added with relative ease.  OO would continue to be refined but these features established the core of the approach.


How to create webpage slides for teaching? I have PDF slides prepared in Latex.  I would like to have all of my slides in a website where students can find all learning materials, animations, examples, etc. Do you have any experience with creating HTML/CSS/other from slides? Is there any framework you would recommend?

Edit: I would like to write everything in HTML/CSS so I can add links and animations of algorithms in the future.

pandoc can convert slides written in markdown to a html presentation using reveal.js. pandoc can go markdown->latex (beamer) too. Not sure about going latex->reveal.js but it could be possible.


What is a (simple definition of) a development environment? I am trying to create lessons and curriculum designed for school-aged students, teaching about IDEs and development environments. What is a succinct, not too complex definition of a development environment? I want to explain the role of servers, databases, and other things that are required for an application to run, as well as the relationship an IDE has with the development environment, in the simplest way possible.  I saw a definition as a 'set of tools' but what are the tools that are included in an environment, and what purpose do each of these tools serve?

If you write software you necessarily have a development environment. It might help or hinder you as you work. A development environment consists of some set of tools that you use to develop the program. The tools might be integrated into a single framework (an IDE) or not, but you have some sort of environment.
The tools include at least

one or more editors to create files of various kinds, text and otherwise.

one or more compilers to translate your program files into machine code for one or more machine architectures

one or more run-time-environments in which you can execute your code, either on the target architecture or in a simulator

Additional tools that are usually needed are (not a complete list but will do for a start)

a test framework so that you can effectively write both unit tests (the code does what I think it does and doesn't break as I change things) and acceptance tests (the code does what the owner/customer really wants done - irrespective of my understanding).

automated error checkers to trace back exceptions and race conditions (among other issues)

a debugger that lets you interact directly with the target code as an aid in finding and repairing errors.

a design framework in which it is easy (or at least possible) to create design documents, which may be textual or graphical. They might be integrated with code generation or not.

a code repository and version control system so that old versions can be maintained and errors can be backed out of

a team-support system that helps a group of developers work on the same project. These tools may include simple communication tools (email...) or provide things like distributed pair programming.

a database system to hold necessary data used by the program. Sometimes a database is also used to store fragments of the program(s) themselves. The database might also contain required test data to assure the correct thing is built. Likewise it might contain information about the success or failure of test runs

a documentation system that can be used for either or both of program documentation of use by the team and user documentation that gives instructions to the end-user on effective use of the system

a way to make interaction with the file system easy and efficient, such as directory listings that let you easily open/save/close files

a way to maintain various "configuration files" so that the system can be tailored for its various uses

a way to keep all of the tools updated easily

automatic error checkers and style checkers beyond those provided by the compiler

For some kinds of software a sophisticated emulation environment to check the interaction of various components. Mobile apps often need servers and some way test the interactions, for example.

An Integrated Development Environment (say Eclipse or NetBeans) will integrate all of this into a single program that may use one or more multi-pane windows to provide a visual representation of all of the tools. A good one is tailorable by language and by need without cluttering up the workspace. A less integrated system (Emacs, say) provides all of these things through (possibly cryptic) user commands. An IDE requires a learning process itself, but it pays dividends if it is flexible and not restricted to a single language or architecture.
But even a simple text editor, a compiler, and a run-time for testing is a development environment and for many years was all that was available. Way back, the "text-editor" was just a card punch.

Note that not all files in a project are necessarily just text. Some projects require, for example, graphical files to show design.

I don't claim I have a complete list here. There are many other possibilities. Each person's development environment is personal. It is good if it makes them more productive and less frustrated. Is is subject to update and modification at any time that you learn of a new tool or technique.

Also note that not all of these are needed in every project and you don't need to be proficient in many of them to get started. But issues that arise as you work may help you see the need to expand your personal set.


How important is it that I know all of the words for the technical terms when mentoring in my second language? Every year for the past few years, I've been mentoring at Scratch Day, helping the kids with their projects during the course of the workshops. The problem? This takes place in my second language, which I don't use Scratch in. Since I don't regularly find myself using Scratch in that language, I don't really remember the words from year to year, and I'll find myself often going "the one under that one", or "the pink section", or of course "thingy".

Does this have a negative effect on the students if I'm not using the terms that they'll be using, because I don't know how to translate them exactly? Especially since for some of these kids, it's the first time they're using the platform.

The site itself and everything they're doing has the correct terms; it's just me stumbling giving them the wrong names.

Is this actively harmful, or just something that it'd be nice for me to work on, but not imperative?

Words matter. The problem is that the kids need to communicate the ideas to one another and to teachers, etc. They also need a way to integrate their Scratch experience into a larger programming set of ideas that they can carry with them.

It is good that you are trying to help, but you need to prepare yourself better first. Build a quick-look glossary for yourself that translates the terms in your native language into the one the kids are speaking. Scratch menus and documentation can help you do this, of course.

As you work, keep a few index cards and a pencil so that you can extend the vocabulary as needed. The glossary itself shouldn't require you to leave the Scratch environment for lookup. Paper is actually good for this - more index cards, perhaps.

Another trick you can use, perhaps, depending on the age of the kids, is to have them tell you the names of the terms when you stumble. Make a note of their answer (check its accuracy), and work hard not to stumble there again - more index cards.

Imperative? Probably yes. Or nearly so. But don't lose your enthusiasm for working with kids.

I'm a bit of an advocate for the use of index cards everywhere, by students and instructors. There is a description of the Hipster PDA in the answer to another question here.


Merits of teaching VCS as enrichment Senior students in the computer science major at my school work on a project which is supposed to be relatively big (i.e. just a graphic calculator isn't enough).

I was wondering (for next year; it's too late for this year) what might be gained if we teach the students about Version Control (probably git).

Naturally, this makes the project easier to track and has all the advantages that vcs offers. But given that these students aren't taught about correct\good design concepts and such, if we do attempt to teach about vcs, some students might be confused.

So, what advantages might teaching vcs to these students (so that they use it to organize their projects) have?

An option is to make the lesson optional (i.e. enrichment).

The advantages of using VCS from a content-creation point of view are already written about in depth, so I'm providing only arguments for why this is advantageous to you - regardless of how well they utilise it for their own workflow.

Lost work

If all students are committing their work to a repository you have access to, you will never need to worry about somebody losing their USB and with it - their entire coursework. If the work is stored in the repository, you always have something that can be salvaged for a hand-in, even at the last minute.

Reduced Plagiarism

When marking a single hand-in, you potentially have no history to work from. You are seeing the cleaned up, finished product and hoping that they came to those conclusions themselves. If on the other hand you have their work, as they make it, you can more easily identify "odd" commits where the quality of code has changed dramatically - it is much harder for a student to plagiarise, and much less likely that they will try.

Reduced Last Minute Sprints

As with the reduction in plagiarism, by having continuous check-ins of their work - you are encouraging them to work on their code throughout the term. Avoiding a last-minute sprint to get the hand-in ready is ideal, and not only will this help encourage them not to do that, it gives you a tool to check they are not getting into that situation before it's too late.

Debugging

When a student approaches you with "code that doesn't work", it can be hard to identify exactly what the cause is. Even if the problem that needs solved is clear - it can be hard to see how they got themselves into that mess. With VCS you now have a tool to check back, ask for their last working commit, and see what they changed/ask them why. It may be clearer why some bad choices were made based on what they already had.

As an aside: using VCS such as git does not mean the students need to know the VCS inside out. A simple cheat-sheet of how to commit, branch and pull is all they really need; anything else can be done with your individual help when needed. Teaching proper use of a VCS is not necessarily required to get a lot of its initial benefits.


Effectiveness of Parsons Problems I first heard of Parsons Problems thanks to CS Teaching Tips. They define these problems as follows:

  "Parsons problems are problems where students build programs from
  ordering small chunks of provided code."

An example can be found here.

When I research these, I see very little in terms of classroom resources. I find a handful of articles discussing them but not many examples of them in practice. On the surface, these problems -- emphasizing logic and structure separate from syntax -- could be a great activity at varying levels of experience and ability.

What skills or concepts have you used (or would you use) Parsons Problems to teach/reinforce?

I used a Parsons problem to teach functions. I used Google Slides to put different colored text boxes on one slide and gave the students instructions to arrange the text boxes in the proper order. A screenshot of what the activity looked like is below:

I wanted students to have experience with the ordering of function calls in C. There are technically two correct ways to approach this, but because I specify the requirement to use each block, there's only solution here:

Seeing how information gets passed from function to function and how to lay out the structure was helpful for students. Focusing on those skills outside of/separate from the syntax helped because students only had to worry about one thing at a time.

As I look ahead to next year, I want to do more of these problems, especially when teaching loops and sorting algorithms. They are quick and simple to make and differentiate instruction effectively. In the context of AP CSP, they provide great practice for the AP Exam which includes a number of code samples to read and understand.


Any simple Python GUI projects for beginner/novice programming students? I teach programming at a university, at 2 freshmen courses. My students are being introduced to programming for the first time, so we have to teach them about algorithms, variables, control flow, functions, arrays (lists), etc. So this course covers the very basics. And every single year I see the same outcome: they get confused, frustrated, and the common question of "what are these exercises for" always arises. We don't even cover OOP and don't teach anything GUI (only CLI programs, just for them to grasp problem solving and creating algorithms).

So this year I'm trying to take a different approach: I'd like to start my course by showing them how to build a GUI program, at first by just asking them to copy and paste, until they have a working program by the end of the first class. Of course they won't understand a thing at first. But if I show them all the topics "in action" then I can introduce them to the students during the course and review the project we made on our first class.

The thing is, I'm not exactly sure what to show them. I think something like a calculator would be far too simple and might not be too attractive to young, 18-year old students that own mobile devices and see all kinds of cool applications every day. But something like a minesweeper game might be just too big a project for me to show as an example on the first class, considering they will be watching me build a program and trying to mimic what I do without understanding yet, so if this part of my class lasts for too long it might bore them to death :P

I know my course doesn't cover GUI, but I've noticed young students are not familiar at all with command-line, so maybe I can just tell them there are things on the program I'm showcasing that they will learn in future courses. As long as they get to see examples of the more basic stuff.

So, any good suggestions?

In my experience, good introductory programming courses meet three overarching goals:

Empower students to create simple programs outside of the scope of the class by giving them the technical skills and the practice to begin being independent. This includes teaching the basics of one usable language.
Inspire students to continue learning and using their skills once the class ends (independently and/or by signing up for the next class in the sequence).
Prepare students for the next step in their learning. In many cases, this means that certain topics and concepts must be covered so that students can enter the next class at the correct level. It should also include giving students practice with the skills needed for basic independent learning including debugging, googling to find solutions to problems, and initial exposure to reading and utilizing documentation.

It sounds like you have seen issues with goal number two, where your students do not feel inspired. However, I am concerned that introducing your introductory students to GUI building right off the bat will jeopardize goal number one. GUI has a lot of overhead, and as you said, your students will not understand what they are doing and will be frustrated by their inability to build anything without heavy guidance/pre-built pieces.

My suggestion is to strike a middle balance. Have them build command line applications that they fully understand, but that are interesting or useful in some way. Better yet, give them some choice in which projects to tackle so that they are more invested.

Here are some neat things that students of mine have built in the command line without any OOP:

Guess the Number Game (the computer generates a number and tells the user if they are too high or too low)
Fortune Teller Games (using arrays and randomization)
Personality Quiz
Hangman Game
Random Name Generator
Text Based Adventure
Reverse Guess the Number Game (The user picks a number and the computer has to guess. This is a great jumping off point for first introducing the concept of an algorithm, since the program needs to make "smart" decisions.)
Minesweeper, battleship, connect four, etc. are great for 2D arrays/lists when you get there
Flash Card Application (students can even actually use this to study for tests for other classes!)
Calculator (if that's too easy, have it do harder math. Can your students build a calculator that solves algebraic equations? Can they make it take derivatives? Solve trig problems? You can apply it to whatever math they likely are learning at the time)
To do list manager
An application that manages a student roster or waitlist for a class

I hope these ideas help!


Do your students pay attention when you speak? I teach in a classroom where students sit at desks with dual monitors in front of them. The students face my desk at the front of the room, I cannot see their screens. Due to the height of the screens (set by our Accommodations staff) I can hardly see their faces when I am sitting down.

When I lecture, I use a projector to show one of my screens for programming examples, good links, videos, etc. I also project pages of the textbook and other printed materials. But I am not used to students sitting at desks with computers: when I was in school we didn't have them, and in college we had standard lecture rooms. There was nowhere else to look, really, except at the only moving thing in the room - the Instructor.

Often, when I talk, the students are looking down... At their notes? The book? Something else? I can hardly see them behind their screens anyway (must they be raised up all the way?) I try to present vital points on at least 3 different days, but sometimes nobody "gets it", or only one or two do. Is it my teaching, or their attention? Do you experience this also and if so, what do you do? I have trouble giving firm directives due to my personality tendencies.

Ask them to switch their screens off.

They don't like it if you do it too often or for too long but it's surprisingly effective, saves you having to repeat yourself unnecessarily and forces you to try to make your instructions clear and concise. If you can't see their screens you can always tell by the glare from their screens on their faces who hasn't followed instructions.


What to do when pupil destroy lab equipment? I am teaching robotics at something like an afterschool but is free for everyone aged 12-19 years.

The first problem I encountered was poor equipment and facilities, but I obtained some funds and I was able to buy laptops, new soldering irons, Arduino starter kits and more. I was reticent to put into use all at once and I opened up only one soldering iron to see how pupils would use it.

Of course, we have safety instructions which include rules like do not degrade lab equipment and I repeated rules but after a few weeks pupils started to play putting soldering tip to wet sponge so water boiled and sounded nice to them, and what disappointed me was some holes in the soldering iron plastic case.

I am the only teacher, I can't supervise all pupils at once and teaching here is consuming because everyone is at a different phase of constructing an electronic circuit for example.

I was thinking to track the usage of equipment and with the very first occasion to punish the children by calling home to his parents or even to exclude them, but this seems unfair since everyone could damage equipment intentionally.

What should I do to be able to have all of the equipment on the table but this kind of damage to not exist?

I don't care if damage occurs when equipment is operated wrong or damaged by mistake. I don't want pupils to think of equipment like toys and play with them damaging them and workspace.

Other cases of damage:
- Cutting wires with wirecutter even if they don't need it
- drilling holes in worktable with a drill bit
- melting plastic with the soldering iron tip

I know, partially it's my fault because I can't keep everyone at the same time captivated but damage should not occur.

Thank you for attention

How should I prevent damage to equipment?

Number each piece of equipment, assign each student (or each group of students) a number, and instruct students (or groups of students) to use only their numbered piece of equipment. Explain that each student (or group of students) is responsible for their piece of numbered equipment and they will face punishment if equipment is damaged.


What can CS educators do to help teachers of other subjects include computing in their teaching? In the UK we are also asked to include computing across the curriculum, in the same way that we are asked to include literacy and numeracy across the curriculum ( spelling, punctuation, grammar, reading, graphs, correct use of arithmetic and mathematical concepts).

Teachers often deal with this by doing a lesson in the computer room, using MS-Word; Using I-Pads, or searching for stuff with Google. This is the “we have to use a computer” panic. But it is not very educational

This has not always gone well: often a negative or neutral impact on computing, and if to much pressure is put on teachers to do this, then also a negative affect on the other subject as well. This is because most teachers are not computer science or IT teachers (I have heard some say “the pupils know more than I do”).

So what can be done in other subjects, not to just use computers or to try to give experience of computers to the pupils, but to teach an aspect of computer science or IT whilst still remaining within their subject's specialty. In particular, what can we do to help in this process? For example: how to aid with computational thinking in other disciplines. Can this be done in such a way as to also aid our own students?

Every field has its own key issues and methodologies. History and Literature, for example, are very different from Computer Science.

However, it is in the interest of those in other fields to promote computational thinking. It is a skill that their students need and it can be a tool in their own work. However, to do this two things are necessary:

First is to examine the current working practices in those other fields that use computational techniques in pursuit of their own goals. Literature, Science, Geography, History, Mathematics, the Social Sciences, all use computation for at least part of their normal work. This can be communicated to students and students can and should get practice in their use.
Second, and harder, is that it likely requires some collaboration, up to the level of team teaching, to bring good techniques to the fore for students. In other words, we in CS need to become servants to the other disciplines to help them deal with their own questions.

Computational Thinking is a big deal in the US now. It can start very early in a kid's life. Piaget and The Montessori method took a shot at this long ago, with success. But it needs to go beyond just math, into, say, Algorithmics and Big Data.


Peanut Butter and Jelly Ending Peanut Butter and Jelly Ending

I have a task that I started with a group of 4th-6th graders at the beginning of a short course on Artificial Intelligence.  In order to demonstrate how exact computers are about their instructions, I've created a strict syntax for a fictional robot and a series of environmental specifications.  The students must use the syntax provided (in something resembling an API) to generate commands that the Robot will ultimately use to create a Peanut Butter and Jelly Sandwich.*

I've also created a little engine that can run this all at the command prompt, and gives back useful errors if the students either generate a syntax error (ie. take rightHand plate instead of take plate rightHand) or attempts an illegal action (such as take plate rightHand when rightHand is already full).  I have not yet given them access to the engine; they spent the last 15 minutes of the previous period trying to generate a full set of working instructions from the specification, and they had a lot of fun doing it!

I have a vague notion about what will come next; I want to integrate allowing them to copy/paste their instructions into the engine to see if they have run into trouble, and creating an actual PB&J sandwich (or whatever components of that sandwich they've actually managed to make.)  I have already checked about allergies to peanuts, so we should be safe there.

What I don't quite see is how to integrate those two activities so that it won't get bogged down.  If I enact the PB&J creation faithfully, I won't be able to do it for every child.  If I ask them to create it, they might just change their commands as soon as they see an error, which would let everyone get a sandwich, but wouldn't be as fun.

The lesson has had a great start.  How can I finish it up to make it into a home run?

* - I know that folks in some countries don't eat Peanut Butter and Jelly sandwiches. That's fine as far as it goes, but please know that you are wrong.**

** - Unless of course you are allergic to peanuts.

I think the "peanut butter jelly sandwich challenge" is a great lesson in general, but it's especially great for computer science. Kudos.

That being said, I think you might be conflating two separate topics that are each worth their own lessons:

The exactness of syntax: take rightHand plate and take plate rightHand are two different things, and a computer might not be able to understand what you mean.
The exactness of semantics: take plate rightHand might sound like an obvious instruction to a human, but that's because we've had years of practice picking up plates with our hands. But a computer hasn't had that practice! What if it tries to pick up the plate with a fist? What if it tries to grab a plate by the middle instead of by the edge? So often our instructions to a computer have to be much more detailed than we first thought.

The "semantic exactness" part is the real beauty of the peanut butter jelly sandwich challenge, imho. One of the hardest things to do in computer science is take things that humans "just do" and break them down into individual steps. If they continue exploring CS, your students will eventually have to ask questions like "how would I sort a stack of index cards with numbers written on them?", and their initial reaction will be "I don't know, I just do it!". The peanut butter jelly sandwich challenge teaches them to dig a little deeper than that first reaction, and to start breaking things down into smaller steps.

And the fun part is that no matter how exact students make their instructions, you can always find a way to get it wrong.

Anyway, back to your actual question: I would propose a three-part lesson:

Step one: Have students come up with "programs" that they enter into your engine. This might be a homework assignment. This teaches them the "syntactic exactness" part, and gets them thinking about breaking things down into smaller steps.
Step two: In class, have students volunteer to read off their programs. You follow their instructions, pointing out as many inconsistensies as you want, in as messy a way as you want. After a few examples, take a step back and give them the lesson that even if your syntax is valid, sometimes your semantics can be unclear. Then maybe have them abandon your syntax and give you instructions in English, that way they can be more specific about each step. But like I said before, no matter how exact their instructions are, you can still find a way to get it wrong.
Step three: After a few rounds of this, have students break off into pairs: one student giving instructions, one following them and getting it wrong in the same way you did. Whether you give them real ingredients or tell them to pretend they have real ingredients is up to you and how much of a mess you want to clean up afterwards.


Introducing A* Search Algorithm I created a group lab where one student makes a random maze generator, one student makes a corresponding maze solver, and the last student calls the methods created by both students and creates an animated maze walker.  Currently, the students are told to use Prim's algorithm for maze generation, though I am open to any of these other algorithms as well:

Kruskal's
Recursive Backtracker
Aldous-Broder
Growing Tree
Hunt-and-Kill
Wilson's
Eller's
Cellular Automaton
Recursive Division
Sidewinder
Binary Tree

In practice, about 10% of students use other algorithms besides Prim's.

For the maze solver, I teach my students about breadth-first search, and for next year, I would like to expand this a bit and teach them about depth-first search as well.  However, I would also like to give them a real shot at A*, since it is a much, much better algorithm.

What I am looking for is how to get them to see the difficult piece of A*: how a heuristic concretely fits within the algorithm and gets us to a solution.  My target is for 25% of the students to choose to use A* next year.  I don't care which heuristics we use, but I would like them to see something that they can understand quite concretely (as I believe firmly in engendering concrete understandings before abstract understandings) and I would like them to understand the difference between an admissible and an inadmissible heuristic.

For context, I do this all during my AP Computer Science class, so it is in Java, however the question is really about A*, so I am not adding those tags in.

Edit

Mike Zamansky posted a response to this question on his incredible blog and it knocked my socks off! I'm going to integrate a lot of his approach into my own next year.  I would accept his answer, but it's not on this site, so the best I can do from here is link to it.

I usually teach Uniform Cost Search (UCS) before A*, since it is basicaly A* without the heuristic (and it reduces to BFS when all costs = 1, so it is pretty straightforward to explain). Then I teach A* and show them animated examples of the explored nodes in comparison to UCS (here you can find excellent interactive examples).

In this step, one analogy I like to use is about mazes: Imagine yourself inside a maze from which you must find the exit, but you have no idea where it is. This is UCS. Now imagine there is no ceiling in the maze (like the Harry Potter one), and there is a tower in the exit which can be seen from anywhere in the maze. Now you can make more informed decisions in your search, biasing choices in that direction. This is A*.


A meaningful exercise that requires using a destructor I am teaching destructors in C++ and would like to give the students an interesting homework exercise that requires them to build a class with destructor.

In previous years, the homework were something like "write a linked list, but do not use the classes in the STL". I do not like this - I tell my students that they can use whatever feature of the language that they want, even if we did not learn it in class yet.

The problem is, for every other exercise that I could think of (e.g, tree, graph, etc.) I could easily think of a solution using STL features, that does not require any destructor.

What is an interesting exercise where destructors are really needed?

Create an object that creates a new file and writes in to it over several method invocations (not just one). Assure that the object has been deleted before continuing (Make the object go out of scope on the stack or delete a reference and let the reference go out of scope.) You need to assure that he file was closed. The destructor is the proper place to assure that this happens.

To verify that it works correctly, create a different object that reads from the file. If the first object didn't properly close the file this won't be possible.

In some, at least, operating systems you don't even need the second part. The file won't appear in the file system if it was never closed.

The reason for wanting the file written over several invocations of some method(s) is that, if it is just one, an explicit close would be natural in that method. The reason for wanting any references to go out of scope is to assure you that the first object has no effect on the second.

Edited for clarification.


How to explain combinatorical principles like the rule of product to students who "just don't get it"? I assist in courses that provide mathematical background to computing science students. Every year, there are some who "just don't get" (in their words) concepts like the rule of product or the corollary that there are $p^n$ options to choose $n$ times from $p$ options (e.g. colouring $n$ fields with $p$ colours, no restrictions). Are there some metaphors from programming that may help these students?

Yes, there are. For the rule of product, one can use nested for loops. For example, when one has to choose from 5 pairs of jeans and 7 shirts, you could use a loop like the following to list all the options:

for (Jeans j : jeans) {
    for (Shirt s : shirt) {
        print(j, s);
    }
}

You can then ask how often the inner loop loops and how often the outer one loops. The student then usually understands he should multiply to get the total number of printed pairs.

I do not know of a programming analogy for the power case (ideas welcome), but as this is an extension of the rule of product it is usually explained rather easily: the $n=2$ case relates to the for loops above, so we would have $p\cdot p$. For $n=3$, we would add another loop, hence $p\cdot p\cdot p$. For $n=4$, we would get $p^4$, etc.


Basic OOP practice exercises for inheritance and polymorphism After teaching inheritance and implementation (implements vs extends in Java) and overriding methods and basic OOP (classes and interfaces), as well as polymorphism (up/downcasting) I want to give the students some exercises to practice this.

Currently, I have the famous Animal -> Mammal example, as well as Human -> Teacher, Human -> Student.

I am trying to think of new examples and exercises to practice the subjects mentioned. To give a better notion of what I'm looking for, the Animal exercise looks like this:

public abstract class Animal implements AnimalActions {
    private String name, family;
    private double weight;

    public Animal(String name, String family, double weight) {
        this.name = name;
        this.family = family;
        this.weight = weight;
    }
}

interface AnimalActions {
    public void eat();

    public void sleep();

    public void makeSound();
}

And then:

public class Mammal extends Animal {
    public Mammal(String name, String family, double weight) {
        super(name, family, weight);
    }

    @Override
    public void eat() {

    }

    @Override
    public void sleep() {

    }

    @Override
    public void makeSound() {

    }
}

This covers many things and is useful for teaching. However, this doesn't go very far if I make it into a practice exercise. What exercises do others give students in this subject?

The students are in high school.

You could have a hierarchy based on an abstract class or interface Car, with implementations/subclasses for ElectricCar, HybridCar, GasBurningCar, etc. This illustrates that there can be very different implementations for an interface.

Each class would have different additional members. For example, a GasBurningCar could have a maximum amount of gas (in gallons or liters), represented as an int or double, or it could have a field of type GasTank. Having members gives students practice with has-a relationships, in addition to is-a relationships.

You could discuss trade-offs in whether an individual car model, such as Prius, should be an instance of HybridCar or a subclass.


Intensive basic VBA course - which variables to teach? Which variable types are the bare minimum to teach non-programmers who want to be able to create and modify simple VBA (MS Office) macros?

I start by showing them the concept of variables through using an Excel cell as a temporary storage, then using undefined variables, then show them a simple Dim SummedValue with no type declaration. Then comes the types, and I always struggle.

String, Integer, Boolean, Double seem the most important, but maybe Long(integer) is better, or just Double is enough for all the numbers? Also, Object variables are important too with the Set statement. I don't bother showing them arrays variables. Or am I better of telling them to use Variant for everything?

They will be making simple macros for themselves, maybe a few colleagues. Usually start off from a recorded code. They should be able to read and comprehend other's macros too.

Context:

I regularly hold intensive company VBA trainings. These are typically 2 day long trainings (yes, I know, totally not optimal, but I can rarely make the organizing HR understand this). So, 2 days Beginner Training, where I teach them the basics from macro recording through modifying the existing code to the IF statement. Then in a few weeks it is followed by a 2 days long Intermediate Training. This is where I teach them the variables and loops - and make them practice a lot.

As you are teaching business people, not computer scientists (though what I say may also be true for teaching them). I would start on the more practical.

Teach them stuff that is useful. Date, Currency (Don't use float types for currency, it will cost you your job, and someone a lot of money), Decimal (A float type with base 10 radix: it has less unexpected behaviour), and string.

Integer has some value, but manly for performance. If when doing loops you use foreach, then integers are not needed. Also looping is simpler and safer.

Booleans are only needed when doing conditionals, and conditionals are over used.

In addition:

Static or dynamic

If you teach not to declare types first, then that is what you will get.

Assignments

We often teach assignment early, this is crazy. In structure and interpretation of computer programming, they covered almost everything I know, and then started to apologise, because they were about to introduce assignment (mutation). As soon as you introduce assignment, you make is very hard to reason about how a program works.

I have taught types when teaching functions. Functions take values (of a type), and return values (of a type). This in some ways looks like assignment, but is not. It is safer, and makes code easier to understand.


Principles of SOLID in OOP I am trying to prepare lessons about the five SOLID principles of Object Oriented Programming to high school students that have learned about polymorphism, abstract classes and interfaces.

However, I'm not sure how to properly explains the O (Open/close).

I cannot find a satisfactory explanation as to why it's ideal or important to write software (or APIs) that is open for extension and closed for modification.

As an analogy, I was thinking about a model of a house in a city. The municipality provides a list of things that have to be, and cannot be changed, but each household can paint their house or make small changes in some things. I feel this analogy doesn't explain the principal in the right way.

What other analogies can I use to explain Open/Close?

The primary drive behind the open/close principle was to avoid having to update programs that used a library when changes were made to that library. Or, in other words, to enforce backward compatibility for old programs that used a library.

By not modifying the object (the close half) any code that uses the object according to the documented API, will always work.

By allowing extension of the object (the open half) new features, data, methods, etc., can be added to the functionality of the object to handle new uses for the object, or its subclasses.

Combining both means that the existing object, that almost fits the needs, can be enhanced to be useful in a new program, and still be used by the old programs, without needing to recode the old programs.

A common API that most high school students are familiar with is the telephone. It is going to be a very rare high school student who has never used a push-button telephone, including the "buttons" on the screen of a smart phone. So it is something that's well within the prior experience for those students.

The twelve standard buttons on the push-button telephone haven't been changed since the Western Electric model 2500 was introduced in 1968. The latest model smart phone still uses the same layout, and it still works the same (from the user's perspective), even if it's now a touch-sensitive screen rather than twelve physical buttons. They way on made a phone call in 1968 using a push-button phone, and they way one makes a phone call now with a smart phone is the same. It has not been modified. What you can do with those same twelve buttons, or simulated buttons on the smart phone, has been greatly extended. Sending text messages is only one change of many. There's no guessing what else those buttons might be extended to do, using new methods or new data. No matter what new extensions are added, the original will not be modified.


Classification of programming exercises I wondered what attempts were made to classify programming exercises for students in their learning path, just like taxonomy in biology.
For example :

A "concept covered" criteria from generic to specific:

At level 1, we have "general" concepts : Iteration, Recursion, Abstract Data Type, Conditionals, etc.
At level 2, we have "less-general" concepts : For Loop, tail recursion , List, Ternary operator
...

A "difficulty" criteria such as easy, intermediate, hard.

According to my research on many search engines like the dblp computer science bibliography, the only one that is much mentioned is Bloom's Taxonomy.

What are other classifications, besides that one?

In one sense this is hopeless as you probably can't come up with a classification that everyone would agree with. On the other hand, it is certainly possible for you to come up with a classification that is useful to you and to other people who think and teach like you do.

However, the real problem is that "what is elementary" is bound up with teaching methodology and how an instructor chooses to create and deliver a course. The danger is that people will start to think that you need to teach what a taxonomy calls elementary first. That may not be the best course. It implies that one can only learn computing from the lowest level (say, C) to higher levels (say, Scheme) and that is known to be false.

But if you are willing to match a taxonomy to a pedagogical system and deep ideas about the way that people learn, then it might be possible, even useful to do so, but, I think, it would only be valid for that system and possibly invalid for others. Just for example, tail recursion is pretty elementary if you are learning Scheme as a first language.

But there is also a larger issue of program structure - what you imagine the nature of computation to be. These are even more "elementary", in a certain sense, than the things you list. For example, structured programming and object oriented programming (to name just two paradigms) have very different ideas about the nature of computation, but those underlying ideas are usually implemented with the simple tools you mention (among others, which are missing).

In fact, using modern programming tools, it is possible to create an environment in which the student learns to program, where the environment itself defines all of the primitives, both values and actions. These environments are normally called simulations and they can be very sophisticated - Turing Complete, in fact. Any "model" of computation can be simulated this way. I point you to Greenfoot, for example, and it's companion teacher's site the Greenroom. The latter has a large number of such simulated programming "worlds" that can be adapted to teaching novices.

I don't mean to discourage you, but ask you to consider that the problem is bigger than you imagine and your "solution" might only apply to a small part of the whole landscape.