Is it worth it for high school teachers to join SIGCSE? I just saw this question about SIGCSE for college professors, and it made me curious about whether it is a good organization for high school teachers.  I am currently a member of my local CSTA, which I find to be of some value.  Are there additional benefits from SIGCSE that could help me in my classroom practice?

(Note: I would love to hear from current or past members of the organization, but please avoid ad copy and the like. This is not intended as a promotional question.)

Yes! (with some qualifications.)

Benefits (most apply to conference attendance):

connections with other teachers to share ideas and experience
research results on CS teaching practices/methods
TIME away from class to reflect and plan
broader perspective on new/existing computing curricula

(especially honest feedback on others' experience with CS material/curricula)

perspective on what is out there for your students in computing careers and in college
information-dense listserv (you hear about sites like this one)

However, most of the sessions/listserv posts are still geared toward research on college classes, so you have to be picky about sessions at the conference. There is a K-12 track for sessions, which makes things easier.

There are more K-12 sessions every year, and more K-12 educators attending as well. This year my district (Chicago Public Schools) had 20 people attend, and there were a good number of other (mostly high school) teachers from other districts. Two of this year's keynotes (Gail Chapman and Mitch Resnick) were people whose main impact has been in the K-12 space, and next year's theme is CS for All, so they really recognize the importance of what is happening in high school and earlier grades.


How to make project in java language, for students who doesn't know java? In CS I have been taught other programming languages than java. Now in final year project they are demanding project in java. So is there an easy technique to learn java fast?

There is a Pedagogical Pattern called Fixer Upper that can be used for this purpose.

Prepare a fairly large Java program that includes the features you want them to use. In this case it would probably be best if they know how to write that program in their "native" programming language: a familiar seeming project.

Then insert several errors into the program of various kinds. Some of them just simple syntax errors but some of them more complex, even some that break the program so that it doesn't quite solve the problem correctly.

Give them an assignment to fix the program.

If you combine this with unit testing, which they may already know, it will give them some additional practice and skill. If you want them to do the fix-up especially fast, make it a pair-programming exercise.

I normally use this sort of thing as a quick start for a new programming language or even for complete novice programmers.

Make sure that the overall structure of your program is very good. If it isn't, then they will learn the wrong lessons. Start with a structure that you want them to emulate.

A variation on this is to take such a program and go through it in lab rather than making it homework.

Note that reading a large program is insufficiently "active" to achieve the desired outcomes. Having to repair it will engage the students more deeply into both the problem and the language.

My ideal program for this would be several pages long and would include several classes. It would use a variety of design techniques, including a few design patterns. It would favor composition over inheritance as the mechanism for variability. It would define structure with interfaces.

A major variation of this is that the fixer-upper program could, itself, form the core of the project the students will do. Now the students are truly engaged from the start.


Ideas for introducing databases to Android development students I teach an Android development course to students who have had two full years of Java experience - including a year of data structures.  In the past, my students have used services such as Firebase, Parse, and Couchbase to store their data.

Recently, I've had some experience with Cupboard for Android (https://bitbucket.org/littlerobots/cupboard) which maps Java classes to database tables and maps Java class member variables to the table columns.  Cupboard allowed me to create, modify, delete, and query my SQLite database using instantiated objects instead of writing SQL every time.

Now I have a new interest in learning SQLite and in turn teaching it to my students.  I am looking for recommendations of resources for an intro unit on SQLite.

SQlite is small and as the name suggest "lite" is great for storing data for mobile applications. Apart from that It can easily be used for other small scale web applications without hiccups (100k or more rows).

Resources

The official guide is great. Also checkout the reference of the sqlite package once you are comfortable with using SQlite.
Here's a tutorial that provides step-by-step guide.
Also the sqlite page have some docs for Android Bindings.

That said, SQlite is one of the most tested(tests are larger than code itself) and have a brilliant code base which makes it very suitable for mobile applications.


Going from syntax to CS concepts I am going to be teaching a small-ish group of people to write code to control a device. The code is built around a giant framework made to make it easy to write the actual code. My job nominally is to teach the students how to make the device do things, so I have to begin with the syntax to control the device. This would look like:

leftArm.setPower(10);
while (gamepad1.buttonA.pressed) {
  leftArm.setPower(20);
}
if (time.seconds == 30) {
  logger.log("There are 30 seconds elapsed");
}

I will have to start with a list of the methods on the objects that are exposed (e.g. leftArm, time, logger, gamepad1) and how to use them, and cover basic if statements and loops.

From there, I'd like to expand their knowledge of computer science concepts while still relating it back to this device. I thought about beginning to explain the framework it's built in, but I started looking at it and it was far to complex to introduce at this point.

So, how can I take students from this simple understanding of syntax and methods and give them a base of solid, cross-language, CS knowledge?

tl;dr Make the mapping between the software and the hardware explicit at the start and then show the code, rather than the other way round. Draw pictures. Give them a mental overall image, not just detail. Detail with no context is hard to follow, and hard to learn.

In many ways this question is like another here in that you have a complex system that must be taught all at once. See the answers to that one, including mine.

A useful strategy for this would be to turn it around a bit and start out by saying that the code they are about to see is a model of the physical device. The parts of the model match the parts of the device. The robot has two arms and so its model has two "Arm objects". Objects in the model need a description and the description (in Java) is provided by a class: RobotArm.

The physical robot's parts have functionality of various kinds and these are modeled in the RobotArm class with methods: move, etc. Once we have the class (at least in skeleton form) we can instantiate it: new RobotArm().

The Robot class itself is built by composition (arm fields: Robot.leftArm...

So what you do is make a mapping between the code and the physical thing and point out that (as I assume is true of the code) the mapping is pretty direct. This is actually pretty faithful to the idea of OOP, in fact. Modeling is a good first metaphor for OO programming.

At this point you can show them some code, but I'd show it heavily ellipsed, with only the detail needed shown in full. In other words, only show some of the methods and maybe only parts of some methods.

So the code you show above in your Question doesn't come first, but only now after they have seen the map, even if the map is incomplete. The class is an abstract description of the physical thing and the code completes the description. When you show methods, don't make them naked (as if this were just C coding), but show them as part of their class.

I've assumed that the robot itself is an actual object in your framework. It is possible that it isn't, if there is only one. The robot "object" may be implicit. Or possibly your code (above) is really part of a method of the Robot class so you wrote leftArm... rather than this.leftArm...

Note that if the "Robot" were not a physical device, but a screen simulation instead, the same ideas as above work well.

Another way to put all of this is that you do the integration step for them and present that, rather than depending on each student to integrate the detail into a consistent whole and all in the same way.

So, you introduce three big ideas (Class, object, method) and show how they relate to each other and to the physical thing. There are a few smaller ideas also (instantiate, part-whole composition), of course that you incorporate into your lecture. It should only take 15-20 minutes to do this at a high level.


Lesson plan for teaching java graphics Background:
This lesson should give a firm foundation for graphics in Swing in java to students in high school who know OOP in java (extends, implements and abstract, as well as composition). They are in the school's CS major. This year they need to create a project which is a part of their final grade in the CS major, and part of the requirements are a visible GUI. As of such, a lesson plan was created to teach them one of the ways of making GUI in java. However, this lesson doesn't teach what goes on in the background of java GUI. (unintended pun)
What I have:
Currently the lesson plan is as follows:
Purpose: To teach the basics of creating GUI in java, for the students' final project.
Needed knowledge: Object Oriented Programming, as taught in previous grade (In the previous grade they were taught the concepts listed in the Background section)
Needed materials: Computers, preferably one per student (Students can bring their laptops), Internet connection.
Procedure:

Explain the basic objects inside the Swing library: JFrame, JPanel etc.

Explain the Container object in AWT, and elaborate on how Swing is heavily dependent on AWT. All* objects in Swing are children of objects in AWT. Also explain the Component class object.

Show that Container essentially contains (hence the fancy name) other Components and that creates a GUI.

Show the students a simple GUI for a chat application (no server-client, just the gui!) which composes of a JButton, JTextField (for entering messages), JTextPane (chat history) and JLabel. This step includes showing them the code.

let them work for the remaining time (45 mins plus 45-time_it_took_to_get_to_this_step) on creating a gui of their own, of their choosing, which can have any Swing object they find. The GUI must have JLabel, JButton and JTextField. Other than that, go wild.

My problem:
This lesson shows absolutely nothing about what Java does in the background for the GUI. I am talking about the intensive OOP the goes on in the JFrame class, and the incredible flexibility with everything extending JContainer (allows JButton, JLabel and many others to be treated almost identically).
How could I extends one (or more) of the above steps, or possibly add a new one, that will teach these parts of java GUI? I find that these parts are important for anyone who wants to make Java GUI. Would simply saying what I have written in the previous paragraph be enough?

*Haven't checked, but never seen one that isn't.

You could extend (heh) your lesson to include custom painting.

Basically, you do this by extending JComponent or JPanel and overriding the paintComponent() function. This is how "real" Swing components draw themselves, and it gives students a window into how everything works behind the scenes. You could have them draw  basic scenes, animations, or even games. Or you could have them create custom components like circular buttons (disclaimer: I wrote this example).

If you have enough time, you might want to split this into multiple lessons: start with basic Swing, then do a lesson on input listeners, then do a lesson on custom painting. At the end of those lessons they'll have enough knowledge to create some pretty fun programs.

I'd also urge you to stick with functional GUIs instead of using a non-functional chat application. Make a fun calculator that does something like convert dog years, or create a basic game that plays rock-paper-scissors. Encourage students to make these as interesting as possible. IMHO this is much more engaging than a non-functional example gui.


How do you encourage students to take criticism of their code constructively? How do you encourage students to benefit from code reviews you give them, rather than being discouraged or responding defensively?

Here a few techniques I use in my class when giving feedback on student code:

Use a rubric. CS50 has a clear grading approach: code is assessed along the four axes of scope, correctness, design, and style. Within style for example, I might focus particularly on readability vis-à-vis indentation. If a student is marked down on this item, she knows exactly what she missed and why she may have lost points. The clearer the criteria of evaluation, the better the student response to being assessed on said criteria. I also think it's valuable to share rubrics in advance. Only seeing it after the fact can make students feel like how they were being graded was being kept a secret, which can lead to resentment of feedback.
Avoid "you" statements. This is something I caught myself doing and tried to correct as the year went on. Let's say I'm reviewing a student's code, and I'm commenting on the naming of variables. I might be tempted to say, "You have unclear variable names here." That frames it as an assessment of the student, not of the code, which does not set the right dynamic. I try to make sure I say something like this now: "Your program has unclear variable names here" or "to improve your code, make your program's variable names more precise." The goal is give feedback on the code, not the coder, so language should reflect that focus. (Side note: with how personally code reviews can be taken, I think how we frame the language of assessment is essential to building proper classroom culture when it comes to grades and feedback.)
Reward revision. This one is possibly more applicable at the high school level, but I think it does matter in terms of building a culture of receptiveness to code review feedback. Allowing students to revise their work gave me the ability to see students improve their work based on my commentary. In my mind this is what education is all about: inspiring a continual learning process. The pragmatics will vary from context to context, but requiring some sort of revision or reflection or allowing students to "recover" some/all lost points communicates to them that at the end of the day, you want them to be better programmers. Grades take a backseat to learning. Again, this might make less sense for university students, but in my class this approach goes a long way in terms of students constantly working on improving their craft.


How should the paradigm shift associated with functional programming be approached? As a student primarily experienced with imperative and object-oriented languages, my first few hours learning Haskell at university were a bit of a struggle. There's a real shift involved in terms of how you approach problem solving and concepts like pure functions, side effects, currying, higher order functions etc. were very new to me and took me a while to properly grasp and begin using.

I did eventually get the hang of it, and now happily write production code in Scala that uses a lot of these techniques. I think it can result in incredibly elegant code.

But I'm curious: is there is a way to make the initial struggle easier? I've seen some suggestions that students should start with a functional language - but I don't think it's reasonable to assume all of the students won't have prior knowledge of working in an imperative language.

Any true paradigm shift requires literally re-wiring the brain. Thinking functionally is not the same as thinking procedurally (for example). The neural pathways of the brain need to be connected appropriately for the new paradigm to become natural. When you were a kid you were, if typical, used to walking and running. Then you probably got a bicycle (or a skateboard if you are young enough). You tried, you fell down, you tried again. Your brain got used to the subtle balancing required. Swimming - same deal. Differentiation - same deal. Haskell - same deal.

As an instructor, the above implies that you should provide guided practice at the beginning - a skateboard park for the mind. If your students solve a lot of simple problems (not syntactical, but logical) they will skin their knees on these but if they are well chosen will get the skills. In scheme, reversing a list with only head and tail is simple enough. Doing it in linear time takes a bit more skill, but the technique is both cool and satisfying. Writing the code wires the brain. And, like riding a bicycle, it is hard to un-learn it once you get it, since the brain is now different.

So, make it possible for the students to fall a lot, but to get up without getting discouraged.

To add a bit of specificity to this. Assuming you know the paradigm well yourself, what are its 100 most important techniques? Can you come up with a 10-30 minute exercise for each of them? Try to have each exercise focus on just one thing (mostly anyway). These are your Etudes. Can you come up with 10 exercises for each of the 100 techniques, even if they vary only slightly?

Acknowledgement: At SIGCSE 2004, Owen Astrachan (of Duke) convinced Microsoft Research, through Jane Prey, to give every attendee the book The Art of Changing the Brain by James E Zull.


Is it more effective to teach low level languages before high level ones or vice versa? When structuring a Computer Science curriculum, which prepares students most effectively for a career in technology today? Consider the following scenarios over a student's college career:

Starting with low level languages like ASM and C, working toward higher level (i.e. more forgiving) languages like Java, Python, etc.
Starting with higher level languages and then diving deeper into lower level ones.

Well, straight-forward: It depends:

If the low level language you are thinking about teaching has complex code paradigms and is very abstract, then teaching it first would not be a good idea.
However, if your low level language is one that caused newer, high level language to be created, then teaching the low level language can aid the students in understanding some core concepts of the newer language. They might be able to spot those concepts in other languages, too (making a sentence like "oh, just like in <insert low level name here>!" quite common)

Personally, if I faced a low level language like the one described in 2, I would only teach a few things. The students needn't be "fluent" in the low level language, as it isn't widely used in the "career market". I am not quite sure how widely C is used, but I am pretty sure that it is used less than C# or java (and certainly less than python).

So in essence, knowing the main ideas of the low level languages can be useful, but it is less important and useful than knowing high level languages.

As for a foundation for building knowledge, it goes back to teaching the main ideas of low level languages (rather than teaching the entire language), and then teaching the high level languages.


Process Scheduling is not "Process" Scheduling - Should I disclose it to students? I have been teaching Operating Systems basics in a class and after Processes, Child Processes and Threads, we have managed to move to "Process Scheduling"

Now, ironically, as we know that it is not the Process which is scheduled, but the threads precisely (we are following Linux Ubuntu there).

Here is what Silberchatz book (by the way, the title of the chapter is also "Process Scheduling") says about it:

  In Chapter 4, we introduced threads to the process model. On operating
  systems that support them., it is kernel-level threads-not processes-that are
  in fact being scheduled by the operating system. However, the terms process
  scheduling and thread scheduling are often used interchangeably.

(Silberschatz, Operating System Concepts, 8th Edition)

Although, I have taught them the respective algorithms; should I bring this discussion within the class and press the panic button by telling that its not the Processes which are scheduled but Threads? This question has been in my mind since long time and I couldn't look for a better place to get an answer than here.

Perhaps I'm just naive, but I don't see a dilemma here. Yes, teach them the current state of the art if that is appropriate in your course. Teach them some important historical precedents at some appropriate level of detail. In this case you shouldn't be teaching one edition of a book or one version of a particular OS. If the students are to have a future in the field they will still be working in 30-40 or more years. What they need is the background and skill to keep up with technological changes as they occur.

You already say that you teach them the various scheduling algorithms for associating a software element with hardware. That is more essential than the specific granularity of the elements on either side of the equation. Even the standards of what constitutes efficiency may change over time. Teach them the principles, for which some blend of the old and the new is likely required. This will serve them well in matters other than Operating Systems proper.

You should also look at a more recent edition of your text and at other books. This will help you get a handle on what the authors currently consider to be important. Tannenbaum, for example, would be a good supplement to Silberschatz et al.


Python IDE for beginners With a bunch of colleagues we will start learning Python together. I'm a programmer, but I'm new to python. Most of my colleagues know some VBA, but are generally new to programming.

What IDE do you suggests? Features I'm looking for: simple interface, some debugging features, autocomplete, inline help, intlisense.

Thonny IDE looks promising, super simple to install with bundled Python interpreter, it does have autocomplete, but is nowhere near Visual Studio levels of inline help (like intellisense or pupup tooltips etc.).

Any recommendations?

I'm not a fan of full IDEs for beginners. A few years ago I switched my first year students (Java) from NetBeans to an online tool without any autocomplete or helpers for most assignments and found that they've gotten way stronger at writing code. I think the automatic stuff that helps out while programming becomes a crutch for newbies.

Our intro teacher, who teaches Python, really likes Idle for his first year students because it's so simple.

I've also used PyCharm with second and third year students, and really like it. It's what I personally use when I'm writing Python code. The free community edition is plenty for classroom use, but they've also got free licenses for students, teachers and classroom labs if you wanted to use the pro version.

  a lot of their mistakes are because the tool told them to

So much this. When NetBeans highlights something in yellow, students feel that they have to click on it and follow the programs advice even when they have no clue what it's saying.


What are some good problems which can be solved with a queue? I am trying to introduce the idea of stacks and queues in a course on data structures.

For stacks, my idea was to show some interesting examples of problems, like evaluating an expression in RPN, or checking whether a bracket sequence is well bracketed.

What would be a good example of a few problems where queues are the canonical objects to use?

One example I could think of is Breadth First Search. But what else? Ideally, I would like some simpler problems which can be presented with even lesser background.

One example I've used for students in the past is a shared printer.

If I have five people using a printer all at once I will have a problem if two of the five attempt to print at the same time.  What can I do?  I can put up a sign on the printer--"Only One User At A Time Please" and hope everyone sees and follows it.  Of course then the users need to coordinate their use.

I can (software) lock it so that only one person can print at any time.  But when the second user tries to print he or she is blocked until the printer is free.  And the third user is blocked longer etc.

Or I can set up a queue.  As each user prints the print job goes to the queue.  The printer looks at the queue for jobs to print and as it prints them it removes them from the queue.  No one is blocked and the printer doesn't fail because two people try to print at the exact same moment.


How can I determine if a student would enjoy or has an aptitude for CS? I'm a developer with a little CS teaching history, and I have a nephew who enjoys math (Algebra-Calculus) quite a bit in high school.  Because of this, I feel like he should at least try computer programming, but its not available at his small-town high school.  He's a senior in high school this year (16-17yo).

Are there any games or simple projects/tests that are designed to see if someone enjoys programming?  I think setting him down with an Intro to Java book would be pretty boring and probably not give him a good feel to what programming is about.

I've seen coding challenges for people learning programming, and simple games that seem to be targeted at younger kids.  What I really want is something a teenager can sit down with and say, "oh, so this is what programming is like"...

You shouldn't "test" somebody to check whether they're interested in something. You should give them some stuff you think they might enjoy, and you let them decide for themselves.

There are a ton of programming languages designed for novices, including:

Processing. This is my personal favorite. Shameless self-promotion: I've written a series of tutorials for people exactly like your nephew, available at HappyCoding.io.
Scratch. This is geared towards younger kids, but might be a good "game-like" introduction.
Game Maker. If your nephew is interested in game development, this might be worth checking out. I suggest not limiting him to game dev though.

See also:

What would be a good first choice to teach game programming to beginners?
Using Processing as an entry point in an Introductory Course
Order to Teach Topics in an Intro Programming Class


An Intro to CS course in C++ for CS majors: laying a solid low-level foundation or simple tools and algorithmic thinking? Consider the following two competing incentives in teaching a first Intro to CS course for CS majors. In my case, the course must use C++ -- that's a given.

The first incentive is that the course needs to provide a solid foundation, which includes understanding how things work under the hood and implies teaching pointer, raw array and string, dynamic allocation etc.

The second incentive is the focus on developing algorithmic thinking and taste for elegant code. This incentive seems to be served best by teaching the smallest and the simplest-to-use possible subset of the language sufficient to solve algorithmic problems, gradually getting to the level of problems used in informatics olympiads for high school. So, for example, std::vector would be taught instead of raw array and pointers would not be mentioned. This would probably also mean excluding the need to handle errors in the exercises, so as to not spoil the taste of writing short and elegant code.

Which approach is preferred? Or maybe a third approach?

Clarifications following the reply by @Ben I.

I am presenting this as a choice between two approaches, because I believe that the two approaches are in conflict. Low-level features of the language are complicated. To help students understand them, one needs to give a lot of technical examples and exercises. This totally takes the focus away from algorithmic thinking.

Also, I am writing under the assumption that, once I am convinced about the correct way of teaching, I can try to convince my colleagues to consider changes in the follow-up courses as well. Right now the curriculum is built on the first approach. The big picture that I see is that there are many CS graduates who know programming languages, but few who are good programmers. Look at the questions at leetcode.com. Almost all of them are about algorithmic thinking, because employers are looking for good programmers.

You wrote:

  The first incentive is that the course needs to provide a solid foundation, which includes understanding how things work under the hood and implies teaching pointer, raw array and string, dynamic allocation etc.

This is not the only definition of a "solid foundation".  I would suggest that your second approach is also a "solid foundation", but towards a different goal.

You could make a wonderful course out of low-level computer workings, and your students could learn a tremendous amount.  Your "second incentive" is higher-level, and you could make a wonderful course out of this as well.

In truth, I am not sure that your goals are entirely opposed to one another.  You can teach high-level thinking and still mention what is going on under the hood, and you can teach good coding style in a low-level language.  No matter which basic approach you take, you really should make an effort to help students see at least a bit of the other side.

But in answer to your question about a basic initial approach, I might suggest the following: we often think about introductory courses as preparing us for our long-term futures, but I would argue that on a far more practical level, course 101 lays the foundation for 102, 103, 201, 202, 303, and so forth.  You are setting the stage for future learning.  Therefore, the best (introductory) course is the one that helps the students get the most learning out of their later, more advanced courses.  After all, those courses are where the rubber will really meet the road.

So, what will set them up for success as they proceed through your entire program?  Have a few conversations with your colleagues, and take a careful look at your program's course catalog.  The answer may become fairly obvious.


Do some websites block school building/classroom IP networks because they mistake us for possible DDOS? So I had my students go to NodeJS.org to download Node.js, and they did it with no problems. Two days later, I had them go to NodeJS.org again, but none of us could access the site, not even from the designated "teacher's computer" of the classroom I was using.

However my laptop, which was connected to the school's wireless service for teachers, could still access the site. I'm assuming classroom computers and the school wireless are on separate networks. Could this mean that the anti-DDos system at NodeJS.org basically mistook us for a potential DDoS and blocked us? There were about 20 students. A week later we could access the site again.

So I'm just wondering if anyone else experienced anything like this?

Yes.  I have a web development class.  If more than 5 people connect to the free hosting site, it stops anyone else from connecting via FTP, since we appear to all have the same IP address.  Multiple connections from the same site can be a script running, and most users will not appear to have multiple connections.
I do: Demo using the FTP client, go through some of the issues with connecting (error messages etc.) and then, because of this restriction, I will either:

1) Manage the class in groups (if a small class) or

2) Give them a task (ftp their site) to perform at home for review at the next class

It is annoying, but as indicated above, it is likely to detect DOS or other malevolent connections.


Best way to pass on the problem solving experience In my workplace, my team (working both on a ASP.Net MVC ecommerce and a C++ client) had a recent addition of two young members. One is a fresh graduate and the other worked as PHP programmer for some time. They're both kind of new to the ASP.Net world, along with all advanced concepts of ORM mapping, IIS configuration, performance issues and tricky-to-spot bugs. I'm the owner of the C++ side, and the other team member owns the ASP.Net side (on which I can work a little bit).

We, as senior team members, are expected to carry out our duties efficiently, and at the same time support the young ones in their gradual growth. They're doing their best, and our company allowed me a bit of dedicated time to spend for their education.

I collected my colleague's impression that the basis are already kind-of covered and what they really need to grow is to start thinking in a "professional" way (e.g. understanding the life cycle of a web application or HTTP request, or face a problem without relying entirely on the "senior" side).
I think these skills come naturally by spending time on the particular project / language / framework and only if one accepts (or is forced) to take responsibilities.

Are there ways to efficiently pass one's "experience" and "problem solving attitude"? Does sitting beside the young ones and working together on the same problem (almost always splitting the work like 70/30) help or hinder their growth?

Thank you for your time.

In places that use the ideas of agile software development, the usual way is to just let the newcomers pair with the more experienced members in all tasks. In your case it would consist of a lot of pair programming. But you would need to do it correctly. It isn't one person programming and the other person watching. Both participate, but in different ways. See Pair Programming Illuminated for a specific description or Extreme Programming Explained for a more complete description of the whole process.

