8

I like to use an analogy from Finding Nemo. I tell them their programming language has the same problem Dory has - short-term memory loss. When a variable is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory. I've been ...


7

A benefit to OOP often overlooked is encapsulation. The object has data and methods (knows things and does things) that elements outside the object neither have access to, nor even know exists. Only the exposed elements (methods) can be used by other elements to get the expected results. (However that happens.) Build the lab around the "mystery" of an ...


6

I explain this with a saying: What happens in the block stays in the block Now, this isn't exactly how it works, but the idea is that the students remember that what they create in a block, is accessible only inside the block. So: if(shouldGoIntoBlock){ int x=10;//created in the block System.out.println("printed from if body: "+ x); else{ ...


6

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


6

One obvious benefit, which is really a good goal in and of itself, is that students get used to utilizing documentation. Many students don't use the internet as a resource at all, and those that do often wind up on StackOverflow. It has been my experience that the very basic searches that those students often perform wind up at SO pages that are rather too ...


6

I will ask some rhetorical questions below - they aren't meant to be snarky. That, of course, depends on the textbook. I would think that the documentation alone would be a terrible idea. Would you teach a class in Shop by giving each student a box of tools and no instruction? The quality of the official documentation is, as you note, excellent, but there ...


5

After students have explored java's string and math classes I introduce a group project called "Mathey". Each group is to write as many math functions that they can think of and assemble them into their own class. Students seem to like this and are very competitive in coming up with useful math functions and enjoy showing off their work and creativity when ...


5

Here is my system. I give it top marks for ease of sharing, but one downside is that it does not do any kind of autograding without some scripting on my part. I purchased a paid subscription to Dropbox. This allows me to set up read-only folders. At the beginning of the term, I copy/paste all of the names from the course into an Excel spreadsheet and ...


5

I teach my students a bit about the stack as part of the very first lesson of the year. As a result, they are aware coming in that primitive variables are stored next to one another in the stack during runtime, and that the names of the primitive variables that we use in our code are removed by the compiler, and replaced with memory locations. They are ...


5

Disclaimer: some do consider this a war like emacs/vim. I don't. I'll quote you on this: "I'm looking for something that allows students to get up and running relatively quickly and easily with something small yet meaningful". From this: JavaFX. Along with IntelliJ, and Scene Builder, students can build a GUI very, very quickly. The FXML file which "...


5

You shouldn't teach from just documentation or just a textbook. You should teach from both. You should also include in-class live coding sessions and general lectures as well. Each of these things is a tool that covers a different aspect of what students need to be learning. Textbooks can be great for providing a high-level overview. Documentation can be ...


4

You may very well have some examples where you can discuss state machines and hence state diagrams, that is, graphs. For example, if you're creating a game with a computer controlled character, that character might be in different states: pursue, search, attack <-- you can introduce a graph representing the states and transitions. I wrote about this a ...


4

The College of St. Scholastica in Minnesota has a Computer Science Education graduate certificate program. It is a four-course sequence designed to add a CS endorsement to a high school teaching certificate, though no state-issued endorsement exists yet in Minnesota. The courses: Computational Thinking and Standards for the K-12 Teacher CS Principles, ...


4

As states in the US consider requirements to add a CS endorsement to a teaching certificate, the proposals vary widely. The changing landscape is described in the April 2017 EDC document State of the States Landscape Report: State-level Policies Supporting Equitable K-12 Computer Science Education. Iowa SF274, passed June 2017, allocated \$250 thousand for ...


4

Hmm, here are a few ideas: Calculating student GPA where the grades are all stored in an array of arrays, and the different semesters have different numbers of courses. Make a lookup table of prime factors. Consider an array of arrays of paths to hike, and local maximum / local minimum elevations passed along the way. Since there will be a different number ...


4

