Starting with scheme

Scheme is one of the languages used in Stuy's intro CS course. Like any other language, there are pros and cons of using it to introduce students to CS. Here are some of the reasons why I like Scheme as a first language and why despite that, I don't recommend it in many cases.

Scheme certainly isn't mainstream. That's not the main reason why I like it but it is a side benefit. It's less likely kids come into class knowing it which creates a level playing field. The few times I've had a student with a background in Scheme, they've been good, helpful kids rather than ones that tried to show off and dominate the class.

I like scheme because it's simple. It looks different than other languages but is (+ 3 4) really that different than add(3,4) or 3+4?

We can tell kids "everything's a function." While technically not true, and I tell my students that it isn't, it's close enough for our purposes. Everything's a function and the way we write a function is:

(f a b ...)

Apply function f on arguments b c …. So we have (+ 2 3) to add 2 and 3, (and a b) for logical and (= 3 4) to test to see if 3 is equal to 4, etc. We also have the same basic notation for things like conditionals. In java, we might write:

if (a > 5) {
 return 5;
} else {
  return 10;
}

In scheme, it would be:

(if (> a 5)
  5
  10)

Even though we're fudging the rules, we can lay out a handful of rules for the kids such as lambda and define follow a similar form to create and name functions:

(define add2 (lambda (a b) (+ a b)))

where (lambda (a b) (+ a b)) returns a function that adds a and b and define associates it with the identifier add2. Now we can use the function: (add2 5 10) which evaluates to 15.

With lambda, define, if, and a few more basics, it's off to the races. The simple, consistent syntax makes things easy for the kids and the constrained tool set lets us focus their way of thinking.

Of course this wouldn't work had DrScheme (now Racket) not existed. That gave us a nice learning IDE to work in.

Using Scheme, we can not only cover the basics like conditionals, abstraction and such but also deeper concepts like recursion, map, filter, and reduce. When we move on from Scheme, the kids also have a frame of reference for all the other languages and paradigms they use.

There are downsides, however. Outside help is harder to come by and there is some pushback from parents and it isn't as pretty and flashy as some other tool-sets. Scheme worked at Stuy for a number of reasons. When I created the class that used it, there were no good pre-AP classes in the school and I had a pretty good reputation as a teacher. The class also used multiple tools with NetLogo being the primary other one and tackled a variety of CS and non CS topics. First time through, reputation and buzz filled the classes and after that, the class developed a solid enough reputation to fill itself.

It also didn't hurt that our program developed from the inside out. First, we had APCS-AB on the books as a junior year course, then I added our post AP senior year electives. Since it was easy to show what the kids were already graduating with, it was easy to diffuse any pushback from not using mainstream tools in the first class.

Scheme worked at Stuy and I feel that it still does. Would I use Scheme for a first experience in a drop in program at an after-school where kids might not come back if they don't get to a payoff immediately? Probably not. Would I recommend it at a school where I want to integrate CS with some of the other subjects quickly, again, probably not (except for integration with algebra where Bootstrapworld is a terrific program).

In any event, if you're a high school CS teacher and haven't played with scheme or some other functional language, I highly recommend it - you might not actually ever teach it or use it but it can really help develop you as a programmer and an educator.

Selecting a starting language - why not Javascript

I was catching up with the team at Stuy the other day and they mentioned that they were periodically getting pushback on their choice of languages, particularly in the intro class. The pushback was mostly in the form of "why don't you start them with Javascript?"

Back in the day, when I created our intro class where we use Scheme, NetLogo and then later Python, I'd get similar pushback but then it was "why not Java?", "why not C?", or "whu not C++?"

We had a good discussion on this and I shared my thoughts as to why I don't like Javascript as a first language and I thought I'd share some of them here. I'll try to get around to the rationale behind Scheme and NetLogo in a later post.

To start, let me say that I Love Javascript - particularly when approaching it as a functional language. I also think every school and situation is different so there are likely times when Javascript is the right beginner language for the job.

Let's dive in.

Why are some of the pluses for Javascript as an intro language.

  • Ubiquity and availability:

    If you have a browser, you have Javascript - it's also available through online IDEs and online lightweight sites like JSFiddle.

  • Interactivity:

    You can tweak websites almost live, use the HTML5 canvas pretty interactively and mode

  • It's mainstream
  • It's quick to get up and running

This is all true, but there are also downsides.

One of my big problems with Javascript is the lack of simple solid educational tooling. I love to use tools like DrJava, DrPython, and Racket (formerly DrScheme) with beginners. All simple learning IDEs. True, you can use a simple online IDE but I haven't found them to have as strong a learning interface. They also, generally, keep you in an oversimplified programming sandbox. There's no clean transition from the sandbox to the real deal - particularly given the non-trivial state of js build tools and environments. These simple learning IDEs set the stage and then we can transition to more powerful development environments.