The experience of agile shops is that pairs produce about as much as people working individually (there is research to that effect) but with higher quality. (Specifically, the hypothesis that individuals produce more in total is not supported).

But more so, the newcomer is immediately introduced to the local process in an active way and can start to be productive much sooner. However, the experienced member of the pair will need to turn the keyboard over to the novice frequently (roles switch every several minutes, not hours), and both will need to learn to adopt to the individual roles of "driver" and "navigator".

Pairing combined with faithful use of test first development is especially productive of high quality software, but you need to actually practice the skills, not just talk about them.


How to teach a person to enjoy programming? I've been teaching programming to my 13-year old son for over a year now. I'm not satisfied with his progress. I think that one of the reasons is his attitude: He wants to learn programming (he said several times that he wants to do something related to programming, technology, and/or game development), he makes some progress (he decomposes the task into smaller ones, he tries things out), but he regards it as work.

One of the secrets to productivity in IT is that many programmers enjoy the process. It's not work and it's not a chore. Sometimes, I turn on good music, take a bottle of liquid happiness, then program for several hours for the fun of it. I'm not accomplishing a task, I'm enjoying the process. Under the right circumstances, you can get into flow from such "work".

What can I do in order for another person to experience the feeling that programming is an activity you can do for fun and recreation?

Meet him where he lives. Take something he's already interested in and use programming to accomplish some goal within that interest. The act of coding is not the end goal, the final "product" is the end goal. Make it about that.

For example, you've said your son is interested in game development. Encourage him to create a simple game using a language like Processing or a tool like Game Maker. The keyword here is simplicity- your son will probably want to make Call of Duty or Minecraft. Encourage him to start with Pong instead, and work his way forward from there.

Maybe participate in a "game jam" like Ludum Dare together. The idea is to spend a weekend creating a game around a theme that's announced on Friday, and you can participate from your own home. The next official event isn't for a couple months but they run "mini jams" every other weekend.

It doesn't have to be game development though. The idea is to use programming within his existing interests so he sees the fun and utility of code naturally. If he's into sports then maybe write a sports simulator. If you travel then maybe have him create a travel log from Google Maps API. If he's into music, create a music visualization. If he's into movies, point him to video processing libraries.

