Essential topics for an intro course (not)

What essential topics should we teach in our intro courses? This seems to be a recurring topic recently.

It can be an important topic but, unfortunately, too often, it seems that people have too myopic a view

I remember thinking about this years ago when APCS moved from C++ to Java. Both languages have good and bad points both for practical and educational use. A big loss in the move to Java was memory management and the topics you could cover when memory issues arose.

Of course one might say that memory management shouldn't be in the first year of CS. That's fine, as long as you put it back in somewhere later on - something that didn't seem to happen universally.

That's the myopic view - far too few look at the overall picture.

C++ to Java ended up in removing a topic. I've also seen the reverse. I was talking to a friend about intro topics. He told me that it was critical to cover (insert topic here) in an intro course. Why, I asked? Because the kids absolutely needed to know that material in the third year course he was teaching.

I pressed a bit – "how many kids actually remember (insert topic here) and do you have to reteach anything." The answer - pretty much no one remembered and he always retaught the subject.

Did this mean that no one taught the topic in the earlier class? Unlikely. More likely is that the topic was taught without purpose or context, just because it was supposed to be taught and thus the knowledge wasn't retained. Sounds to me like the topic wasn't in the right place to begin with. Maybe it should have just been taught in that 300 level course to begin with.

Alfred Thompson wrote a post earlier today asking about teaching number bases.

Is it important? Maybe. Is it essential for an intro course? Probably not.

Binary makes sense when you start talking about low level stuff. If your intro course never gets close to the machine then why muddy the water with a topic that's out of place. The topic probably won't be appreciated and retention and understanding will be low.

If your intro course gets close to the machine or if you decide to talk about compiled code or similar topics, you have an entre to talk binary which leads to the convenience of hexadecimal. At Stuyvesant, it was much more sensible to talk about number bases in our systems course when we looked at C code in a debugger rather than in our intro our AP course.

You also might work on some application where bitmaps or similar as useful. That might be another good time to talk about number bases.

Is it important for a CS person to understand binary and it's relation to digital computers? Certainly. Does it have to be studied day one? Certainly not.

We need to keep an eye on the big picture. You can't get everything into a single class or a single yea. The question to ask is - do our students know what they have to by the time they leave our charge?

Using Emacs - 26 - Google Calendar, Org Agenda

A while ago I did a couple of videos on how I use org-capture (part 1, part 2). I didn't get into a big part of org-capture - how I use org-mode and capture to manage my calendar and todo lists.

I was waiting to see if I liked my current setup - using org-gcal to sync with my Google Calendar for appointments while using my main org file for my todo list.

Coincidentally, Rainer König recently put up a video on how he syncs with his Google calendar. He uses a different method than the one I present in this video so make sure to check out his approach. In fact, you should check out his entire series on org-mode.

Here's the code I use install org-gcal. The video steps through setting up things on the Google side. You'll have to replace the client ID and client secrets in the code below as well as use your calendar name and whatever org file you want to sync with.

(setq package-check-signature nil)