I also prefer, where possible, to have kids learn locally so that they can learn something about the underlying operating system even if only at a user level.

A problem relating to the lack of tooling is the fact that a JS program can fail to run and not give you any meaningful feedback at all - this is a problem for a beginner.

Javascript also has all sorts of wonkiness. We have =, and == which is pretty conventional, but then there's also ===. We have potentially confusing scoping issues and also some other real weirdness:

console.log(53-3); //  50
console.log(53-'3'); // 50
console.log('53'-3); // 50 
console.log('53'-'3'); //50

console.log(53+3); //  56
console.log(53+'3'); // '533'
console.log('53'+3); // '533
console.log('53'+'3'); // '533'

For more, check out the this video. Start watching at about 1:20 - it's a riot.

All of this weirdness actually makes sense - just not to a beginner.

Javascript also gives plenty of freedom - there are many ways to do things. This can be great for the developer but not necessarily ideal for the learner. Loops, recursion, mapping functions - you name it, Javascript's got it. I like simpler languages for beginners because it's easier to get them thinking and problem solving in certain ways when there tool set is somewhat restricted (more on that when I write about Scheme).

Finally, the fact that Javascript's a mainstream language can be a minus. Given its popularity, a beginner class could have at least a few kid who've at least played with the language. This can lead them to think they know more than they do and more importantly, this can be intimidating to the real newbies who develop the impression that "everyone knows this but me." A less mainstream language puts everyone on a level playing field.

Let me say again that I love javascript as a language and before a student graduates Stuy they can learn all about Javascript, front end development, some functional programming, and more. It's just not the right language to start with - at least not at Stuy.

Using Emacs - 28 -Rectangles

One of my favorite but little used emacs features is rectangular editing. It's little used because I don't need it all that often. It's one of my favorites because when I do need it, it's just so amazingly useful.

The idea is you can mark a rectangle of text, cut it and later paste it. This means that if you have three columns of text:

a b c
d e f
g h i
j k l

You can easily mark the middle column (b e h k) or even just the b e and h, cut it and paste it elsewhere as a rectangle. You can also open up a rectangular region (filled with whitespace). There are a couple of other niceties but that's the basic idea.

Here's a link to all the functions:

https://www.gnu.org/software/emacs/manual/html_node/emacs/Rectangles.html

And the video:

Enjoy.

A Ground Hog Day Story

This post has nothing to do with computer science, teaching, education, policy or any of the other typical Cestlaz topics.

Natan wrote this last week and it really gave me a chuckle.

I thought some of you might enjoy it so here it is:

Should CS Ed be in bed with the College Board

I'm guessing my views on this aren't very popular -that's OK, every community needs a curmudgeon.

A few years ago, I cautioned if we weren't careful, once the big players got involved, CS Ed would go the way of other disciplines, and not in a good way. It looks like indeed we're well on our way down that road.

I've ranted before about things like non-profits, drop in and summer programs. STEM Oil Salesmen 1 selling easy fixes, exciting kids and parents, using the Think Method just like Professor Harold Hill only to send the kids off where they can blame a future teacher for failure.

I've also ranted about teacher preparation and how all the rage is short term, Superficial PD and scripted curricula and my concern that once the politicians can say CS is in the schools, we'll be done.

I've been working towards getting CS to all students for most of my career and while it's wonderful to see us getting closer to the goal, I'm seeing more and more signs that my caution is becoming reality. and CS Ed is going the way of other Ed - aligned to testing and more to the whims of the power players and politicians than to teachers and students.

The other week I noticed, this post by Code.org trying to encourage more students to take the APCSP exam - not encourage more students take the class or some other class or to have more students be exposed to CS but to actually sit for the APCSP exam. That post was followed by this one which also highlights actually taking the exam.

This didn't sit well with me.

What does the exam do for the kid? It doesn't drive instruction - by that time, any good teacher knows their student and is better served by using their own assessments. The college credit thing? I'm skeptical. Fewer and fewer schools are giving credit for APCSA let alone this new CS0 non major course. Blanket credit? Since full time students pay for a range of credits, I'm still skeptical here. Placement? It's a course for non-majors - what exactly are you placing out of?

Reasons not to take the exam?

  • If it doesn't do anything for the kid, why take it
  • Stress of taking the exam
  • There are other ways of placing out of courses once in college
  • Save the expense

As a general rule, I'm against forcing students to sit for AP exams. At the extreme case, since we've been brainwashed to think that a school that has lots of kids sitting for exams is good, I've seen at least one case of a principal having all his kids sit for, and just about all fail AP Calculus - that is, get a 1 or 2 on the exam. This principal had all his students take the exam, and only 2 scores were 3 or higher. This principal then parlayed his success into a higher profile gig - he's moved up in the world while setting up his students to fail.

This follows last year's announcement that code.org was partnering with the College Board - offering PD to teachers for free if the schools signed up their students for the PSAT 8/9 - another meaningless exam. So, we get teacher training light 2 as long as the school pays for the PSAT8/9 for every kid so that the kid can take yet another test with really no value3.

Why should students pay for an AP exam that doesn't do anything for them? Why should Jane Q Taxpayer pay for exams that only server to enrich the College Board.

True, The College Board is a big player. They already have much more influence of American High School education than they should. It's easy to climb on board the AP train for entre into our schools. The question is, should we use positions of influence to push efforts that might help our end but leave collateral damage to students and the public.

I don't doubt code.org's sincerity in wanting good CS in all schools nor the efforts or value as an advocate for CS Education. I'm concerned that the desire to win big and win now is moving us in a direction that we'll regret years from now.

Footnotes:

1

Not my term, but I really like it

2

If you think that PD based teacher training is OK, ask yourself if you want your own child's chemistry teacher to be a history teacher with a few weeks summer training in chemistry

3

And I'm guessing the exam will be offered during the day so teachers will proctor for free rather than be allowed to, you know, teach their students.

It's not one issue, it's the President and his enablers

Like many of my fellow bloggers and tweeters, I generally keep this site clear of political issues with the exception of those that are directly related to education.

Also, like many of my fellow bloggers and tweeters, this week has provided a reason to break with that tradition.

Many people, including some friends, all more eloquent than I have already posted, tweeted, and Facebooked about the behavior of our President and government.

Long time blogger Dave Winer put together trumpstatus.org where he's collecting many of the issues that we're all so alarmed with.

I would add cabinet appointments to his list with my particular personal concern over DeVos and the department of education. I've been meaning to blog about that for a while - perhaps this week.

My concern for today is something else. Every day, I see a new Trump induced crisis and every day I see a different subset of my circles respond. It's not quite as bad as:

First they came for the Socialists, and I did not speak out— Because I was not a Socialist.

Then they came for the Trade Unionists, and I did not speak out— Because I was not a Trade Unionist.

Then they came for the Jews, and I did not speak out— Because I was not a Jew.

Then they came for me—and there was no one left to speak for me.

People are indeed speaking out, but I am concerned that people are going to rise up for their personal issue and when placated go back to business as usual - this is NOT the time for business as usual.

With the ACA repeal, I saw concerns from my working class friends and friends that work with lower earning populations.

Going into the DeVos hearing, mostly educators - real educators not astroturf reformers.

With Friday's order, the whole tech community came out.

Here's part of a thread by tech activist Anil Dash calling out, calling on, and crediting assorted tech players.

We have to remember that all these order, policies, appointments, and plans are coming from the same place - Donald Trump and those politicians that are enabling him.

If he backs off on immigration, education issues remain, if he backs off there, we still have ACA, if that eases up, what about Women's rights and on and on.

This means we all have to get involved and stay involved.

What have I been doing?

  • I finally joined the ACLU and set up a monthly donation.
  • I subscribed to Daily Action so that I get a reminder each day of someone I can call to make a difference.
  • I'm starting to accumulate my representatives phone numbers as I make those calls and am trying to make at least a call a day to remind our representatives who they work for.
  • Education and advocacy

And if you suggestions for me - please post them here.

Thus ends my not business as usual post. What's going on in America is not someone else's problem - it's all of our problem and we all have to be active and vigilant to make it through tough times to come.

Using Emacs - 27 - shell and eshell

While I use emacs for all all sorts of things, one of the things I haven't done much is run shells from within emacs. I'm not sure why. I'm a command line wonk and adding command line goodness and emacs together seems like a natural. Maybe it's because back in the day I spent a lot of time on MS-DOS systems. You could get a reasonable Unixy facsimile using tools like the MKS toolkit and I like so many other young computer scientists wrote our own small shells when we learned C so I used that insted of command.com.

In any event, I'm trying to use the shell within emacs more.

Here's a quick video showing both shell, which runs whatever your default shell is in an emacs buffer and eshell which is emacs own shell.

I use a couple of packages to smooth over a couple of things.

Virtuelenvwrapper smooths things voer with the python virtaulenv and virtualenvwrapper linux packages:

(use-package virtualenvwrapper
      :ensure t
      :config
      (venv-initialize-interactive-shells)
      (venv-initialize-eshell))

Only relevant if you use Python and virtualenvs.

and more importantly, better shell:

(use-package better-shell
    :ensure t
    :bind (("C-'" . better-shell-shell)
	   ("C-;" . better-shell-remote-open)))

cleans things up when using a termianl to connect to a remote machine.

If you use a shell from within emacs as part of your workflow, please post how, or better, make a video!!!!

Enjoy

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.




Enter your email address:

Delivered by FeedBurner

Google Analytics Alternative