But again, the projects you give him should be simple, so he can make visible progress on them in a short amount of time.

You might also consider being an example: what cool projects are you working on that you can show him? Can you give him a simplified version of something and have him "remix" it by changing variables and logic instead of needing to come up with everything himself?

Related questions:

How can I determine if a student would enjoy or has an aptitude for CS?
Which non-programming skills help make a good programmer?


How to teach students not to use jump statements We all know goto is the spawn of satan. To learners though, it seems easy and quick. In simple, short program codes having a goto or two won't turn the code into unreadable spaghetti code. So students have a hard time understanding why they shouldn't use jump statements. Even if they believe that I (the teacher) strongly believe it is bad practice, they won't "internalize" this.

My current strategy is elegantly forgetting about jump statements altogether. I don't tell them these things exist, hoping by the time they discover, they'll be used to coding right. Not only Goto, but also loop or subroutine/function exit statements (although I do use these from time to time in the darkness of my room, but I always feel dirty when doing so).

Should I teach them jump statements? If yes, how do I make them feel just how bad they are? Give them a huge code with many jump statements and have them try to understand? What is your strategy?

I don't believe that your question is entirely valid; some languages require jumping.  The first principle, therefore, is to follow the norms of your language.

However, I suspect that you are asking about languages that discourage (but do not ban) jumping, such as Java, or C++.  In these cases, I agree with Peter that the solution is to give them the negative learning experience of having to parse code with bad jumping usage.

I would only add two things to what he said:

Do not teach about break statements and jump statements if you can avoid it until they really have have absorbed the norms of looping.  This can take some time.  If kids start using them earlier than you would like, simply tell the students that, while such statements have a time and place, please avoid using them for now.
As an idea for an exercise, just make some code that has for loops and replace them with awful while(true) loops.  For instance, consider this bit of foul excrement, which will print out the first 10 Fibonacci numbers:

int daffyDuck = 10;
int[] bugs = new int[daffyDuck];
bugs[0] = 0;
bugs[1] = 1;
int whynot = -1;
while(true){
    whynot = whynot+1;
    int whistlersmother = 0;
    if (whynot == 10) break;
    int animeRocks = 0;
    while(true){
        if (whynot-animeRocks <= 2)
            whistlersmother += bugs[animeRocks];
        animeRocks++;
        if(animeRocks>whynot)
            break;
    }
    bugs[whynot] = whistlersmother;
    System.out.print(bugs[whynot]+",");
}

Give it to your students, but don't tell them what it does.  Give them a chance to attempt to trace it.  Tell them that they only have 4 minutes (240 seconds!)1 to figure out what it does!  Presumably, they will struggle mightily to figure it out, but mention that, if anyone thinks that they've solved it (and can back that up), not to call anything out, but to instead raise their hand.  If anyone does call you over, ask the to whisper the answer into your ear, and if they get it right, ask them to silently try to re-write the code segment in a way that would be easier to follow.

Now, give the class a new version, with another 240 seconds.  Do not mention that it is exactly the same code as before, but with nicely-defined loops (and modified variable names).  Once again, tell them not to call out the answers.  The process here should be the same.

    int n = 10;
    int[] f = new int[n];
    f[0] = 0;
    f[1] = 1;
    for(int c = 0; c < f.length; c++){
        int s = 0;
        for(int j = 0; j <= c; j++){
            if (c-j <= 2)
                s += f[j];
        }
        f[c] = s;
        System.out.print(f[c]+",");
    }

And finally, give them this version, same 240 seconds, same procedure:

    int fib_nums_to_print = 10;
    int[] fibonacciNums = new int[fib_nums_to_print];
    fibonacciNums[0] = 0;
    fibonacciNums[1] = 1;
    for(int currentNum = 0; currentNum < fibonacciNums.length; currentNum++){
        int sum_so_far = 0;
        for(int j = 0; j <= currentNum; j++){
            if (currentNum-j <= 2)
                sum_so_far += fibonacciNums[j];
        }
        fibonacciNums[currentNum] = sum_so_far;
        System.out.print(fibonacciNums[currentNum]+",");
    }

At this point, you can reveal, for those that hadn't figured it out yet, that all 3 of these bits of code were the same function.  Ask them what made the later versions easier.  They should be able to pinpoint the two problems pretty easily.

Point out that loops can grow to be very, very large - hundreds, or even thousands of lines of code long.  Ask them why the while(true) version of the loop would be especially problematic in longer code examples. Ask them where, in their opinion, would it be best in such long code for the coder to make clear when the loop will actually end.

All of which brings us to the final principle: we want to be able to figure out, at least in 99.9% of the cases, the basic logic of what will cause a loop to terminate at the moment that the loop is declared, because otherwise, we are left hunting and guessing.

1 - Any time you mention the number of seconds along with the number of minutes, the kids suddenly feel time pressure.  It's a very consistent trick to get the kids to focus on a short task.


What do programming novices need to know when using MatLab? I am an assistant professor preparing a 5 lecture series 'introduction to programming'. The target audience are first year engineering undergrads - from a mix of mechanical, electrical, electronic, telecomms and civil engineering majors. Some of these students will never have programmed before. We will use Matlab.

I am expecting that many of these students will never have coded before and almost all will not have seen Matlab before. They will need Matlab in all subsequent years of their degree.

Given the extremely limited time for this course, how can I give best bang for their buck, without it being too dry?

Is there something cool we could work towards creating over the 5 weeks?

More info: There are 5 x 4 hours sessions. Classroom cannot be flipped as there will be 50+ students.

Editing here to thank everyone who has taken the time and effort to give extremely helpful detailed replies. I appreciate it guys.

With only 5 sessions, I would abandon the idea of building something cool, and focus with laser-like precision on whatever they need to know going forward in their coursework.  There is such a small amount of time to learn the basics of any programming language.