(use-package org-gcal
  :ensure t
  :config
  (setq org-gcal-client-id "oauth 2.0 client ID"
	org-gcal-client-secret "client secret"
	org-gcal-file-alist '(("zamansky@gmail.com" .  "~/Dropbox/orgfiles/gcal.org"))))

I use these two hooks to sync things semi-automatically. The first hook syncs whenever I load the agenda. Since this happens in the background, if I just added something to my calendar, I might have to reload the agenda by hitting r in the agenda view.

The second hook syncs with my Google calendar when I capture.

(add-hook 'org-agenda-mode-hook (lambda () (org-gcal-sync) ))
(add-hook 'org-capture-after-finalize-hook (lambda () (org-gcal-sync) ))

Here are the rest of my settings. The org files I want to include in my agenda views:

  • gcal.org – the one I'm syncing
  • i.org – my main org file for todo items (the todo capture places things in here)
  • schedule.org – my old schedule before I was syncing with Google. Not active anymore. I should probably remove it.

Also, my capture settings:

(setq org-agenda-files (list "~/Dropbox/orgfiles/gcal.org"
			     "~/Dropbox/orgfiles/i.org"
			     "~/Dropbox/orgfiles/schedule.org"))


(setq org-capture-templates
      '(("a" "Appointment" entry (file  "~/Dropbox/orgfiles/gcal.org" )
	 "* %?\n\n%^T\n\n:PROPERTIES:\n\n:END:\n\n")
	("l" "Link" entry (file+headline "~/Dropbox/orgfiles/links.org" "Links")
	 "* %? %^L %^g \n%T" :prepend t)
	("b" "Blog idea" entry (file+headline "~/Dropbox/orgfiles/i.org" "Blog Topics:")
	 "* %?\n%T" :prepend t)
	("t" "To Do Item" entry (file+headline "~/Dropbox/orgfiles/i.org" "To Do")
	 "* TODO %?\n%u" :prepend t)
	("n" "Note" entry (file+headline "~/Dropbox/orgfiles/i.org" "Note space")
	 "* %?\n%u" :prepend t)
	("j" "Journal" entry (file+datetree "~/Dropbox/journal.org")
	 "* %?\nEntered on %U\n  %i\n  %a")
	("s" "Screencast" entry (file "~/Dropbox/orgfiles/screencastnotes.org")
	 "* %?\n%i\n")))

The end result is that I can add an event in my Google calendar (or accept a calendar invite) and it appears in my org-mode agenda. Likewise, I can add a scheduled event using capture and it will sync up to Google. I can also just add an event by editing gcal.org but then would have to run org-gcal-post-at-point to send it up to Google.

Now, I can use bring up a regular agenda C-a a, my todo list C-a t or by adding a custom agenda command:

(setq org-agenda-custom-commands
      '(("c" "Simple agenda view"
	 ((agenda "")
	  (alltodo "")))))

a combined agenda and todo view using C-a n

Finally, there's calfw. It's a nice tool to view calendars in Google. I don't use it much anymore but it is nice:

(use-package calfw
  :ensure ;TODO: 
  :config
  (require 'calfw) 
  (require 'calfw-org)
  (setq cfw:org-overwrite-default-keybinding t)
  (require 'calfw-ical)

  (defun mycalendar ()
    (interactive)
    (cfw:open-calendar-buffer
     :contents-sources
     (list
      ;; (cfw:org-create-source "Green")  ; orgmode source
      (cfw:ical-create-source "gcal" "https://somecalnedaraddress" "IndianRed") ; devorah calender
      (cfw:ical-create-source "gcal" "https://anothercalendaraddress" "IndianRed") ; google calendar ICS
      ))) 
  (setq cfw:org-overwrite-default-keybinding t))

(use-package calfw-gcal
	:ensure t
	:config
	(require 'calfw-gcal))

Enjoy.

Better version:

Old, bad version:

BS? - BA - addendum

Over on Facebook, a friend commented on my last post. He commented on the rigor of BA vs BS degrees. The comment mentioned Physics and Math degrees but I thought Id follow up a bit on CS degrees.

I took a quick look at three computer science programs - Cornell, UMich, and Queens College. Cornell because my daughter is there, UMich, my son, and Queens College because it's a CUNY college that offers both a BS and a BA in computer science.

Cornell

Here's a link to Cornell's CS Major page. Same requirements for a BA through their School of Arts and Sciences as for their BS in the School of Engineering. The differences are limited to the fundamental school differences.

University of Michigan

Info on their program can be found here. They note:

  • Identical Core Computer Science requirements
  • Similar Senior Design experiences
  • Identical Upper Level Elective requirement
  • Slight difference in Flexible Technical Elective hours and list

Again, the difference is fundamentally in the base school requirements.

Queens College

This page has links to degree requirements. THe page states that "The B.S. augments the B.A. with more computer science, mathematics, and experimental laboratory courses" but when you look at the actual BS and BA requirements, they're the same.

In all cases, the differences are the fundamental difference between the extra liberal arts and distribution requirements in an Arts and Sciences school and the extra science and math courses required of an engineering school.

Which is better? It all depends. For me, personally, the liberal arts education is very important. For others, it will be the deep dive into science. Maybe more phyics will better enable a CS major to solve some technical problem but then again, maybe a culteral anthropology course will help a CS major see the world and people differently and also color her work.

To my original point - the important thing is that we do a better job informing guidance counselors, teachers, and high school students as to the possibilities so that they can make informed decisions.

BS? - BA

I didn't know Hunter College had computer science.

I heard that refrain more than once during my fall visits to high schools. Part of the reason for this is due to Hunter CS's low profile and small size in spite of its high quality.

Part, though, was also because of some misconceptions about Computer Science programs. I'd hear things like "but they only offer a BA not a BS," or "but Hunter isn't an engineering school."

I've come to realize that we have to do a better job educating kids as to what can come next after high school.

I'm not entirely sure why many assume that CS has to be under engineering. When I was applying to college, most of my choices were Arts and Science schools offering BAs in CS. Maybe it's because people don't disagregate STEM subjects. Even though it's not a computer science program many schools seem to associate FIRST robotics with computer science. Likewise any class with even a modicum of coding becomes computer science and as makerspaces and robotics are a percieved as easy entry STEM classes that appear to be CS (something I'll rant about in a future post), CS becomes associated with engineering.

It's easy enough to explain the difference between a BA in CS and a BS in CS and it's equally easy to show that you can have tremendous success either way. All you have to do to show the validity of a BA in CS is look at succesful people from places like NYU, Courant, Columbia College (as opposed to Columbia Engineering), Cornell school of Arts and Sciences, etc to balance successful people from the engineering schools.

As I'm sure you know, I'm pretty high on Hunter CS and it's certainly one of the best value CS educations out there. Personally, I'm a big believer in a liberal arts education but in any case, as a community we have to do a better job educating the high schools so that graduating seniors are best informed when deciding on their futures.

Using Emacs - 25 - Tramp

Today's video talks about using emacs Tramp mode.

Tramp mode allows you to edit remote files using your local emacs. I usually do this over ssh.

To edit a file on a machine www.cstuy.org I would first find-file using C-c C-f and then for the file name to open:

/ssh:www.cstuy.org:/home/zamansky/sc/testfile

this would open the file testfile in the absolute directory /home/zamansky/sc. If my username on the remote machine is different:

/ssh:username@www.cstuy.org:/home/zamansky/sc/testfile

And I can also work relative to my home directory:

/ssh:username@www.cstuy.org:sc/testfile

If I just hit enter after the machine name and : -

/ssh:username@www.cstuy.org:

I end up in a dired buffer on the remote machine.

Likewise if I run a shell or eshell in the tramp buffer, it will run the shell on the remote machine. In the video I showed how shell didn't work because locally, I'm configured to use zsh and I don't have zsh installed remotely. Eshell, however, worked fine.

Using tramp in this way gives us all of the power of our local emacs configuration to edit a file on a remote machine.

You can also use tramp to edit local files as root using sudo:

sudo::/tmp/sc/rootfile

Note the double colon.

Finally, you can do the double-whammy - remote root editing:

ssh::www.cstu.org|sudo:www.cstuy.org:/home/zamansky/sc/rootfile

If you use zsh and any of this freezes, just do a search on "zsh tramp" and the top couple of hits will tell you what to add to your configuration files to fix things.

Finally, I mentioned in the video that I don't use tramp all that much anymore. That's mostly because I don't do much remote editing anymore. I used it more when I was administering a number of machines at Stuyvesant.

I still use it periodically, but I also use sshfs, a Linux tool (which may be available for other operating systems) that allows me to mount a directory tree from a remote machine and use it on my local machine.

Being productive between terms

We're now at the end of my first semester at Hunter. The Spring term classes don't start until the end of January. I've got an assortment of projects to work on but some of the students should have a nice block of relatively free time.

I wanted to share some recommendations on things to explore with a few student groups and thought it would be easier to write those recommendations down here once and then just share a link.

So, here we go.

Much of the first few CS classes at Hunter and elsewhere focus on the fundamentals of programming, data structures, and algorithms. It's all good stuff but students want to supplement that classroom knowledge with some practical skills.

I recommend playing with a language like Python that can be used in all sorts of domains. If you haven't played with it, check it out.

I like Automate the Boring Stuff with Python as a nice, free, online text.

I'd also recommend learning a web platform like Flask. Flask is a web framework in Python. The web site has a nice getting started guide and tutorial but here are a couple of other great learning Flask resources:

Once armed with the above, you'll be well positioned to work on a variety of your own projects, enter hackathons, and more.

I'm also a big believer in using good tools. I love the emacs text editor. Why not spend some time going through the web series on Using Emacs.

Finally, if you're not using Git, you should be. Here are a couple of playlists to get you started:

And if you haven't done so already, head over to Github Education and sign up for a student developer pack.

So, there are a few recommendations on things to work on before the next term begins.

Enjoy

It gets easier (or advent of code 2016 day 19)

Today's Advent of Code problem was a variant on the Josephus problem.

I recalled that there was a formula to figure out the sole survivor but I decide to run a simulation rather than looking it up. I also decided to write it up in C++, well, really C with cout instead of printf.

Part 1 was the traditional problem. Part 2 was a variant where at each iteration, you remove the elf opposite the elf being processed (see the problem description for details).

For both solutions I coded up a circular doubly linked list:

struct node *make_ring(int size){
  int i;
  struct node *n;
  struct node *current,*first;

  first = (struct node *)malloc(sizeof(struct node));
  first->id=1;
  current=first;

  for  (i=0;i<size-1;i++){
    n=(struct node *)malloc(sizeof(struct node));
    n->id=i+1;
    n->prev=current;
    current->next=n;
    current=n;

  }
  current->next=first;
  first->prev=current;
  return first;

}

You can see my complete solutions here.

I was thinking about how I wrote the code – I just rolled it off the top of my head. The same was true for the earlier AoC problems where I had to implement a breadth first search or something similar.

I'm not making a statement about my amazing coding abilities - linked lists and graph searches are pretty basic, but rather than having done the CS thing for so long, these fundamentals have become somewhat routine. I haven't really written C code in years but other than a couple of typos (and a stupid mistake in calculating steps) things worked right off the bat.

I remember a time when I was in college or even a young professional when I would use an array and an index as a stack or queue - not because it made more sense but rather, because I wasn't fully comfortable with memory manipulation and linked lists. The same could be said for my first few years working with anything more than the simplest recursion.

All of this is to say that it does get easier.

Things that seem trivial to us now seemed insurmountable when we were beginners. Last year, I wrote about an overnight homework assignment I gave to my class that would have been a final project a year earlier (the post is here but the homework links are no longer active) and a few weeks ago I recall a fellow CS teacher talking about how much longer it takes his students to write a chunk of code than it takes the teacher.

New things are challenging and take time but with practice and persistence techniques that were once daunting can become tools ready at our disposal to use on a whim.

A couple of things I learned from Danny Jaye

I got an email from my good friend and mentor this weekend. Danny Jaye, after 45 years, is finally retiring for real.

Danny, the Maestro, or Doc, as we sometimes called him spent most of his career at Stuyvesant. First as a math teacher, then math chair. Danny also spent time as the director of the Bergen Academies and his last few years as the Chief Academic Officer at Solomon Schecter in Bergen.

Danny's always been a master teacher - back in the day, he managed to teach Calculus to my brother - no small feat and as a department and school leader, he has a great eye for collecting and developing talent. Over the years, Danny's influenced a number people who've gone on to be education leaders of one form or another.

For me, Danny was and continues to be a great mentor. I can't tell you how much I learned - much of it on our 5:00am bike rides from Stuy up to the GW bridge and back.

Far too much to share here but let me drop a couple of thoughts:

It doesn't cost anything to be nice.

and the related:

It's easy to be nice on a good day.

The former talking about treating everyone with respect regardless of station and the latter a reminder not to forget it on a bad day. Also a valuable reminder when sizing up new school leaders.

We'd spend hours discussing class, departmental, and school strategies. How to develop a program with safety nets, how to separate real value from the hypes and how to always remember that it's the student first and the big picture, not just our little corner of the world.

It feels weird for me to know that my go to guy on Ed stuff is no longer working and is now moving towards a life of leisure.

It doesn't change anything other than a reminder to me that I'm now one of the more senior people in my circles and that now Danny can mock me for having to go in to the office every day.

So, here's to you Danny – one of the best education people out there.

Rookie Season Redux

Today was the last day of classes at Hunter thus ending my first semester of teaching at Hunter College.

I very much enjoyed the semester and my class and look forward to working with the same group when the spring term starts in a few weeks.

At the same time, even though I'm a quarter century veteran teacher, in many ways this was like my rookie season all over again.

My class was an honors intro class so the material wasn't new to me but there were a number of adjustments going from high school to college.

I taught a few college classes as an adjunct back in the nineties but I was a young teacher at the time and that was a lifetime ago.

The biggest difference is that we only met two days a week. Monday and Thursday and we met for 1:45 rather than 45 minutes. The longer class is nice but the twice a week means that you don't get that every day reinforcement you have in high school.

It also means that there were times when we would go a week between classes due to a single day off.

The biggest challenge, one that I'm continuing to work on, is figuring out how much we can do in a class, what and how much to assign between classes and what's the best way to motivate the student's to space out the work while doing something every day.

That wasn't much of a challenge at Stuy. Having been there so long, I had a good feel for my students as well as the pace and rhythm of Stuy. Hunter has it's own rhythm and pace and I'm still figuring it out.

We also had to pivot early on as the student laptops didn't arrive until a third of the semester was over.

On the other hand, much of my work these days has to do with developing the overall honors program as well as Hunter's forthcoming teacher education programs in CS so I'm only teaching a single class right now and it's small.

If there are any rookie teachers reading this, congratulations on getting through your first semester. I know you guys go a little bit longer, but you're in the home stretch.

Teaching right, particularly in public schools with large classes will always be an all in activity - certainly harder and more draining than anything I ever did in industry but it does get easier as you learn your school and students and develop your craft.

Advent of Code 2016 - Check your data

I'm spending the weekend up in Michigan. Visiting my brother and is family. We're here to see the UMGASS production of Gilbert and Sullivan's The Sorcerer. Batya also came up from Cornell to join us so the two families are all togehter for the first time in about 10 years.

This hasn't left much time for Advent of Code but I did manage to finish yesterday's challenge this morning.

What took me so long? Much like last year, it was because I'm an idiot.

The problem seemed pretty straighforward. I coded a solution and it worked for all the test cases. I tried it on my data set but the grader said the answer was wrong. I went through the problem a number of times as well sa my code. I figured I either mis-interpreted the question or had some bug. I found neither to be true.

After some frustration, I went over to the Advent of Code subreddit grabbed a couple of posted solutions (trying not to look at them) and ran both on my data - those solutions got the same answer on my data set as I did.

This morning, I asked Batya to look over my code and the problem (it's always good to have a daughter that's smarted than you are) but she saw no problems.

Finally, I emailed my buddy JonAlf since I know he completed the problem. He sent back his answer along with his data set and I got the same answer as he did on his data.

What could be the problem.

His data set was about 12k characters long, mine was 4k. Something had to be wrong here. I went back to the Advent of Code site and grabbed the data set again. This time, I went to the page and did a "save-as" to save it - last time, I cut and pasted.

The cut and paste version was 4k, the save-as was 12k. This time it worked and was accepted and I also finished part 2 in short order.

The moral of the story – make sure you check the integrity of your data set - you'll never get the right answer if you're working with the wrong data.

In case anyone's interested, you can find my AoC code here.


Enter your email address:

Delivered by FeedBurner

Google Analytics Alternative