Wednesday, December 23, 2009

Desktop OAuth/Python Question

This post is slightly more tech-heavy than most of my recent posts. If that's not your thing, feel free to move on now.

[Update 20091223: NEVERMIND. I got it sorted. The url you re-direct a user to with OAuth doesn't need extra OAuth headers. So you really could just use My bad.]

Suppose I want to interact with the twitter API via some python code running on my personal computer. Suppose, for grins, that instead of using the Basic Authentication I'd rather try OAuth (even though it's all running locally...). Part of the flow of OAuth authentication is that my script is supposed to direct the user to an address at twitter (oauth/authorize), with some OAuth specification headers in the HTTP request for that address (I hope I'm saying things within a few shades of correctly). Well, python provides the webbrowser module which should open up a url in the users browser of choice. And it does, pretty easily (based on my 1-test sample). The problem is that for the OAuth dealings, I'm supposed to pass additional HTTP headers, and I can't figure out how to do that with the webbrowser module. I tried creating a Request object, from the urllib2 module. If I were just making a url request using this library, I could make the Request object, with the extra headers, and things would go fine. But the method seems to want its url parameter to be a string, not a Request object.

So... how am I supposed to do this? Or am I not supposed to do this?

Am I supposed to use some other existing python based browser? How is the user supposed to feel like I'm not still in the middle of the authentication process? I mean, if my script displays a webpage using some graphical widget, and waits for the user's input, then I could just be grabbing their username and password while they log in to twitter, no? The point of having the user go to twitter and get a pin is that the user then tells me that pin. I don't put myself in the middle and grab the pin (or their username/password) somehow.

Does any of this make sense? Can somebody point me at a solution? Existing code that solves this problem?

Friday, December 11, 2009

Changing Calculus

Apparently toward the end of every semester I decide to write a post about changing calculus. At least, this is my second go at it. But today's attempt is more a follow-up to my most recent post, about the role of higher education.

My initial motivation in asking the questions in my last post was to provide some structure for what a calculus class should look like. Is the role of calculus really to make sure that all freshman know how to compute integrals by hand, and can use this to find the volume and surface area of a solid of revolution? That rising second years can go through mindless algebraic manipulations to arrive at an answer to a question that was asked without any context or applicability? Moreover, that they need to be able to do so by hand? Quick, find the antiderivative of $\sqrt{3-2x-x^2}$, no computers. Who gives a crap? How many times will that function, or one like it, actually show up in the lifetime of my student? I get paid to do math, and the only time I've ever cared about the answers to these algebraic questions was when I was taking or teaching a calculus course.

Looking back, I'm a little ashamed that the problem above was actually one I assigned as homework for my students this semester. What good does it do to have them work this integral by hand? Surely the answer depends on the students, right? My students going away from the sciences have gotten nothing out of this assignment. My students staying in the sciences have spent another... 5 minutes? 30?... practicing their algebra skills. Hurray‽

Look, I'm not saying algebra isn't useful. But I really do think it is over-emphasized in calculus courses (the ones I've encountered). My calc II course covered: techniques of integration, improper integrals, arc length and surface area of revolution, parametric curves, polar curves, multiple integrals, and infinite sequences and series. Lots of these are wonderfully fascinating and fun topics. Parametric and polar curves force students to start thinking about curves differently, to start re-interpreting functions and points in the plane. Infinite sequences and series are so unlike anything that's ever come before that they can't help but be interesting. Add up infinitely many things that get infinitely small, and produce an infinite value? Or a finite one? How the hell does that work? What does it even mean?

If not a single one of my students can do the integral mentioned above, I'm not sure that I'd feel bad about my semester. If not a significant portion of my students could tell me what was new about a parametric or polar curve, I think I'd be fairly upset (admittedly, now I'm a little afraid to ask).

My problem with my course is that algebraic manipulations are essentially given precedence over conceptual understanding. This is done by making exams that test algebraic nonsense, forcing instructors to make sure their students can do the algebraic nonsense, taking up valuable time that could be better used in other ways. With less time spent on algebra, more time could be spend on concepts, and more time could be spent on improving student's writing. The time spent on concepts makes it a more mathematically interesting and, I'd argue, worthwhile course. Whatever negative impact on my students is brought on by slightly less algebra practice will be more than compensated for by having them spend time thinking about ideas. More time spent teaching students how to write mathematics will force them to think more precisely about what they are saying and how to say it. How could this not be advantageous to students, whether they will be taking more math or not? Unless, of course, thinking about these ideas and how to write them is not aligned with the goals of my university. If the role of higher education isn't something that thinks this would be better, then I'm getting off this boat before it sinks.

So why not go for it? Spend drastically less time on techniques of integration and series convergence tests. Force students to turn in well-written assignments. Spend class time talking about what well-written math is. Spend time letting students play with computers to get a feel for parametric and polar curves. Computers will be faster and more accurate in plotting curves than any student ever will be. Give students time to plot lots of curves, changing parameters to see the effect on the graph. Make students look up resources online to learn how to find arc lengths or surface areas, instead of just telling them the formula (or even deriving it) and having them memorize it. Spend class time talking about how to read the resources they find, and how to evaluate them for quality.

My advisor pointed out, during our conversation mention in my last post, that there are some issues with trying new things. At the lowest level: who gets to teach such a course, and where does their funding come from? But I think better concerns that he mentioned are two that bring me back to some of my earlier questions.
  1. It is hard to test conceptual understanding. It is much easier to test if a student can do some algebra. With several hundred students going through calculus every semester, this is a practical concern. How does a university handle scale?
  2. Institutional inertia would have to be overcome. Change is hard. We do this because this is how we've done this for a while now, and it is clearly the best way to do things and it's going ok and nobody has complained.
So let me ask again, what is the role of the university, and how will the university adapt to the changing world? Is the role to grant degrees, and so is the role of my lowly calculus class to funnel students on to further classes until we can get them out of here with their paper in hand? What market are universities in? If we know, then we can see if our institutional inertia is good or bad. If we don't know, we should probably get on that.

These questions brought me back, full circle, to my initial desire for some formal guidelines for courses. I think it would be hasty to change all of our calculus courses around right away. I think a better solution involves some experimenting. Make a new course, make grad students apply to teach it, arguing for what they want to do differently, and require the instructor to report back on how it went. I think having formal guidelines for courses would aid the experimentation, because it gives an objective measure for comparing a newly designed course with a more traditional one.

I know that much of what I'm saying is oriented toward the way things are set up in my department. How is your department set up differently, and what does that mean about how calculus courses are structured?

Thoughts? Objections? (non-spammy) Links?

Higher Ed

I've been wrestling recently with identifying the role of higher education. I'm not much of a wrestler, physically or intellectually, so I thought I'd see what I could put into words and have you folks comment on. Thoughts of yours, or links to thoughts of others are much appreciated.

What brought on my recent concerns, or possibly made the pot boil over, as it were, was some frustration in making a final exam for my calculus course. The course I teach is one section among several, and we all have common exams. When we went to make the exam this semester, there was some disagreement about what should be tested. The lack of a prescribed vision for the course (at least, one I was aware of) started to upset me. And then I decided that such a vision should be accompanied by a broader vision of the math courses offered by the department. It should include formal indication of how the courses fit together, what is assumed of students coming in to each course, and what is assumed of students passing a course (I'm thinking something more formal and precise than the short list of pre-reqs for a course). And then I wondered where this vision came from, if it was internal to the department or how much say other departments had in what they wanted math classes to require. I'm not expecting the English department to care at all what is covered in Calc I or II. But perhaps Economics has some input for us? Or other departments? And then I wondered what the point of any of it was. What is the role of higher education, and how does my Calc I or II class fit into that?

Clearly things were getting out of hand.

Luckily, my thesis advisor turns out to have the title of Director of Undergraduate Affairs. Furthermore, he was happy to talk to me about these things, and brought a welcome level-headedness up against my relative insanity. Of course, I'm sure he won't mind much when I get back to research... :)

He pointed out that probably having formal guidelines for all courses is a bit much - that professors teaching upper level courses should be granted plenty of flexibility. I can't really argue with that. I have vast respect for all of my professors. But this flexibility doesn't really help in getting a vision for Calc I or II together. And if the courses are coordinated among several sections, there should be some vision backing it, right?

Part of my initial inquiry was if there was a curriculum review that happened periodically, and how long ago the most recent was. My guess was that if there was such a thing, it happened before nearly all of my students had personal laptops (or possibly even personal computers in their dorm room). I know I'm a bit of a nerd, but I really think it is important to adapt to the changes brought about by each student having their own computer (that they maybe can carry in their pocket!) connected to the internet. The explosion of infinite goods and real-time global communications, for "everybody" (yes, I know I live in a privileged region, or whatever is the PC way to say it. I'm sorry?), has been changing, is changing, and will continue to change... well... nearly everything. When the fundamentals of economics and communication change, what isn't impacted? [Side note: I know very little about economics, I'm probably saying things incorrectly]

Bringing things back down closer (somewhat) to the level of a graduate student who knows basically nothing about anything useful... how does the internet change higher ed? What happens when lectures become an infinite good, available to be watched freely online? What happens when the content that makes up our textbooks is available in a multitude of places online? What happens if students have direct access to experts in any field at campuses on the other side of the globe? Gah, I'm getting out of hand again.

Two recent posts online have been on my mind a bit as I think about this question:
  1. A post on ars technica about the difference between the movie industry and the music industry. For some reason this article made me realize that I probably wasn't thinking much about what was distinct about higher ed, as opposed to the entertainment or news industries, and what that meant about the impact of technology.
  2. A video on techdirt explaining the innovator's dilemma. This video makes me think that in order to adapt, universities should be asking what market they are in. I've been phrasing the question in terms of what role they play, but I think maybe they're pretty similar questions. Are we in the horse-and-buggy market, following the example in the video, or the transportation market? Are we in the market of churning out degrees? Are we in the certification market? Is that our primary goal and purpose?
I truly hope that I'm not saying anything surprising to people involved in higher education (or other fields!), or asking questions you've not heard before. I really do hope that I'm late to this conversation - that smart, dedicated people in the right places are asking these questions. Moreover, that they are coming up with some answers. I hope that I am just not seeing this conversation at my university, or at others, because I am not involved enough somewhere.

Anybody have some thoughts or links for me?

This post is somewhat of a part 1 in a series. The second focuses more on teaching calculus.