MatLab supports lambdas, objects, and GUI design, but unless they are going to get into rather serious programming, I imagine that you would steer clear of these.  (I don't know how you would cover any of them in 5 days with novices in any case.)

The danger in heading towards UI and a game is that they will come out without being able to do what they presumably need in the next class, such as matrix multiplication, or graphing an integral multiplication.  You may be better using your five sessions to delve into five areas of greatest need, as determined by the future required coursework of your students.


Shallow, broad and general introduction to programming I've planned a shallow and broad curriculum for a summer program (5 days a week for 2 weeks, 9:00 to 17:00) or sorts, and the flow of the subjects seems flawed.

The students are gifted (not a prerequisite, but most of them are) highschoolers with either no background in programming, or very little background.

The purpose is to interest them in learning programming. More specifically, to give them a taste of some aspects of various languages, hoping that each will find something they like and, being naturally curious, they might pursue the subjects they liked a bit more.

The curriculum I have in mind is more or less:

Using C:

Intro to the simplest of things
printf("Hello World!\n"); and the like
most importantly, introduction to types.

Using C++/Java:

very brief overview of OOP, just at the concept level
"Things" are described in classes which have properties etc.

Using JavaScript:

Intro to functional programming. Again, just at the concept level
"Things" are described with functions.

and finally:

Using python:

finish with small tasks for them to get some hands on experience and things to show their friends

As I see it, the main issue is, for lack of a better word, synergy. Subjects 2 and 3 seem highly disconnected. Moreover, I fear that for the students, the things they learnt in C and C++ will seem "pointless", since most of them will think that they don't use those concepts and ideas in the tasks in part 4.

How might I bridge between OOP in Java or C++, with functional programming in JavaScript? Personally, I thought using Java's functional interfaces could work, but that would require teaching about interfaces, making the course far less "shallow" than it should be.

Might there be a simple or neat "trick" to connect the two subjects?

PS: Any other suggestions regarding the partial curriculum I outlined are also welcome. It's the first I've built from nothing

The purpose is to interest them in learning programming. More specifically, to give them a taste of some aspects of various languages, hoping that each will find something they like and, being naturally curious, they might pursue the subjects they liked a bit more.

Comparison of programming languages doesn't make sense until they've first mastered the basic concepts, so two weeks doesn't seem like enough time to get onto this. I think you'd be better off taking one language which supports functional and OOP styles, covering both, and then maybe doing a small Rosetta Code presentation in the last day or two, with a handout which they can refer to after the course has finished.

I'm also not convinced that the students' curiosity will work that way ("This idea of first class functions is fun: what can I do with it?"). I think that the hook should be that programming lets you do things which are fun and/or useful. The difficulty with coming up with examples is that no two students will agree 100% on what things are fun and/or useful. Games are a good bet for fun, although graphics tend to be complicated and you risk needing to dedicate lots of time to teaching/revising trigonometry and quadrature. I'm not sure whether today's youth would find text adventures fun. The concept of databases as useful is another reasonable bet: most people will collect something or follow a sport, and you can build and query structured data to enhance both of those. Pick a language which has easy serialisation and you don't need to bother with "real" databases (although maybe mention them in the handout).

Although I've never used it myself, Swift looks like a reasonable teaching language if you want compile-time typing. From looking at examples on Rosetta Code it seems to have clean syntax and support imperative, functional, or OOP styles.


Jargon/Vocab about variables--- yes or no? In my experience (working with college freshmen mostly), I've tried to emphasize precise vocabulary about the concepts and syntax related to creating and changing variables. This is wording like:

identifier
declare
initialize
assignment
token
execute
compiler

My reasoning is that these words are immediately necessary to understand error messages, intermediately necessary to Google things, and necessary in the long term to communicate to other programmers.

However, some teachers I've talked to try to avoid this type of language because they feel it introduces another barrier to their students' understanding. I guess they'd say I'm trying to introduce compiler concepts too early.

What's your view? How do you know when there's too much jargon?

Some of these words are entirely necessary, some (such as tokenize) you might want to avoid early on.  However, I would suggest this as a guiding principle: use vocabulary as is necessary to get at the core goals you hold for your students, but do not emphasize vocabulary for its own sake.  A great visualization or metaphor at the very start (after all, freshmen!) will take your students much further along than a series of fine distinctions.

Here is a fun little article about 10 Extremely Precise Words for Emotions You Didn’t Even Know You Had.  The title is correct; when you read through the article, you will find emotions that you have experienced, but never described.  Nevertheless, you were able to experience the emotions perfectly fully.

Similarly, with the help of a great diagram or metaphor, students will be able to utilize concepts that are more advanced than they can fully describe.  That's okay - great even! - and later coursework can help them nail down finer distinctions as they advance.


Mnemonics to remember the TCP header fields I am bad at memorizing things. So could anyone recommend me some mnemonics, so that I can remember the fields of the header...
Thank you.

The first bit is where it is going. An intermediary needs this to forward it. It goes first so that at least in theory it can start forwarding before it has finished receiving. Next is the symmetrical data (where it is from). This is common to most protocols (ethernet mac-addresses, IP addresses, tcp/udp ports, …).
Next the two sequence numbers, in the same order as before: to (the sequence number of this segment), from (the sequence number of the last segment that I got from you).
Next the length of what remains, you need the length before you can start reading the rest (there is no other way to know where the the end is.
Then various flags, the window size and the rest.
Of this I only remember the first two (the two addresses). The rest I look up.


What's the best way to assess programming? Over in England the current model of assessing GCSE level programming (exams for 16 year olds) is being debated. A system where students had to program and write up solutions to a given scenario has suffered from plagiarism to the extent that the exams might be withdrawn.

We are now asking ourselves what is the best way to assess programming? With three models emerging:

On screen timed programming exam
Open ended programming projects with report and/or questions about code produced
Entirely paper based exam asking with code comprehension and writing of short code pieces

None of these models are without their problems and there are advocates for each of them. Does anyone have any good research that shows assessment model x is the best way to assess programming?

Some related research
There has been some research into how to hire people: How do you select people that can do the job. The traditional methods rejects too many “good” people, and accepts too many “bad” people. It turns out that the best thing to do is to test them doing the job, and/or selecting for attitude.
Therefore to test programming you should test programming (I don't care how good an essayist my heart surgeon is).
Google is one of the companies that has done some research in this area. There will be others. I heard about this on BBC Radio4, so there may be some info on there web site (good luck finding it).
Some other suggestion

Open book: programming is not about memory (off line: to web pages downloaded before exam release).

Automated tests, for the coding section (tests written by the exam board). See test-first, and unit-testing.

Look at what can be assess automatically, assess the rest manually (I think there is an article in Hello World issue 3).

To avoid plagiarism: Give them materials to work with, be open book, use exam conditions (multiple small exams).

It was suggested by one teacher: “pupils are messing up in the early stages, this is trickling through and causing pupils to loose marks in later stages as well. Therefore divide the test into multiple sections, the output of section one is not the input of section two (exam board provide inputs for each section, a different problem, the confusion does not propagate).

Check for working code.

Check big-O (run-time, and code size).

Check for good-name (of methods, and variable), over comments.


Advantages and Disadvantages of Teaching Block-coding Languages Such As MIT's App Inventor? I'm thinking about teaching App Inventor to students who have just begun their adventures in the programming field. MIT's App Inventor is based on block-coding, where the user designs the UI and then designs their functionality with block coding. However, it has so much more potential than traditional drag-and-drop languages as mentioned in an article I found on this website (Placement of App Inventor in high school CS curriculum). I think it's a great way to get students started on learning how to program (basics of coding and how to work out solutions), but I'm afraid it also might be a bit dull for those who already have had some experience with other programming languages.

What are some advantages and disadvantages of teaching block coding?

Student's Opinion

Not a definitive answer by any means, but thought that I might add what I have learnt...

I am 16, but first got exposed to block-coding at the age of 9. While I continued with more advanced forms and still make use of them (notably, LEGO Mindstorms), I grew out of block-coding very soon, and progressed to what one may call "real"-er programming languages.

That said, I'm the head of the programming/computer club at my school and have noticed that students who were first exposed to scratch (A block-coding language developed by MIT which it taught at junior-middle school at my school) pick up "real" programming languages quickly, since all the basic concepts are already known to them.

While teaching my juniors JS or C++ I'll often compare a concept to its equivalent in Scratch. That said, the obvious disadvantage is that scratch is basic, and doesn't cover advanced concepts (return codes, arguments, etc.)

Scratch and MIT App Inventor are very similar, and both are taught to my juniors at school, and students generally appear to enjoy these.

However, it is, indeed boring to those who have already had experiences with programming, and this is a problem to which you really should find a solution if you wish to move ahead with GUI-based programming languages in your curriculum.


NodeJS and Javascript libraries are overwhelming students I started teaching NodeJS to some of the students in the computer science major at my school (these students know the basics of Java and OOP).

The idea is for them to make a small web project (such as a grades and averages calculator or a display for a timetable etc.) using javascript.

I plan to teach about javascript, client-server separation, http requests etc. The main problem is the vast number of JS libraries in existence. I intend to emphasize that most of the code is already written. E.g. the code for creating nice graphs exists in charts-js, and responsive client side frameworks (angular, react) exist.

This project is also meant to teach the notion that programmers rarely write programs from scratch, and that they should often see if there exists a library\framework that give a functionality they need.

However, with Javascript, the vast number of libraries makes it somewhat difficult to know which ones to pick. It's not impossible, but I'd rather students not waste time on that.

I ran this by a handful of students, to see whether students actually get overwhelmed. From what I saw, students are likely to waste time reading up about the library they are checking (somewhat like reading a review for a PC before buying it). Research is great, but the amount of wasted time was quite big.

So, what can I do to teach them how to "sniff" the "correct" library more efficiently? In other words, how can I teach them which metrics are significant (and why those metrics are important) when deciding whether a library is useful? Bearing in mind that the time it takes is to be considered, I'd prefer ways and metrics that are generally faster (e.g. reading up the documentation of a library is somewhat slower when compared to checking npm's download in the last day)

1Unless they program in Scratch.

Summary

Node.js has an unusually complex ecosystem which you don't get in some other languages.
Your students spending time to intelligently pick the best libraries is great, but you might need to stop them from being bogged down.
If time is really a problem, simply take away the choice, but keep in mind that you take away a powerful (and necessary) learning experience.
Remember that not every problem needs a library; it's fine to re-implement simple things yourself!

Node.js (and the JavaScript world in general) seems particularly prone to short-lived, highly popular libraries and frameworks which re-invent existing features in different ways. You need only see the Stack Overflow blog which illustrates this trend well enough:

I've developed web applications in the past where I've agonised over the choice of libraries for hours — even days — trying to find that perfect combination which will avoid all these potential future issues... issues which, it turned out, weren't likely in the first place at the scale I was working at.

Initially, I heard great things about React, so I decided to add that to my project. Then I need a 'Flux framework' too so I can handle events in a React way. So I pick one like Redux. But React doesn't degrade so well for clients without JavaScript — oh no! Luckily, there's already a solution for that — server-side rendering. So I plan to use that too. I'm sending a lot of assets at once now, which is starting to get slow, so for HTTP clients I want to bundle my assets with Webpack. But I don't want to do that for HTTP/2 clients because that's actually slower again.

That's not even the end of the story, but you're starting to get the picture of just how many pieces exist in the JavaScript world. I honestly don't know many other languages that are so chaotic vibrant with their library ecosystem.

Honestly, your suggestion of just going by the download counts seems unwise in some respects. While popularity does probably offer a good indication of maturity and stability, it doesn't tell you whether the library actually does what you want, in the way you want.

Let's take my React example again. Yes, it's popular, and indeed, it is a front-end framework, but it requires a lot of 'buy-in' — you have to deliberately design your pages around React to get much out of it. jQuery might fit my use-case perfectly, despite being a little less popular, but by just picking the popular library, I'm stuck with even more work.

As an analogy, how do you pick which car you want to buy? You probably don't buy a Ford Fiesta just because everyone else did. You probably take a look at the specifications, fuel economy, and perhaps give it a test drive.

Putting that investment in and learning a little about the popular libraries is well worth it. You only have to do it once to learn the philosophy and the goals of that project, and once it's done, you know when you want to pick that library above the others.

You can try and tell them metrics to look at... or you can accept that you need to dedicate time to trying the popular libraries, and getting that 'test drive'. Spend a lesson trying React, and get your students to tell you what they think. Going beyond the trivial 'Hello world' might be helpful (I hear the TodoMVC example is fashionable and more complex).

Or, if you can't afford the time, I think you'll simply have to tell your students which library you want them to use. What your students are doing now is great, if a little inefficient. You can help by prodding them in the right direction — share what you know, and give them a nudge if they start burying themselves in too many libraries.

Sometimes, I think all that's needed is a little poke to say that not all JavaScript projects need to handle every possible future concern, and to Keep it Simple, Stupid.


Assignment repositories Are there any assignment repositories that you use for assignment ideas? I am aware of the Nifty Assignments from Stanford and have used several. There are a lot of good fine grained problems on HackerRank, but I would not incorporate the work of a commercial group into an assignment.

Ideally, they would come with a write up and be licensed for general reuse with inclusion of a standard disclaimer, etc. Assignments with multiple parts so students get to live with their own code over a period of time would be great.

Engage CS Edu (https://www.engage-csedu.org/) is another repository, which, like Nifty Assignments, is curated by peer review.


Where, sequentially, do Interfaces sit in an introduction to Objects? I've been teaching Objects for years now as part of AP Computer Science A (which means that I am teaching OOP in Java), and I have experimented with putting Interfaces in at different locations.  In general, I currently teach in the following order:

Class Structure: the coupling of data with relevant methods.
Information Hiding: making each class responsible to guarantee the integrity of its data.
Designing the API: Given what we've learned, how should we design the public face of our classes?  Included in this section is the concept of overloading.
Inheritance: Creating relationships among classes, inheriting and overriding.
Polymorphism: Being able to utilize children in place of their parents, and how that works.

Interfaces seem most related to Polymorphism to me, since we can (for instance) make an ArrayList<SomeInterface> but wherever I put it in, it always feels like some add-on instead of like the core and vital concept that it really is.

Where (and how) do you integrate Interfaces into your OOP exposition?

Ideally, interfaces come first. Before Classes. Interfaces define concepts. Classes implement those concepts. Don't think of them as an add-on to OO programming. Think of them as the essence.

In fact, if you present a pre built class to students, my guess is that you already, probably informally, give the interface first. Here is a class with public methods "accept" and "spitOut", or something like that. You probably talk about the public methods first and the necessary parameters and return values. More importantly, you probably talk about the intent of the class and of the individual methods. Most likely, and I think most common, only then do you discuss the implementation of the methods along with fields, etc.

If you start your discussion with the fields, on the other hand, you are (IMO) making a big mistake and that students will start out by thinking at too low a level and will write their code too often in terms of getters and setters. In other words the encapsulation will be inconsequential and possibly leaky. Then, in a program with a few tens of classes and a few hundreds of objects, but, perhaps thousands of fields, they will be thinking about the fields and how they mutate, rather than the concepts represented by the objects in the system. Their thinking will be at a lower level than is efficient (or even possible, in some complex programs).

But if you introduce the concepts first, and get them to (a) think in terms of those concepts and (b) implement those concepts faithfully they will be naturally led to think at a higher level of abstraction, which is really what programming languages are for in the first place.

Some rules that I'd adhere to with rare exceptions and no exceptions at the start.

  When you implement an interface don't give the class any additional public methods. Thoroughly document the intention of the interface and its methods.
  When you build a subclass of an existing concrete class, don't give the subclass any public methods that don't have signatures in the superclass. (Abstract classes can be a bit different, but it is dangerous and adding public methods should be delayed.)
  If you need new things in a subclass, extend the interface instead, as it represents a new concept, and implement that, rather than just extending the superclass, though you can also extend as an implementation strategy.
  Prefer composition of objects over inheritance. An object is composed of other simpler objects (representing their own concepts). With composition you will probably be able to

    a. Write simple classes (a few public methods)
    b. having simple methods. I get antsy when a method is more than about 4 lines or has any nested internal structure.

  Use simple design patterns to make it fit together. These are just another sort of concept and are themselves normally defined with interfaces.
  Avoid getters and setters (in interfaces and classes). They lead the student to think of everything in terms of mutations of implementation, rather than at a high level. I use accessor for a method that returns information (possibly a field's value, but not always or often), and mutator for a method that somehow changes the internal state of an object. A mutator might in fact have nothing to do with fields and might pass on a message to one of the implementing objects or set up a chain of mutations. Thinking in terms of setters is too narrow, but also too low level.

Some modern OO languages don't have formal interfaces, but you can normally simulate them to separate out the ideas from the implementations.

Note that the Standard Template Library (which I haven't used in quite a while) was, itself defined in terms of concepts and the term was (maybe still is) used in the literature. This was just a placeholder for interfaces that C++ didn't support.

The idea here is to build a software system in terms of readily understood concepts. The resulting system has its complexity in the interactions of simply understood things, rather than in the things themselves.

Note that I often write an interface when I intend only one implementing class. Capture the concept first.

Again, note that I often write an abstract class that has protocol (abstract methods) for every method in any intended subclass. This lets me capture a common implementation, but keeps my concept clear as I subclass. I never need to ask instanceof and I never need to cast an object reference. Everything naturally fits together freeing my mind to think of other (higher level) things.


Looking for software that would enable me to cast a screen over LAN I'm working at the university in a computer lab and I'm looking for a Microsoft Windows software, that would enable me to cast a screen of my computer (master) to all other student's computers which are in the same local network.

I have already found several different solutions, but none of them enables me to force the slave computers to start the screen casting software.

The idea here is, when I'm showing something on my computer I would start the screen casting software on all slave computers, and students won't be able to close this window until i'm done.
Does software like this exist?

I know of two bits of software that can do what you want.
They do what you are looking for, display stuff on their screen and do demonstrations on their screen. They also lets you spy on your pupils, blank screens, lock screens (useful if they are not paying attention), and shutdown computers at end of day.
AB Tutor
I have used this software, in the schools I have worked in.
On the negative side it is proprietary, and expensive.
Veyon
I have not used it. But it is Free Software and cheep.
See http://veyon.io/


Paper Books or eBooks? The majority of my students are finally becoming internet equipped. (This is kind of a big deal here in India). Whenever I start a new session, students ask me to recommend a textbook for them. I use my own experience and recommend a basic book and an advanced book, and online references.

However, in the last few weeks, an additional question is being asked. They ask me, "Sir, should I go for an ebook or a paper book"

Being in software training, almost everything I have is digital. Yet, when I decided to learn iOS programming 3 months ago, I decided to go for a printed book. However, I also see the appeal of eBooks as in individual, seeing how my kindle filled with dozens of novels. For my students though, I am not sure what I should tell them and why.

Additional considerations.

eBooks are usually cheaper compared to their printed counterparts. Sometimes, the printed versions are simply not available or take too long to ship.
Further, since most books can be read in a browser, lot of students
share their accounts (kind of like how folks share there Netflix
password) so that more people can read expensive books.

Update : Folks, just want to add that I posted this question hoping for a definitive answer. However, I have now been schooled that, expecting a definitive is perhaps not the right approach. So, if possible, please help me with definitive answers but I acknowledge answers that are focused on providing insight instead of being definitive.

I would recommend a mixed strategy. There are two sorts of books that are appropriate for e-books, I think. The first category is books that you need now, but wouldn't intend to keep. This includes books in subjects that are less important to your main objectives. In the US, at the undergraduate level, it might mean books that are required in subjects other than your major subject. The second category of books suitable for e-books is those that you expect to always be available in some form over time. Great literature and philosophy are in this category. But if you would intend to discard a book after a year or two, the cheapest alternative is likely appropriate.

I don't have faith that the e-book formats and their readers will continue to be available in an upgradeable way. Suppose you have a very important e-book that depends on some particular format or device and the company supporting that format decides to abandon it. You may not have access to those bits in 20 years or so. That is especially the case for those with DRM "protection."

So, the category of books that you should consider getting on paper are those that are most important to your goals. If you study CS, that would mean the books in the core areas at least. If you later want to refresh your memory those books will still be on your shelf (with reasonable care, of course). You will be familiar with them. Perhaps you have personal annotations in them. For e-books it may be easy (should be easy) to annotate in place, but I don't think that is universally done at this time. So your notes may be separate from the text and it is up to you to keep them synchronized and harder for you to review.

Of course, for such important books, you might consider having both formats, an e-book you can carry on your daily commute and paper for serious study. Some books that you purchase on paper also give you automatic access to an electronic version, or at least to additional electronic resources at no cost.

Note that one advantage of e-books is that some of them at least are updated with corrected versions and new editions. Some of these are at no cost, I've noticed. That is an advantage you don't get with paper.

On the other hand, I still have, and occasionally reference, important books I used as an undergraduate in the 1960s. I also have some of my hand written notes from then and through graduate school. I haven't had to worry about obsolescence of format or device. Some of those books are classics that went out of print and the replacements are not of the same caliber.

You should note that the paper text books you get from established publishers in technical fields will probably only be published for a few years. Text book publishers value the new over the old. If that happens to e-books then you become especially dependent on the devices you now own, but which you will likely want to replace in a few years. It isn't especially costly for a publisher to continue to make old e-books available, but they need to take the trouble to do so - as well as the trouble to update formats as they change.


AP Computer Science Principles and Unity I have taught AP Computer Science A for years, but I have not taught AP Computer Science Principles as of yet.  My understanding of the course is that it's quite flexible on terms of languages taught.

I've been noodling around with creating a course in game design using Unity, and I wondered how much that could be merged into APCSP.  Has anyone taught APCSP using Unity for a substantial portion of the course, and how did that go?  Alternatively, is this really not possible under the AP curriculum?

Unity has a "Create with Code" curriculum that is aligned to ISTE standards:

  Most importantly, Create with Code is designed to work in the classroom. Aligned to ISTE Standards for computer science education, educators can leverage the free course curriculum to support instruction inside and outside of class. Flexible teaching materials are provided in addition to the learner-facing instructional videos...

The above site has an ISTE standards alignment document, as well as a scope and sequence, set of lesson plans, and a course syllabus. Many of the ISTE standards map pretty well to to AP CSP standards.

AP CSP is pretty flexible in terms of which set of tools you use, so I think you'd be safe with Unity:


Would you mentor other people for free/voluntary donations? I've asked this myself sometimes already. A lot of knowledgeable developers are using Stackoverflow to give advice and help solving other peoples problems - for free. Giving back your own knowledge and helping students, newcomers or just less experienced developers can be a really good thing. It's a great feeling to know that you've helped someone. I wonder if people would also be up for voluntary (donations at maximum) mentoring other people - face to face via video chat (assuming the person mentored is actually intending to learn and not just trying get help on a project for free from an expert).

I know there are sites like codementor, but they are all based on a fixed hourly rate - you can basically only hire a mentor/expert.

I is hard to give a sufficiently nuanced answer to this question. There are many factors. I will try to give my own perspective.

First, I give away a lot for free in this forum and in others, both within the SE framework and to the SIGCSE and APCS communities. So, my basic instinct is to be generous with my skills and experience.

Second, not everyone is as economically advantaged as everyone else. Some people would like an education but various factors, both economic and political, make that very difficult. In the US, the tax system used for support of schools is incredibly unfair to many people. If you live in a rich area, you have good schools. If you live in a poor area your schools will find a very difficult time providing you the education you deserve.

Third, an educated populace is a good thing. The education available to an individual shouldn't depend on where they live (locally or otherwise), or their particular economic circumstances. To insist that everyone must pay their own way for an education leads to a sub-optimally educated general population, which is a poor path to progress for a nation or the world.

However, fourth, if something is given to you, you may not appreciate it sufficiently, or work to optimize the potential of the gift. I've retired from academia (several years ago), but still teach Tai Chi. It has always been the practice of Tai Chi masters that students must pay something to obtain instruction. Even if it is just a few eggs or a kilo of grain. And the purpose of payment isn't for the support of the masters, but so that the students will be more likely to apply themselves and take advantage of the instruction. It is, in many ways, a mutual gift system.

There is a common flaw in free online courses, that students tend to drop out at too-high rates. If they commit nothing, they probably don't feel obligated to commit to the work required to learn. People paying for higher education, often work hard because they are already "investing" a lot of money and want a good return and will therefore "invest" a lot of effort.

So, if you want to know whether I would, personally, teach for nothing, you'd have to tell me who the students are and what it is that they are willing to "invest" of themselves. If you can find a way to somehow assure that they will do the work necessary so that my efforts aren't just wasted, then I'm willing to listen. But, yes, I'm willing to contribute, provided that I think I can make a difference, somehow. But that is easier in small face-to-face groups than in broadcasting to the web.

Finally, providing the conditions for true learning online are very difficult. If you read other things I've written here and on academia.se you will understand that I have definite ideas about learning and what it takes (primarily reinforcement and feedback) and both of those are hard to arrange faithfully on the web.


Teaching identifier naming conventions Currently the only thing I'm teaching for the naming of identifiers is "be consistent". Then I go ahead and use the Hungarian notation consistently, and show them a few other conventions.

Is there a notation suggested for learners?

Should the use of a consistent naming convention be part of the grading, or am I putting too much emphasis on this?

Some of the best information I have heard about how to name variables, methods, etc. comes from the Stanford MOOC on iTunes: Developing iOS 10 Apps with Swift.

In the first couple lectures, the professor talks through how to build a calculator app (and does so in front of the class in real time) and does a fantastic job of demonstrating why he is naming things the way he is. The essence, as he explains it, is this: a statement in code should read like an English sentence.

One of the early requirements for the first assignment is to read through the Swift API Guidelines. Admittedly, this is designed for the Swift language, but there are lessons to take away from this for any language. The naming can be verbose at times, but such verbosity might improve code comprehension as students will have to know what a variable or method does in order to name it properly.

Even just the following two would be a great start for most students:

"Clarity is more important than brevity."
"Write a documentation comment for every declaration. Insights gained by writing documentation can have a profound impact on your design, so don’t put it off."


Equivalent of PISA study for standardised assessment of skills on computational thinking and programming? My university wants to develop an assessment procedure in order to evaluate the general (not for a specific topic or course) skills on computational thinking and programming languages of our students when finishing their degree. I am aware of code repositories containing programming challenges, such as ACM International Collegiate Programming Contest or Euler, that may be used for the assessment, but I was wondering if initiatives exist to define a common framework to assess these skills for computer science students.

I am thinking on something similar to the worldwide PISA study (which evaluates performance on mathematics, science and reading by 15-year-old students) but adapted to the context of computer science (in particular computational thinking and programming skills). Are there any attempts to have this kind of standardised assessments?

There is the Educational Testing Service (ETS) Major Field Test for Computer Science, a standardized multiple-choice test. Scores can be compared to those at other institutions, presumably on a per question basis.

The ETS website includes some sample problems, which include questions about pseudocode, cache variables, trees, graphs, combinatorics, and regular expressions. It looks similar to the CS GRE, which was discontinued in 2013.


How to construct non computer-based, Paper Parsons Problem I was reading this article “Ten quick tips for teaching programming” by Neil C. C. Brown and Greg Wilson at https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5886386/  It had many useful suggestions one of which was “Don’t just Code” which I deciphered as: in addition to making students write code, we can also make them look at code and make meaning of it or engage with it in some way that gets them to think computationally. One way to do this they suggested was using Parsons Problems (That one is new to me).  I quote them here:

For example, a growing number of educators are
including Parsons Problems in their pedagogic repertoire
[20, 27]. Rather than writing programs from scratch,
learners are given the lines of code they need to solve a
problem, but in jumbled order. Reordering them to solve
the problem correctly allows them to concentrate on
mastering control flow without having to devote mental
energy to recalling syntax or the specifics of library
functions. They are also liked by learners; Ericson et al.
 [28] found that learners were more likely to attempt
 Parsons Problems than nearby multiple choice questions
  in an e-book.

I looked up the researches referred to above as [20, 27]. The 20 reference at http://doi.acm.org/10.1145/2839509.2844617 validated and extended the original Parsons’ research at: http://dl.acm.org/citation.cfm?id=1151869.1151890

They implemented their Parsons Problems as web based drag and drop exercise. I get the general sense of how to create Parsons Problems. I want to use them. But I work in a part of the world where internet service is expensive and sometimes erratic. Similarly with electric power supply. So I wanted to design a paper based or some non-computer-based, physical media form of Parsons Problems that does not require use of electrical power or web access. I want to begin to use them in my lab/revision classes. However the logistics of their construction and use on non-computer media is not clear and/or problematic to me.

One option I considered was using flash cards with codes written on them for students to rearrange in the correct order of the code. One challenge with flash cards is the bulk. For example, consider an Intro Programming Class with students from several departments as high as 70 or more. Suppose you need a set of say 8 flash cards carrying the code for one program.  For a class of 70 students, that would amount to producing 70 sets of 8 flash cards (i.e. 560 cards). Multiply this for say 300 some exercises for different topics and different programming subjects and you begin to see the challenge. There are resource constraints here. There is also problems of handling the bulk, and keeping the cards in good condition from one use to another etc.

Any ideas how one can produce non web-based Parsons Problems in some (preferably, physical/hard copy) form that is much cheaper, less bulky, durable and yet engaging for the students i.e. they don’t just write answers, they shuffle and move, and do some activity with the options?

If you have a metal surface to work on, such as some whiteboards, you can get "magnetic paper". These are sheets of various sizes that are magnetic and can be written on with markers or printed on. With erasable markers they can be reused. They can also be cut to size with a scissors. They will, of course, stick to any metal surface and can be removed and replaced.

Search for "magnetic paper" to find several varieties and brands.


A better database management system, for teaching databases I have been teaching databases, over the last few weeks, to key-stage 3 pupils (year 7 and 8).

The school I am at uses Microsoft's Access. This seems adequate in many ways. However it has many problems, that frustrate pupils and thus, get in the way of learning.

For example:

Continuously asking “do you want to save?” (It should just save. I would not be entering this if I did not want it saved. This is not the 1980's when saving work would take a considerable chunk of your day. It could have it done before I have realised that it has asked.) I have noticed that pupils often select no, even though I spend a considerable time, telling them to save often, to save when prompted, etc. There was a study that showed that when experts see a save prompt pop up it MS-word, they click yes without even reading it. However when a novice sees one, they read it 20 times, then click no (thus loosing there work). When asked the novices said, that the computer was asking permission, so it must be something dangerous.
Not letting us rename an object, if it is open (this will seem normal to Microsoft user, as this is how there file-system works, bit it is confusing).
Not letting us delete something that has a error. I get called over a lot to help a pupil that is getting errors, they can see what is wrong, and want to fix it, but the computer won't let them fix it until it is fixed. e.g. They know that they need to change view to fix the error, but the computer will not let them change view until they fix it. The work around is often unintuitive.
Or half adding a field to a table, it will not let you do anything until it is complete. Pupils see their error, and try to delete the field, but this is something and it is not allowed, until they finish. I have to tell them to set it to something random, then delete it. I use this as an opportunity to talk about usability design.
There are others, but I have not seen them all, and can not remember all that I have seen.

Can you tell be of a better database management system, for teaching databases?

At the state college I work for we stopped teaching Access as the "intro to databases" class a while ago.  I taught the class this term using MySQL and MySQL Workbench.  We had it installed on our lab machines (windows) and I also provided a VirtualBox VM with a Linux desktop, the MySQL server, the Workbench program, and a few other goodies.

Since I ended up with 2 extra class periods after the content was all delivered, I spent a little time showing different ways of interacting with the mysql server (command line, phpMyAdmin, code interaction via PHP and Java) as well as the mysql server management from the Linux class I teach.

Our progression in our AS degree track -

Intro to SQL - all inserts, updates, selects, joins, transactions, views, stored procedures.  Nothing on creating tables - just working with existing databases and tables.

Databases 2 - all table structure and relationships, referencing back to Intro class constantly.

second semester programming classes (C++ or Java) get into workign with a database from a programming language.

For our batchelors program, there is more use of programming and databases, with students learning MongoDB.  The batchelors level programming classes all use database connectivity, although with the Android class we move from mysql or mongo to sqlite.


Students frequently distracted by peers and games I have a class which is in a computer lab (each student has a computer). These are standard Windows computers. The computer lab is organized into rows, with students on either side of a row facing each other. I stand at the front of the classroom with a smart board.

I also take pains to ensure that students enjoy the class, seeing that the goal of the class is to encourage students who may not otherwise have encountered computer science to pursue it.

These two factors come together to create two problems: Students tend to talk to their neighbors, which I believe is because the rows separate them from me, so when I'm not near, there's no reason not to talk. I also permit talking, because the students are encouraged to work on problems together. In addition, because there are computers in front of them which have access to the internet, and they're not entering the class excited about computer science, they will use the computers for games.

How can I make the classroom environment more focused on computer science, without making it any less enjoyable for newcomers to CS?

There are a variety of measures, or counter-measures, that you can employ. Some are technology-based, some come at a financial cost, some require the right level of cultural and institutional authority to implement.

The least expensive, and tech-free alternative is to set rules with consequences. When the instructor is lecturing the students are expected to be listening. Listening is done with the mouth closed and the ears open and eyes on the instructor, not the "game". During "lab" time on-topic discussion is acceptable while discussion of current events (current pairings, etc.) is not considered on-topic.

If the students are expected to use paper for notes, rather than the computers, during the lectures, you can also require that they remain powered down until the "lab" portion of the class begins. Once they are working on the computer, the rules can say "No Games" and that can be explained to include both the Windows per-installed games, and online games of any variety.

Still non-tech, and possibly within a limited budget is the installation of mirrors. One or two strategically placed bubble mirrors can allow you to "see" the monitors even when you are on the other side of the row from them. Granted, the image in the mirror won't allow you to read their screens, or probably even know what program they have open. Even with the limited quality of view they offer you should be able to distinguish between an IDE and a video game, or a music video, etc. Even the difference between a web page being used for research and a chat/IM window is probably distinguishable that way. The version that hangs on a chain should be install able in almost any classroom, and without much effort from maintenance, possibly even on your own.

If the room's shape and the outlet distribution allows it, you can consider the tables mentioned in another answer. Even the pre-computer versions of the half-hex tables can accommodate a trio of flat-panel monitors if you can have the CPUs on the floor. There is the trade-off of loosing writing space for the keyboard, but if they take paper notes during lectures, with the computers remaining off, the keyboard can be moved out of the way.

The cost for the tables depends on what's currently collecting dust in the warehouse and what is purchased new.

Adding technology to the mix, there are other measures that can be pursued. First off is the uninstallation of all the games that are bundled with Windows. There seems to be no real reason to have them on computers that students are supposed to be using for schoolwork. It might cost the IT Dept. some time, but it won't cost them anything else.

Depending on the school's policies, it's also possible to restrict the sites that are reachable from the school's network. This shouldn't require any new software for the system, just the configuring of what's already there. Most of the popular games for your students are likely to be from a highly limited set of domains, domains which server no other purpose. Blocking traffic to those few IP addresses can be handled by even a simple home router, whatever is in use at your school ought to be capable of the same. If your school is setup with each room on its own VLAN then they could configure your lab's network to block those sites while allowing them for the rest of the school, and for the WiFi access from student devices. I don't think there's a legitimate need for access to such sites from the school's network at all, but the school policy might not allow a global blocking of such sites.

The most expensive, and probably the most complicated to maintain, is to install some form of "parental control" software on each student computer. (Removing, or disabling, unwanted software at the same time can't hurt, or course.) I have no recommendations for which one to use as I've never bothered with any of them. It's likely that the cost and licensing of them will have a larger impact on choice than features in any case. Institutional bureaucracies tend to move in that direction, even when it means getting something that does half of the task only half as well as something else would.

Still, no matter which measures, at whatever costs and technology level, are used, they only make sense when used to enforce an existing rule. If there is no rule against playing games during lab time, blocking game sites is not appropriate. That realization just returns the subject back to the top of the list.

With the understanding that there are some rules to follow, which are explained to the students in the beginning, you can still attempt to keep things "light" for their first real exposure to CS. If the class is for programming, you can work towards developing a game as part of the progression of the class. Obviously it will be a simple game compared to what they like to play. Being part of the team that makes it, however, can add the excitement lacking from the game itself. I suspect that even today's kids know what tic-tac-toe is, and its rules. Making a quick version of that early in the course can cover a lot of the language basics without needing major investment into complex libraries and programming. If developed early enough in the course, it ought to fuel their fire for making a "better" game during the remainder of the course.

Whether the end is a game, or something else, the sooner you get the students where they have "made" something which does something and they can see the results of their work, the better your chance is of getting them engaged and invested in the material. I believe that is one reason web design classes do so well - the view-able web page, no matter how "basic," is so easy and fast to create that there's nearly instant engagement of the students.

One final suggestion, to encourage them to see computers as a "game" of its own, a game where the computer is made to imitate what people can do, while giving them a bit of computer history as well, you can show the movie The Imitation Game about Alan Turing and breaking the German Enigma machine's code.


Why does AP Computer Science A use Java? What are the reasons that AP Computer Science A is using Java as its programming language?
While Java is a great language in general, it has high verbosity, which is quite important for a timed exam.
How about other programming languages, perhaps something more modern, like Rust, Go, or Dart? Or even C++?

Particularly since they have recently removed interfaces and abstract classes, I would say that there are no particularly important philosophical reasons that they are using Java.  At this point, it was a historical decision.
The exam began in Pascal, and when they looked for a way to move towards Object Orientation, they switched (in 1996) to C++.  This was controversial at the time, as Java was very modern and was thought by many to be a conceptually better language, particularly for students.
They switched from C++ to Java in the 2003-2004 school year largely for two reasons:

Java was considered to be a better object-oriented language, particularly with regards to inheritance, and the compiler does a much better job at checking to make sure that beginners aren't doing silly things that they definitely shouldn't be doing.
College programs around the country were taking up Java, so it better reflected the reality of the introductory courses that students would be getting credit for.

You can read the justification for the switch to Java courtesy of the ever-magical wayback machine.
Given the recent changes to the AP Test, it does not appear that there is any particular good pedagogical reason to stick with Java at this point.  In fact, the latest iteration of the test basically ignores the most important features of OO, instead emphasizing a great number of imperative concepts.  However, the testing language is unlikely to change any time soon, as Java is still the dominant language at universities for teaching introductory Computer Science, and these are the institutions that must agree to provide credit if the AP exam is to continue to provide value.


Looking for a text book on object-oriented concepts and programming I'm looking for a text for a course in object oriented programming.  Most of the students will have done some programming courses in the past, but the background of the students is varied so the purpose of this course is to ensure that they are all well grounded in basic programming and object-oriented ideas such as abstraction, design by contract, polymorphic code, generic code, etc.  The language of the course is probably Java, but could also be Python.
I had suggested Barbara Liskov's textbook, Program Development in Java: Abstraction, Specification, and Object-Oriented Design.  But unfortunately it is out of print.  (Although still available as an e-book.)

This is graduate level for a professional masters in computer engineering. However the educational background of the students is quite varied and some are, quite frankly, not competent at programming when they arrive. Hence this fairly low-level course.

My suggestion is "Object Oriented Programming in Python" by Goldwasser & Letscher
https://cs.slu.edu/~goldwamh/oopp/
It's a free PDF download, or you can buy a paper copy.
They have a companion graphics module that is simple to understand for rudimentary GUI applications.
Hope this helps.