Wednesday, July 27, 2016

Advanced Placement CS Principles Off By One Errors

I’m learning about the new AP CS Principles class the week. There is some good stuff in it. On the other hand the arrays in the pseudo code that is used to write language independent questions uses one based indexes rather than zero based arrays. This is going to make things interesting.

Most modern text based languages (C, C++, C#, Java, etc.) all have arrays where the index of the first element is zero. Many block based languages (Scratch for example) have the index of the first array element be a one.

As I understand it the logic behind the decision is to make it easier for students who learn with one based arrays. It does disadvantage students who learn with zero based arrays of course but I suspect the “powers that be” expect most AP CS P courses to be taught using block based languages. They may be right.

My school is still deciding what language to use for APCSP (we’re not offering it for the 2016/2017 school year but the year after) but this issue is one we will have to face eventually. Other schools who are using languages like Java and Python will be facing this issue this year. Oh boy!

I think it would be nice if array based questions on the exam include a reminder comment about the index start. Some will argue that it is covered in the handout and that teachers should prepare their students for this issue. And they would be right but under the stress of answering 74 questions in 120 minutes I think a tad extra reminder would be a good idea. Discuss!


Mike Zamansky said...

If indeed the purpose is to "make it easier" to learn (assuming that who should be a to in the post) then that's a little disturbing.

Isn't this supposed to be a college level course?

Are we saying that college kids can't handle 0 based indexing when taught?

Jim Huggins said...

No, we aren't saying that "college kids can't handle 0-based indexing".

So I'm going to get a little defensive here. So be it.

APCSA gets a lot of abuse because it's "too much" about one particular programming language. So, APCSP is designed to allow any programming language you want. But then the next problem arises: how do you design a test for the algorithmic portions of the course when students can write in any language they like?

The APCSP developers have created a miniature programming language for testing purposes. Guess what? Some programming languages have 0-based arrays, some have 1-based arrays. They made a design choice --- this one among many others.

And now people are complaining because APCSP is too *little* like Java?


Tom Indelicato said...

The Quick Reference that is provided to the students taking the APCS-P Exam does state clearly that "if a list index is less than 1 ... an error message is produced", and "The first element of list is at index 1."

That said, it's frustrating that they're favoring the least powerful languages, rather than raising everyone's knowledge level.

Unknown said...

Sure, it's a design decision, but when you have one organization pushing multiple courses in which one follows another, perhaps they should be paying attention to details such as these.

I know I would.

Alfred Thompson said...

Mike my understanding is that CSP is not intended as a course to take before CS A. I think most people expect students to take one or the other. While some schools will have CSA follow CSP a don't think that is the goal of the College Board.

Mike Zamansky said...

Afred, I think you're right but I don't think that argument holds water (although let me first say that I don't think this specific issue is really that big, rather it's just an example).

Either this course is meant to be followed up with another course or it isn't.

If it isn't meant to be followed up, then it's a terminal course. If that's the case, then if the kids do more programming on their own or otherwise go beyond APCSP, it will be without support and the confusion will arise.

If APCSP is meant to be a student's only exposure to CS then in addition to preparing them with a set of mental tools, it should equip them to do real stuff with those tools so the 0 indexing becomes an issue.

If APCSP is meant to be followed by another course then that course will be a "first in major" course of which APCSA is an example. Again, the 0 indexing becomes an issue.

So, it's a "design the course in a vacuum" choice rather than let's look at the big picture.

Jim Huggins said...

Mike ...

"Either this course is meant to be followed up with another course or it isn't." Why does it have to be one or the other?

APUSH is one of the most popular AP courses being offered. Most students who take APUSH don't go on to become historians. A few do. It serves both markets.

Both sequences (APCSP before or after APCSA) work just fine, as dozens of teachers who are piloting APCSP out there have reported.

Why do you only think about "doing real stuff" as "writing programs in a traditional language"?

Some of these students will go on to doing "real stuff" by writing Excel scripts, where array-based indexing is pretty much irrelevant.

Some of these students will do "real stuff" in languages that don't yet exist, some of which might (GASP!) chose 1-based indexing for arrays.

Or, perhaps, some of those future languages might (DOUBLE GASP!) not even have arrays at all. Aggregate structures like lists are probably better than arrays from a conceptual point of view anyways. We seem to be keeping arrays around in higher-level languages like Java simply to keep the "old guard" happy. ("You can take my arrays away when you pry them from my cold, dead hands ...")

You're concerned that "confusion will arise" when students go beyond the small exposure to software development they had in APCSP because of the choice of 0-based indexing? Seriously? The fact that "real languages" are exponentially larger than can be covered in the small segment of APCSP dedicated to programming will be a much greater source of that confusion.

Mike Zamansky said...

Jim --

If your look back at the beginning of my comment I say that my post isn't really about zero indexing rather it's about what goes in to these design decisions.

I also don't disagree with you on arrays not being the be all and end all.

You're also making some broad assumptions about me and how I think about CS education. Certainly not fair when you don't really know me beyond a few online messages back and forth.

I'm not a fan of DnD languages for high school and beyond. I'm guessing they're good for younger middle school kids or maybe even earlier but as a high school and now (and long time ago) college educator, that's not my wheel house. Funny how (and as I don't know you, I'm NOT including you in this statement) many college professors feel free to make assertions about whats good and right about high school and high school CS education (not to mention how many non educators and people without CS backgrounds but that's another rant).

When I design a course or a program I ask myself what's appropriate and for what reasons. When I looked at the various incarnations of APCSP I determined that the intro I designed in the mid to late 90's (and since evolved) was far superior.

It happened to use NetLogo and Scheme - I don't think you can call either of those traditional languages - both were chosen for a purpose and it worked.

Once again, I don't think the zero indexing is a big deal but just the fact that Alfred brought this up as an issues says to me that the course designers didn't think about APCSP and it's relationship to other CS experiences deeply enough.

But then, what do I know?

Jim Huggins said...

Mike ... funny how you accuse me of making assumptions, and then go on to make your own.

"The course designers didn't think about APCSP and its relationship to other CS experiences deeply enough".

APCSP has been in development for EIGHT YEARS. I know just about as little about its development as you do. But I don't think it's a stretch to conclude that, over the course of EIGHT YEARS of development, there isn't a single element of the course that hasn't been discussed, and debated, and discussed again, and debated again, and finally resolved.

Just because they made a design decision with which you disagree doesn't mean that they "didn't think about it deeply enough".

And, no, I don't have strong opinions about what's best for high school education. I know that I know squat about K-12 (and, in particular, high school) education, and so I defer to those with expertise and experience in those areas --- like all of the high school CS educators that serve on the APCSP development committee, or having been piloting this course in high school classrooms. They seem to think this is a good approach.

Obviously you disagree. Fine; teach your oft-referenced well-developed courses the way that you want. That doesn't mean that you need to throw shade on the EIGHT YEARS of effort that's gone into APCSP.

If APCSP is the wrong approach, it'll collapse of its own accord. It's happened with other AP exams. I'd like to see it actually run for a few years before I draw any conclusions about long-term viability. I like what I'm seeing, and I'd like to see how it scales up in a national offering.

But then, what do I know?

hutch said...

I have taught both concepts of array indexing to high school students and I haven't seen any issues.