I would suggest the game KenKen. Although it is played on a square board, one can easily represent the constraints as a ragged array. Represent each constraint as a single line in a file. Each line contains a variable number of "tokens". The first token contains an operation and value (e.g. +6) with the remaining tokens are a list of the cells in that ...


4

Transportation: Presuming that your location has some form of public transportation, there will be intersection points where multiple lines meet. Lacking public transit locally, there is still the nearest commercial airport. In many cities the bus, or rail, system has a hub, which makes a good example for a larger data-set. At the chosen point, multiple ...


3

You should be able to copy/paste block of codes that does not use other variables. But in your examples what if you want to copy/paste that to a code that already declared x? It would not work String x = "Ben I."; ... a lot of code ... ... if (someBooleanCondition){ int x = 7; } else { int x = 0; } System.out.println(x); In that case you want to ...


3

Java, like C/C++ has block scope. When you create a variable in a block, the stack pointer moves to make room for it. When the block ends, the stack pointer moves back. This makes the variable inaccessible. It will be overwritten the next time the stack pointer moves over it. Python and JavaScript have function scope. Note, however that in ECMA 6, the ...


3

In the weeks leading up to the test I typically only use the actual past tests for exactly that reason. But even when I don't use the released FRQs I still grade on a 9 point scale so they get used to it. Here's a few more that tend to come up. For return methods, create a variable of the correct type, do something to it, and return it. If it's a ...


3

I have found jshell to be very useful. It can be used to inspect classes quickly and easily. You can import any standard library class. You can also import user-generated classes using the /open command. It can be very helpful in generating test cases. You can save your explorations to a file by entering /save foo.jsh. You can place them in a main ...


3

I looked at them when they first came out and decided not to use them. Did go through and look at the topics and make sure that we're covering everything we need to in class. But between labs that I've written or purchased we've got a pretty good set of assignments that covered everything that the AP provided labs hit on. The 3 AP labs also lean more ...


3

I don't have criteria with evidence that are indicators of success, but I have some I use that can indicate the lack thereof. At my school, although we are not allowed to specify prerequisites for our courses, the other programming teacher and I "vet" prospective programming students using data from students' literacy and math history (the two of us ...


3

An example which I think could be useful to you, both because it's a "ragged" array and because students are likely to see it again later if you talk about parsing text, is splitting text by line and by character: [ ["G", "o", "o", "d"], ["M", "o", "r", "n", "i", "n", "g"], ["E", "v", "e", "r", "y", "o", "n", "e", "!"] ]


2

My planned approach for AP CS A next year is to have students begin thinking about how to model the world around them using objects. Coming off a year of C programming, the jump to OOP is more a conceptual than a syntactical challenge. One challenge I plan on assigning is to create a class to model a student in high school. What variables are essential? ...


2

Our first Java class has a prereq of procedural programming, so students already know how to write functions. We begin by giving an overview of the type system and the basics of reading an API page. We study the String and BigInteger classes in some depth. They have seen object-based programming in Python, so the waters here are pretty familiar. Our ...


2

I'm a big fan of using real-world data in as many class assignments in APCS A as possible. Small example: I was trying to prove to a group of people just how bad the weather had been in Denver in May 2015. Bad meaning an abundance of precipitation. Off I went to NOAA's website to gather weather precipitation data for Denver for all years on record. ...


2

I think an easier, more natural motivator for objects is aggregate objects. This means you can approach discussion with encapsulation and reuse, and also decomposition of a problem. A classic is a deck object containing card objects. This is still very tricky when you have strong programmers. You want to show how decomposition with objects makes the ...


2

With respect to APCS-A there won't be a difference. Personally, I'm not overly fond of IDEs or one trick pony environments so I've encouraged our students to use an editor. I'm an Emacs wonk but the kids also use Vim, Sublime, DrJava (which is a lightweight IDE) and more. In APCS-A they won't be getting to HUGE programs and to be honest, in my experience, ...


Only top voted, non community-wiki answers of a minimum length are eligible