Skip to content
June 18, 2010 / Ben Chun

Modern Programming

I’m leaving on Monday for Jerusalem (where I’ll be teaching for the summer). In preparation, I’ve been working with my fellow instructors on a prototype of the project we want the students to build. Doing this work is making me question again what exactly we can and should be teaching students of computer science. It’s not 1969 anymore, and the scope of what’s useful to know is always going to be wider than a single person can grasp. What actually constitutes the foundation of our subject in 2010? What kind of introductory courses make sense?

The World in 1964

Seems like we should start with the practicalities of what people do these days. The site we want our students to build is a sort of feel-good version of Plinky, intended to promote connections between diverse people and show them that we all share some common experiences. The technology stack we’re using is MySQL, Tomcat, a minimal homegrown MVC architecture (no Beans or Hibernate or other JSP framework), and JQuery. But the questions this has raised for me would have comes up even if we weren’t using Java: software development has a lot more similarities than differences across the various stacks.

Our plan is to give the students a very simple skeleton of the site with concepts of a User, a Question, and an Answer. This is enough to provide reference examples for how database connections and queries are made, how Servlets handle HTTP requests and responses, and how JavaScript can manipulate the DOM. Then we’ll have them add new features to the site, each of which should expose them to the full stack from database to UI:

  1. Voting and moderation
  2. Badges and awards
  3. Image upload
  4. Location metadata and maps

This approach lets us break up the students into smaller groups in order to apply the stuff they’re supposedly learning from our series of lectures. My team will be working on the image upload feature. Originally I was thinking this would be an intermediate goal/milestone on the way to an HTML5 drawing feature — so that users of the site would be able to make a little sketch as a reply to a question. I still think this might be possible, but file uploading is a prerequisite. I hadn’t really looked at what it takes to handle uploads in JSP until I started building a prototype of the feature.

When it’s time to do something that you know a bunch of people have already done a million times, the place to start is Google. You look for a library. And, lo and behold, all the weirdness of dealing with multipart/form-data POST is wrapped up in the lovely Apache Commons FileUpload package. Assuming that for some reason you needed to build your site in J2EE without some kind of framework that does it for you, importing this library seems to me like the best way to get the functionality. In the bigger picture, this is like a lot of problems: you need to know enough to find some useful code, hook up the plumbing, and troubleshoot the problems when they inevitably arise. You usually don’t need to do the “heavy lifting” yourself. The library will probably be more correct and more efficient than what you’re likely to write in the amount of time you have to work on the problem.

I’m going to go out on a citation-needed limb here and say that 90% of working programmers are doing this kind of look-and-hook work 90% of the time. Most programming work is not building brand new solutions to problems (although much interesting work is happening, always, of course) but rather in adapting existing solutions in the form of libraries and frameworks to specific needs, in the context of an existing codebase. Yet it seems silly to me to think of teaching these things all copy-paste-like without a classical programming background, and I’m wondering to what extent that’s just because I have a classical programming background.

I want my students to learn, during a four-week program: enough SQL and relational database concepts to extend an existing schema, enough about Servlets to write and debug one given an example, enough of the MVC pattern to know what goes in that Servlet and what goes in the JSP and what goes in a model object, enough about HTML forms and HTTP post to understand the difference between enctypes, and enough JS to make a popup window that can modify the DOM in its parent window.

Currently they know… Java. This seems insane.

I have to accept that they are not all going to come to an understanding of each of these technologies in the depth I’d like. If we want them to get this project done in four weeks, we’re going to have to push through a bunch of this stuff at a pretty shallow level and just fix it as it breaks. Does that sound familiar to any of you working engineers? To a certain extent, this is fine: programmers never have to write code without access to Google. And I’m pretty sure a modern web app framework like Rails comes with most all of this stuff built-in or as a gem or whatever they call libraries and packages. Yet in order to really be able to: 1. assess the appropriateness of various solutions to a given problem, 2. adapt a given framework or library to a specific use case, and 3. work sensibly in relation to an existing codebase, the programmer has to have a fundamental understanding of what the machine is doing and where the various layers of the stack interface and work together.

Where does this understanding come from? I feel like I learned it one layer and abstraction at a time, starting roughly in the middle, since the course of my education and professional career paralleled the development of a lot of these technologies over the years. So it’s natural, but perhaps not appropriate, for me to think that everyone should take SICP and learn Scheme first. But I’m struggling to think outside of that frame of reference. It seems like we’ll have to figure out how to do this if we want to teach computer science that’s relevant and interesting and gets things done in today’s world. Wish us luck!

4 Comments

Leave a Comment
  1. Erik Engbrecht / Jun 18 2010 12:28 pm

    My experience is that professional programmers who have learned programming the traditional way as opposed to primarily via a combination of “look-and-hook” and “find the template/pattern for what you’re trying to do an fill-in-your-stuff” are so far ahead that it isn’t even fair to lump them into the same professional field. It’s the difference between a mechanic and a mechanical engineer.

    Every good programmer is an adept at creating abstractions. The “look-and-hook” method teaches the idea that abstractions are something to be acquired, not something to be created. This makes them work at a kind of rigid, somewhat jagged level of abstraction that’s determined by the components they can find. Their world is boxed in by their components. When the problem their solving doesn’t fit their components they either fail or make monstrosities that are perhaps worse than failure. Furthermore, these programmers tend to eventually be bound by the components they already know. Their productivity is completely driven by how well that have/have not memorized the components their using. This makes them try to fit square pegs into round holes.

    But a programmer who already knows how to build up abstractions and is comfortable with it can usually learn to seek out existing components for needed abstractions, makes better decisions about which ones to choose, and is capable of adapting/wrapping them to effectively address the nuances of his current problem.

    So I think future professional programmers should learn the fundamentals first. Otherwise they are far too confined by what others have already created, and they can only solve problems that have been solved before.

  2. Ben Chun / Jun 22 2010 12:30 pm

    Hey Erik – I hear what you’re saying and I generally think the same way and I’m trying to challenge myself to think laterally from this position. We agree on the desired endpoint for powerful programmers, and it’s not just using existing code, even though professionals do it a lot.

    What if it were possible for a student to start out doing stuff that looks to us like copypaste and then build from there into a deeper understanding of the languages and creating new abstractions? Is the “logical” order of learning syntax first and then doing exercises and then finally trying applications the only way to get good? I don’t have an answer, but I think it’s important to ask the question.

    • Erik Engbrecht / Jun 22 2010 6:11 pm

      I’ve been thinking about it and I think what’s most important is the attitude that forms. There are a lot of programmers out there who think they are limited to relatively sparse logic to tie together off-the-shelf components. I think this is caused by a combination of programmers who lack the skills to do more plus admonitions against not-invented-here syndrome or reinventing the wheel.

      It may be good to teach students how wrap or otherwise recast existing components to fit their needs. There aren’t a lot of circumstances where it’s appropriate to, say, write your own hash table to balanced tree. But there are a lot of circumstances where it is appropriate to take something that doesn’t exactly fit your requirements and wrap or extend existing pieces in order to compose something that does fit.

      I’m not sure how much the order of presentation matters in this so long as the ultimate exposure is complete. What’s important is that programmers realize that it’s a trade off between working with what their given, adapting existing components to fit their problem, and/or rolling their own. The right answer is usually a combination of these things. Perhaps something like pointing out how certain repetitive patterns can develop when using off-the-shelf components would be appropriate, and then teaching them how to encapsulate and eliminate the repetition.

Trackbacks

  1. Programming Studio « And Yet It Moves

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: