Showing posts with label APCS. Show all posts
Showing posts with label APCS. Show all posts

Friday, January 09, 2026

Binary Math–Subtracting by Adding

Some of my readers who have been teaching Advanced Placement Computer Science (APCS) will remember the BigInt case study. It was a case study involving mathematics using large (very large) integers. As released by the College Board it supported adding, subtracting, and multiplying large integers. You will notice that division was not included. In fact, asking students to implement division was part of the exam.

BigInt introduced the idea that multiplication was actually multiple addition. By extension, students were to figure out that division is multiple subtraction.

Computer science really requires understanding how mathematics works at a deep level. It becomes obvious (one would hope) when trying to understand how Binary, Octal, and Hexadecimal work. We don’t often spend much if any time trying to understand subtraction though.

Recently, on BlueSky I can across a message by Andrew Virnuls linking to a blog post titled Two's Complement and Negative Binary Numbers that explains subtracting by adding negative numbers.

Let me draw the two previous notes in this post together with some history of mine. Back in my university days I worked on a course connecting some test hardware to a computer. The computer was a Digital Equipment PDP-8. Now the 8 was an interesting machine. It didn’t have a hard drive and it was programmed in assembly language entered in Binary. Where as most computers we use today use hexadecimal representation (base 16) the PDP-8 used Octal (base 8). The word size was 12 bits. Not 64, 32, or even 16 – 12.

This word size places some limits and one of those limits was the number of machine language/ Assembly language instructions. There was no multiply, divide or even subtraction instruction. We had to write code to do those things similar to how code was written in BigInt for those operations. We also had to write code to do subtraction. There was an instruction to create the two’s compliment of a number though. That was handy. So we wrote code to find and use the two’s compliment of a number in order to do subtraction.

We used the subtraction routine to implement division. Though to be honest, we tried to avoid having to do multiplication or division in our project to keep performance reasonable.

I think we’re all glad that today’s computers have a lot more layers of abstraction than the PDP-8 had! Of course, and a lot of students do not realize this, most powerful assembly language instructions are actually the result of what is called microcode that works transparently behind the scenes.

We keep moving up the path of abstraction. Hal Berenson addressed this recently in a post called 98% of Developers can’t program a computer which is actually a bit of a success story including how artificial intelligence is helping with higher levels of abstraction.

Monday, July 07, 2025

Thoughts on Advance Placement Computer Science Results

My Facebook feeds are full of teachers discussing the results their students received on the AP CS exams. Lots of the thrill of “victory” and the agony of “defeat.” I can relate.

The thing is that most of the results are a lot more dependent on the students than the teachers. If the student does the work all course long they are likely to get a good grade on the exam. If they didn’t do the work, especially if they cheated a lot, they are not going to get a good grade no matter what the teacher has done. Even if they did the work a lot of factors the day of the exam can make a big difference.

Sometimes a student takes the exam sick or while over tired. Somethings their boy or girl friend broke up with them the day before. Sometimes the student just doesn’t care about the exam. None of those factors are under the teacher’s control. I had a class of very smart students who all just decided they didn’t care and would blow off the exam. Nothing I could do about it. Guidance wanted to blame me but fortunately there were no long lasting consequences. It was my first year teaching the course and I was given another chance.

Speaking of that first year, my assistant principal, who had taught several AP courses, assured me that it takes most teachers three years to really get the hang of a specific AP course. I believe him. I see too many teacher beating themselves up after their first year teaching AP CS. Most of them have done their best with what they had in the way of curriculum, professional development, and the students who show up in their classroom. They should be happy with the good scores. And happy to have survived. They can learn from this year and move on.

Most of all, remember that the AP exam is one test on one day. Using it as a determination of success for the teach or of the student would be a huge mistake. Life is a marathon not a sprint. Most students will not know for years how much they really learned. It’s usually more than they think after the exam.

Monday, April 21, 2025

Different High School Computer Science Strands

A recent talk by Bjarne Stroustrup at Stanford has sparked some conversation in the Computer Science Educators Facebook group. The talk itself doesn’t seem to be available but it was reported online at The Stanford Daily - C++ creator Bjarne Stroustrup reimagines how coding is taught

There is a lot there and I agree with some things in the article and disagree with others. I have less enthusiasm for C++ as a teaching language, especially in early courses,  for example. I’s like to share some thoughts on the idea of different strands and early courses for different audiences. These are initial thoughts intended to start discussion. I am open to the ideas of others.

First off, I understand that the idea of different first CS courses is difficult at the high school level. Stroustrup seems to be focused, as it seems most university CS faculty are, on the university level. Offering different courses is easier there as the size of both faculty and students tends to be larger. I do think that, where possible, high schools should give the idea some thought.

Stroustrup suggests three strands:

One would serve nonprofessionals, or those who only want basic tools. The second caters to scientists who want to focus on application-based programming instead of theory. The third emphasizes engineers or specialists who want to dive deeper into the complexities of software engineering.

I think universities need a strand for scientists who want to delve into theory. Regardless, I think high schools should consider a different set of strands.

One strand would be less theory and more applications based. Probably using Python or R with a focus on libraries more than theory. Statistics could be included as that would be particularly useful for students in the liberal arts. Skip the data structures that computer scientists love so much. Not everyone needs to spend a lot of time on those. Know what they are and where they fit in but not deeply how they are implemented. It’s more important to understand concepts like normalizing data and how to use libraries.

The second strand would be more theoretical for those students who want to be computer scientists and/or software developers. My time in industry taught me that theory is a lot more important than many self taught developers want to admit. There may be a place for C++ here though I would prefer that early in the strand start with C# (or Java if you must). This is where one would get into data structure implementation, Big O and optimization, and theory of computation.

I do think that in high school either strand should start with something like APCS Principles. It is a good base to start with. True multiple strands are very difficult in most high schools of course. If I had to pick one strand it would be the first one. Why? Because that would serve the most students well. Keep the AP CS A course for the serious CS geeks (my people) and make sure that teachers allow those students to go beyond the basics in the other courses where possible.

We need more students with computing skills and knowledge than we need high schools to turn out computer scientists.

Friday, July 19, 2024

CSTA Day Four

Last day of the conference and I woke up to news of a global network outage that was causing delays in thousands of flights. Including my trip home. Oh well. I wonder if I will need this fan that was in the conference bag at the airport. I hear it is crowded.

I still jumped into the conference though.

My first session was AP Computer Science A: Using Data Files for Authentic Problem Solving. I've been using files in class for a while but not in Java or an AP course. This session was really APCS A teachers who haven't been using data files in class before. So not what I was looking for but I think it was probably super valuable for the target audience. The room was pretty full so I suspect that the addition to the exam requiring file usage is going to make some work for a lot of teachers.

Nest up was Visual Programming Graphics and GUI for Beginning Students. I was surprised by the light attendance. The talk was about an open source package called GUI4Sher. The system was designed based on Visual Basic but for Python. It was also designed to make things easier for students to create graphic, which can be hard in Visual Basic. I don’t think it is really Visual Basic like but it is interesting. I have downloaded it and I do intend to play with it some when I get home. If you are teaching Python it may be worth a look. But it is pretty simplistic.

Last up for the conference is, After the Classroom: Reflecting on the K-12 CS Experience. The reflections of a pair of students was interesting. I think we all appreciated the credit they gave to their teachers.

Honestly, with all the travel mess, I largely stayed to the end to find out where the next two conferences will be located.

2025 – Cleveland OH

2026 – Atlanta, GA

Sunday, December 04, 2022

When Computers Write Code

For most of my career I hive been hearing that some day computers will write all the code and human programmers will no longer be needed. Or at least, not as needed as today. Are we getting close to that time – finally? And if we are what does it mean for teaching computer science?

Recently, the CS education world has been discussing GitHub Copilot.

GitHub Copilot uses the OpenAI Codex to suggest code and entire functions in real-time, right from your editor.

While some of the discussion has been about the suit against Copilot (GitHub Copilot litigation) much of the discussion has centered around what it means as a tool for cheating by students. More recently there has been some visibility to the use of ChatGPT to write answers to programming questions.

For example, this year’s Advent of Code seems to have been “invaded” by ChatGPT climbing the leaderboard by answering the problems is seconds. (Adventures With ChatGPT: Advent of Code Edition | Tabs, Not Spaces) Of, perhaps, even more concern to teachers, ChatGPT seems to be somewhat satisfying as a solution to Advanced Placement Computer Science A questions. (ChatGPT passes the 2022 APCSA free response section)

I’d be very surprised if students are not already using these tools. This brings up several questions. One is - how do teachers keep this from happening? We probably can’t. So how do we detect when it does happen? Do we use these tools ourselves to see what sort of code is generated for our assignments? Seems like yet more work for people who don’t have enough time as it is.

Another question, which students are sure to ask, is what is the purpose of students writing code that artificial intelligence can write easier and faster? If you read the article above about putting the APCS A questions through ChatGPT you’ll see that the results are not prefect. So for the time being it looks like good programmers can still write better code than the AI. How long that will last is anyone’s guess. If history is any guide, it will not last long.

I remember when optimizing compilers started generating more efficient than the world’s best assembly language programmers could write. It was painful for some and a real boon for others. It didn’t completely do away with the need for assembly language programmers but it did reduce the need.

What do we tell students who ask “what’s the point of learning to code?” My thought is that we talk about the need for human oversight of AI generated code. We need to verify that it works as we want it to work and that means we need to understand code. We’re also going to need to fine tune generated code for some time to come. Understanding code will also help write good instructions for the AI that generates code. Again, understanding how code works is important for that.

Of course, there is a lot more to computer science than just writing code. Programming languages are the language of that study. Learning assembly language still helps people understand how computers and computing works. So will learning higher level languages.

The AIs will get better. Our conversations with students will get harder. Cheating is always going to be a challenge. We live in interesting times.

Tuesday, March 08, 2022

APCS A–Java or Python?

There is a lot of discussion about moving the Advanced Placement CS A exam to Python from Java. The Collegeboard is reluctant to do so. They see APCSA as the equivalent to CS1 or the first course for CS majors in university. They cite research that indicates that APCSA students for very well in CS2 (usually data structures) and that CS2 is almost always taught in Java or C++. On the other hand, at many universities the purpose of CS 1 is growing and the audience is widening to include students from many different majors. I wrote about that yesterday (What Should APCS A Really Be About?) Mike Zamansky took it on on his blog as well (SIGCSE 2022 - What language APCS-A part 1 - the intent)

It seems like we have to first agree on the intent or purpose of APCSA (and CS1) before we discuss language. Given that agreement is never going to happen – CS people can’t agree on anything. So I will start my discussion from the standpoint of APCS A should increase diversity in computer science and prepare students for using computing in CS as well as other disciplines.

This is a concepts first decision not a language first decision. I feel that non-CS majors need the same concepts as CS majors. SO what are those concepts? Not a lot changes except that in computing widely APOs are bringing far more critical than they used to. They enable programmers to easily do things that used to be hard. They also more things we used to do early to later in a CS major.

Sorting is one example. With so many libraries to do sorting why should we spend a lot of time in a first course having students write sorts? We know they sorts they will write are not going to be up to the standards and power of sorts they can call that exist already. Algorithms? Surely there are other algorithms we can focus on to help students learn to study problems and developing algorithms?

So if we want to increase the number of students who study computer science beyond the limited scope of would be computer science majors preparing students for CS2 loses some power in the argument. And Python gains some because of all the APIs that are available and all the other disciplines that are already using it.

At SIGCSE, the panel members arguing for Python talked about much of what I write above. They also talked about Python avoiding some of the “cruft” of Java. How much easier “Hello world” is in Python for example. The “other side” focused mostly on the costs of changing and not specific criticisms of Python. There are things about Python that people do raise. It’s dynamic typing rather than Java’s strict typing. I’m a strict typing person myself but I can be open minded. Also the use of white space. Now it is not clear to me that either white space or curly braces have advantages over the other so I see that as a wash as well.

The post panel poll, FWIW, had 57% saying to switch to Python and 28% saying “keep Java” with the rest being answers all over the map.

I have no dog in this fight since I no longer teach AP CS but I am leaning toward that it is time for a change. I like the idea of a high school course, even on modeled on a university course, preparing a wider range of students for a wider range of majors.

The Collegboard is going to do what they want and the costs of changing may be as big a factor as anything. They are also driven by what universities do and as universities revisit the purpose of CS1 that will have more impact on anything anyone in high school has to say.

Mike Zamansky has a different take on this at SIGCSE 2022 - APCS-A Language strengths and weaknesses

Monday, March 07, 2022

What Should APCS A Really Be About?

Perhaps my favorite panel of SIGCSE 2022 was debating the question of should the APCS A course switch its language from Java to Python? During the discussion it occurred to me that there was a bigger question that had to be answered first That is “what is the purpose of APCS A?” Now the normal and obvious answer is that it should be equivalent to university CS1 courses – the first course CS majors take in university. That's too easy and also not helpful.

What should CS1 be all about? Traditionally, CS 1 was a course taken by CS majors and was preparation for the rest of the CS curriculum. Today it is not that simple. Increasingly, other departments in other disciplines are wanting their students to take CS1 or something much like it. Engineering, astronomy, physics, and business are just some of the areas where programming is growing as a tool. The CS department is the best department to teach this first course.

What does that mean? Well, for one thing it opens the door to more programming languages. While Java and C++ are the big languages for a next course for CS majors the same is not true for other departments. Without getting into the language discussion (until my next post) we need to look at what concepts are needed and ask if they are similar enough for everyone.

Owen Astrachan suggested at SIGCSE that the “A” in “APCSA” has traditionally stood for “Algorithm” but should now stand for “API.” Not that we ignore algorithms of course but that APIs were the way computing was increasingly being done. If we look at how non-CS programs are using programming we see that this is very much the case. This probably means that for CS to remain and improve as a teaching, learning, research tool it has to focus on APIs as well.

That is probably only one example of things we should look at changing (in APCSA and CS1) I  get the impression that many university departments are already changing and looking at changes as they see their CS1 course serving more than just CS majors.

Circling back to APCSA in particular, are all of our APCSA students going to major (or minor) in CS? Probably not. Many? Perhaps. But a majority are probably going to move into other areas of study. To we ignore their needs to focus only on future CS majors? That seems a recipe for turning students off from computing completely. High school courses should never be weed out course. One can have a rigorous impactful course without scaring people away from the field.

There is a lot of thinking about what CS1/APSCA should be about and I want to learn more about how university departments are adjusting to today’s  needs for students. Keeping things the way they are today just because we have always done it that way seems a lot less than ideal.

What is your thinking? What should CS1/APCSA be focusing on?

Thursday, May 27, 2021

Othello/Reversi for After the APCS Exam

My good friend and former teaching partner, Tom Indelicato posted about his end of year project for his AP CS A student recently. With his permission I share it with you.

I said goodbye to my seniors today (last day of classes for them). We wrapped up the post-Exam project (I gave them the framework for a Reversi / Othello game, and they wrote an AI for it) by having them play against each other. I put up a randomized tournament bracket, and awarded a $10 Dunks card to the winner.

An incredibly good class of students, they told me that they thought this was the greatest final project ever! I'm gonna miss them.

Tom also generously shared his framework code at https://1drv.ms/u/s!AmXKuaTMPmyCpVBNCyiB0h3t5uWi?e=j9Gv1N

Interestingly, a similar project was in the Nifty Projects session at the CSTA Annual conference in 2018. Unfortunately the GitHub code repository that was associated with it seems to have disappeared. There are other related and useful resources still there at https://sites.google.com/.../roger-jaffe-othello-competition

Most likely Tom's framework would fit along with it with a few minor tweaks.


Monday, January 25, 2021

Does Bad Code Lead to Good Learning?

Last week a teacher posted an interesting problem. They were looking for an explanation of why to code produced the answer that it did. The code is this:

    static void Main(string[] args)
     {
         int x = 2;
         while (x < 12 || (x % 3) != 0)
         {
             x += 3;
         }
         Console.WriteLine(x);
     }
}

The answer, which takes a while to appear, is 12. But why? It turns out that the value of x overflows. It overflows a lot! Eventually the combination of overflows results in a 12 appearing. It’s not at all obvious how this happens or even why this is not an infinite loop.

There was a lot of discussion of this in the AP CS A Teachers Facebook group. I did find it fascinating and wrote some debugging code to see what was going on.

I have to wonder about the value of showing this code to beginners. Or anyone really. What is the value of the learning, if indeed it does teach anything that beginners are ready to learn. Mostly it is not a great plan, in my opinion at least, to rely on number overflows. Different architectures, especially those with different work lengths, are going to take different numbers of iterations. Are they some that would never get to 12? I’m not sure and I don’t like relying on specific architectures.

BTW on my system with a full word this took 1,431,655,765 overflows. With a short it happens after 21,845 overflows. I still don’t know why it takes so many overflows but I am content for now.

In any case, is there value in asking students to figure out why 12 comes out?  I can see people disagreeing on its value as an exercise in debugging. I’m not a fan of it though for a couple of reasons. Firstly, why would you write that code? What is its value? Some people will find it to be an interesting puzzle for the sake of solving a puzzle. I did. But not everyone is “in to” such puzzles.  I think most people want to solve a problem to make something work and do something interesting.

I’m also not fond of code that is unclear as to its purpose and goal. In the Facebook group there were a lot of comments from experienced teachers who expected something completely different from the code. Infinite loops being the most common expectation. In fact, that this isn’t an infinite loop is highly unexpected. Code should be written so that someone can figure out what it does without actually executing the code. Especially for beginners.

Now I am not going to be critical of a teacher who does see value in this particular exercise but it’s not for me. As educators we often do create code just for the purpose of highlighting a specific language feature and small, not very useful pieces of code, often make up quiz/test questions for the sake of space and time. But for the most part I believe that students learn better with more context and with code that solves an interesting – to them – problem.

Related posts:

Friday, December 27, 2019

Looking Back on Computer Science Education 2019

Christmas break for me until 6 January 2020 and with Christmas over I have some time to think. 2019 was an intere3sting year in CS education. States continue to adopt more CS in K12. Teachers are still in short supply but so to are schools looking to hire them. Schools or perhaps school administrations and school boards, are slow to roll out more CS education. It looks like more schools are offering it which is great. But they are net requiring it so while they meet to checklist of offering CS it is still not for everyone. It’s going to take a while.

AP CS Principles continues to grow in enrollment. I try to get excited about that but it’s hard. AP courses attract too small a subset of the over all population. While there is much to like about AP CS Principles I can’t help but believe we need some more interesting CS courses. Something with depth and an interesting and motivating outcome. The Create task is not that.

Every year I think that the Internet of Things will take off in CS education. The mix of bytes and atoms seems like a natural to me. That didn’t happen in 2019. Perhaps because there is no one promoting it.  I plan on retiring from the classroom in the spring. Maybe after that I will have to time to really dig into it. Who knows, maybe I’ll come up with some good project ideas.

Cloud computing grew a bit in interest in 2019. Amazon Web Services has done some great work on this. Uptake has been slow but at some point it may take off. The problem with cloud computing, and perhaps IoT, is fitting it into the curriculum. It doesn’t fit easily in either AP CS course and too many teachers are working and teaching too many preps to adopt major new topics.

Artificial Intelligence took a jump in interest that surprised me a bit. There was a huge birds of a feature on the topic at last summer’s CSTA conference. AI for K12 has its own website, mailing list, and lots of people interested. See AI4K12.org for more on that.

What sort of Artificial Intelligence can you teach in K-12? Mostly how it is used, how to use existing AI tool and machine learning training systems. Developing real AI takes a lot of math that not many K-12 students have yet. Still, it is very important that students learn this much. The need to know what AI/ML is, how it is used, and discuss the ethnical considerations involved.

As always,the new year is full of potential. K12 CS is on a growing path that seems to have some momentum behind it.  I can’t wait to see what it brings.

Thursday, December 12, 2019

Explain This Confusing Code

My major task today has been finishing off the semester exam for my Advanced Placement Computer Science Principles students. They’re not happy about having an exam but that’s life. Writing a good exam is difficult. Fortunately I have some previous exams to work with. Some I wrote, some other AP CS P teachers wrote. I’m getting close to done. I want to have AP exam style questions to help my students prepare for the actual AP exam in the spring but of course the main purpose is to put a grade in the grade book. OK I’m half kidding. I seriously want to get a handle on what information they have learned and what I should review before we move on.

Coincidently someone posted a question for the AP CS A question bank on Facebook asking for help with explaining it.

How does this evaluate for Java: x / 10 % 2 ?

This is exactly the sort of question that had one of my APCS A students some years ago say there were a lot of examples of poor coding practice in the AP Exam. And this, in my opinion, is a terrible coding practice. I can understand why the question may be attractive to some. The whole order of operations thing. Students should understand it. But good coding practice is to avoid ambiguity and this code is loaded with ambiguity.

Is this integer division? 10 looks like an integer to me. Making it 10.0 would make it look like a floating point number of course. How do you make “x” look like a specific data type? This is not FORTRAN IV where it would be a double since it doesn’t start with a letter from “i” through “n.” And remembering the order of precedence between modulus and division? Who has room in their brain for that to be top of mind?

This makes a great discussion question. A great question to emphasis the need to use parentheses to remove ambiguity. There is no way it would pass code review in a professional development environment though. At least not a review I want to be part of.

Well, I should go finish writing my test and trying to avoid writing horrible questions.

Sunday, June 09, 2019

Change the Programming Language, Change the Course

A recent Facebook post suggested changing the language for Advanced Placement Computer Science A (what some of us annoy others by calling AP Java). This comes up regularly with lots of people suggesting their favorite language. Changing the programming languages means changing a lot more than the language though.

Different programming languages have their own idioms. Their own way of doing things. Programming languages and the concepts one can teach with them are closely related.The change to Java (and to some extent C++ before it) was based on a desire to teach more object oriented programming and design. The language was picked after the concepts to teach were chosen.

I wonder how often we (CS teachers) pick a language first though. DO we pick the concepts to teach based on the languages and the programming idiom we are familiar with or do we  think wider?

My honors programming course is largely a warm up for AP CS A and preparing students with the concepts they’ll need is a goal. I use C# rather than Java though because it seems to me (without the sort of research based evidence I should probably look for) that it has a lower cognitive load than Java. It seems to work for us.

My APCS Principles class is using the curriculum and tools developed by code.org. It uses their block based App Lab with the option to use/view JavaScript. This language and tool does appear to be based on the concepts rather than fitting the concepts in after the fact. So I’m happy with that.

One thing I will be pondering over the summer is what concepts should I teach. Am I teaching the right concepts or should I change them? What about cognitive load? I was re-reading How to choose programming languages for learners: Reviewing JavaScript and Ready by Mark Guzdial and his points about cognitive load really resonate with me.

Block languages do seem, based on evidence, to have lower cognitive load for beginners. I’m less comfortable with them; probably because I’m so old school. Student attitudes towards them are mixed with some really loving the low cognitive load and some having trouble taking them seriously. I have to keep in mind the concepts I want to teach as well.

No matter how I look at it though it is never as easy as “just teach the same things the same way but with a different programming language.”

Thursday, March 14, 2019

Awards I Wish We Didn’t Need

Last week my school was told we had earned the College Board’s Female Diversity award for both Advanced Placement Computer Science A and Advanced Placement Computer Science Principles based on how many female students we had in those courses last school year. Yeah!

We’re one of two schools in the state to get this recognition. That’s a bit disappointing. The more I thought about it the more I thought how sad that getting to adequate female representation was so rare that schools were getting special recognition for it. Are there similar awards for other AP courses? Are their awards for schools for getting to Male Diversity numbers in courses were male students are underrepresented? Is that even a thing?

Don’t get me wrong. I am thrilled that we have good representation of female students in our AP CS courses. And I’m not shy about sharing news of the College Board's recognition. 

It’s hard to get solid APCS enrolment period. I teach at a private Catholic school that requires four full years of religion. That has a serious impact on electives. We have even better female representation in our lower level CS courses because we require a full year of CS for graduation. AP CS is going to be an elective so we have to have a good environment to get students to want to fit it in.

With cultural norms the way there are, a lot of female students are encouraged to follow other academic paths. World languages, for example, fit the stereotype and it often feels like that is a more common, if not natural, path for female students. And the boys seem to be less excited about languages.

Our goal at my school is to ensure that all students are comfortable and feel like they belong in computer science courses. We are careful about room decorations. You’ll see women in computing highlighted in posters and bulletin board items for example. I think the most effective effort it that teachers encourage all students, reassure them that they mistakes they make don’t mean they are stupid or incapable, and include projects that are not gender biased. You know, be a good teacher.

For now we all need to make efforts to include a more diverse set of students. And it is nice to be recognized for the success of those efforts. But I’ll tell you, having a diverse group of students is all the reward I really need.

Monday, March 11, 2019

Don’t Cross The Data Types

Remember in the first Ghostbusters movie where the ghostbusters are told not to cross the stream of their ghost busting guns? And then at the end they do cross the streams? Mixing data types is like that some times. You really have to know what you are doing when you mix data types.

The Facebook group for AP CS A teachers recently had this Java example:

Can anyone explain why a + b is NaN but a+=b is zero?
int a = 0;
int x = 0, y = 0;
double b = (double)x/y;
System.out.println("a: "+ a);
System.out.println("b: "+ b);
System.out.println("a + b: "+(a+b));
a += b;
System.out.println("a(2): " + a);

//output

a: 0
b: NaN
a + b: NaN
a(2): 0

NaN is not a number and is the result of the divide by zero. You probably shouldn’t do that anyway but it happens. What is interesting here is the different way that (a + b) is handled compared to a += b

a += b does a conversion of b to integer before it does the addition while (a + b) does a conversion of a to double. That explains the different results. Of course if you were to do a = (a + b) you would probably get a compiler complaint. I think. I know you would in C# but I haven’t tried Java yet. FWIW C# also complains about a += b and demands an explicit cast. Different languages and compilers handle these things differently.

So what is the message here? I think the message is that programmers should usually make explicit casts when they mix variable types. Maybe you know what will be cast to what for different variable types and different operations but a) how much do you want to bet you’re right and b) how much to you want to bet that the next person to look at your code will understand what is going on behind the scenes?

Mixing types causes a lot of confusion for beginners. SO does how numbers are stored (some kids never seem to understand that 0.1 is an infinitely repeating fraction in binary and what that means) of course. Encouraging students to cast or at least to be very careful about the types they use and the types they mix is an important lesson.

Tuesday, January 01, 2019

Happy New Year 2019

I’ve been thinking about this post for the last several days. My usual practice has been to start the year with a list of things I want to watch in CS education during the coming year. As I look at last year’s list (see Looking Back on CS Education in 2018) I don’t see a good list for this year. The things I’ve been watching have largely matured. The next big growth area is not clear to me.

Sure we’re making progress in getting computer science education for more and more people. Of course there is more to do and room for growth but it feels like momentum is going to carry us through.

So this year I am thinking about what I can do to give my students an edge. What can I shoehorn into my curriculum that will go beyond the average. There are people who way ahead of me of course. Doug Bergman and David Renton at Porter-Gaud School are doing amazing things. A number of the career/technical schools I know of have room in their curriculum for a lot of things I haven’t been able to fit into mine. Likewise, there are a number of magnet schools covering some really advanced topics. Most of these have more room in their curriculum for CS than my school. That means I need to do things differently.

I suspect that most teachers at comprehensive or college prep schools have some similar time limitations. We have room for only so many courses. In may case I have what seems like a lot of options. We teach some programming in our freshmen course (it’s only one semester long and we cram a lot in already). I have a one semester honors programming and a one semester mobile application programming course. In both of those we get students to the point that they can do interesting things and then the semester is over.

We offer both Advanced Placement Computer Science courses. They're both a full year long but it feels like they are pretty constrained. I only teach the Principles version so playing with APCS A is a moot point for me.

The AP courses are a problem of sorts. As they say, a blessing and a curse. Parents and administrators love them. They help make schools look good to parents. They make students look good to college admissions officers.  There is lots of well-developed curriculum and professional development for teachers. What’s not to like?

But you wind up teaching to the test. It’s almost unavoidable. Your curriculum plan has to be approved by the CollegeBoard for starters.  While you can get clever about things like projects, tools, and for APCSP even languages there is always that constraint about what is on the test that you have to focus on. If APCS is the only course one teaches you probably have the type and energy to get really creative. If you teach four different courses (as I do) it can be a bit overwhelming to make big changes to the AP CS course.

The path of least resistance (for me teaching APCSP) is to use the developed curriculum and teach using that. The code.org APCSP curriculum, which I am using,  is pretty amazing for teaching that course. Since I have two other courses I teach alone based on self-developed curriculum there is some strong motivation to spend time on those.

What I want to squeeze in somewhere are cloud computing, Artificial Intelligence, and Virtual Reality development. I don’t really know enough about any of these to know how hard it will be to fit any of them in or where they would fit logically. If I had a year long course after my honors programming class that wasn’t constrained by the AP curriculum I would recruit a group of smart curious students (plenty of them around) and we’d all learn together. Alas, that is not currently an option for me.

My current thinking is to try and learn more about one or two of these on my own and by the summer have an idea where I can fit some of it. Amazon Web Services has AWS Educate which I have signed up for. It has a bunch of free resources and training. Seems like a good place to start learning the cloud. It looks pretty well set up for teachers as well. SO that is the cloud piece.
Next is either VR or AI. VR requires some hardware to do right as far as I can tell so I have to factor that in. Both AWS and Microsoft have some AI that can be used. Since I already know about the AWS resources I may start there with AI.

VR is pretty exciting as well and there are some great resources for using Unity with C# for that. I already teach C# using Visual Studio so going the VR route may be a good option.

I hope to get my current semester long courses in good enough shape during the school year that I can really deep dive into the cloud, AI, and VR over the summer. Not that I will wait until then to start but that will be when I can get deepest. And of course the search for resources for my own learning, for teaching, and for making this stuff fit goes on all the time. Let me know if you have links to share.
So basically my message is, 2019 has some serious potential.

Saturday, October 27, 2018

CSTA New England Regional Conference 2018

cstaNEThis is the second of these conferences. How I missed the first year I don’t remember but I’m glad I made it to this one. The conference was held at Rhode Island College. I got some good things from it.

We started with some welcoming remarks from the president of the college, the Rhode Island Commissioner of Education and a few others. It is clear that there is some strong support for improving CS education in Rhode Island from the state and from the universities. Rhode Island has made some great strides with hundreds of teachers trained in the last 2 and a half years. The have also expanded APCS into 78% of the state's high school.

We than heard from a panel of representatives from the state Departments of Education from all of the New England states. IT was interesting to hear how the different states are progressing towards expanding CS education. Several people said that their state was "working to catch up." Given how little CS education had a few years ago and how much a lot of states are working I don't see these states as behind other states that much. Behind where they want to be is a whole different question. It is probably good that the various states don't want to fall behind other states.

Next came concurrent sessions. Lots of concurrent sessions. Some were an hour long and some sessions were a set of three flash talks. I went to flash talks. Now the flash talks were good and I got value from them but I wish some of them had been longer. The committee might want to think about making some tough decisions and have fewer presenters but for longer sessions. Anyway.

Elizabeth Patterson @EPPHS presented two flash sessions. One was on teaching binary, an interest of mine from way back, and shared the resources she uses at:  https://goo.gl/9qNt3i  Her second session (after lunch) was on sorting (another fun topic) and she again shared resources at https://goo.gl/uAz2t5 I’ll be spending some time looking through  them for my own practice. This is exactly the sort of sharing we as CS educators should be doing more of.

I also attended two sessions by representatives from the Lesley University STEAM Learning Lab. One was on visualizing computation with 3D modeling and printing. Very interesting and I got a few ideas but this one would really have benefited from being a lot longer that n15 minutes. Now that I know about them and their programs I’ll be spending some time at their web site looking for resources that I can use. Their other session was on physical computing. .I didn’t hear much new here but again I think the time limit was more responsible than the presenters. They clearly had a lot more to share than they could in 15 minutes.

Fred Martin, UMass Lowell and the CSTA Board, talked about rethinking computational thinking. There  is a lot of talk about that lately and I liked Fred’s take on it. Fred’s slides are at cstane2018-fredm He concludes with “CT is the “connecting tissue” between the world of computer science / programming expertise and the world of disciplinary knowledge”  I think I like that as much as any definition of CT I have read lately.

Karen Lang, MIT Appinventor, gave a talk on new and coming features for AppInventor. Tutorials seem interesting as does the new CloudDB which seems like a big improvement for data storage. There is a new emulator available for MacOS and a new one for Windows is coming. That’s good news. Also the companion app for iPhones has been submitted to Apple for the Apple store. At some point Apple will (we all hope) approve it and students will be able to put AppInventor apps on iPhones.

Chad Williams, Central Connecticut State University, shared some of his ideas about teaching cryptography. I hope to get his slides because he has some good stuff that I hope to write more about at some point. Since this subject is coming up soon in my AP CS Principles course I can put some of this to work.

Overall, this was a great little conference. I did some networking between sessions. Connecting with old friends, meeting some new people, and getting ideas from informal conversation as well and sessions. The food was good. We had a real breakfast – eggs, potatoes, sausage plus healthy stuff. Box lunches with good sandwiches and vegetarian options. Let’s pretend I didn’t eat the brownies that were available for snacks.

Hopefully there will be a third conference next year.

Friday, September 28, 2018

Girls in APCS Research

Are you an Advanced Placement Computer Science teacher?

Are you concerned about increasing the number of women in computing? 

Are you willing to help out a fellow teacher with a research project?

If so, please find the time to help Derek Miller. There is a link after the introduction to Derek and his project.Thanks.


Derek Miller is a computer science teacher from the suburbs of Chicago and has been an AP grader for five years. He is currently working on his dissertation and needs as many AP Computer Science teachers as possible to take a 20-minute survey. The results of the survey and follow-up interviews with a handful of participants will hopefully generate some ideas to help recruit and retain more girls in computer science classes. All participants will receive the research results so hopefully everyone will learn something by taking the survey. If you have any questions, please let Derek know by emailing him at Z1717366@students.niu.edu.

Girls in AP CS Survey Link