Archive for January, 2012

What I learned from computer graphics class

Besides my course in evolutionary computing, which I learned a lot from, last semester I took a class in computer graphics. In this class, I learned about different aspects of computer graphics, including modeling and rendering objects to a screen.

I definitely appreciated how computer graphics class built upon knowledge that I had already gained in previous subject areas:

  • Geometry
  • Linear algebra
  • Java programming

Modeling 3D objects

We modeled 3D objects as collections of points in a 3D space. Each object has a number of faces, where a face is a collection of points (a polygon) that make up a face of that object. Each face must be flat. So, for example, a cylinder would be made up of a finite number of long thin faces.

Rendering 3D objects

A simple rendering is to draw a line around the edges of each face in the object. This would be called wire-frame rendering. A slightly more complex rendering is to ensure that lines are hidden if a face falls in front of that line. This is called hidden-line elimination. A cylinder is displayed here as rendered with hidden line elimination:

Cylinder displayed with hidden line elimination

A more realistic rendering gives a color to each face and fills it in. The face’s color can be shaded according to the direction the face makes with a light source. One simple method of rendering these shaded faces is called z-buffering. Here’s a screenshot of a z-buffer rendering of the same cylinder:

Cylinder drawn using z-buffer

The role of a computer scientist

When I meet people, I often end up telling them that I am a college student, and my major is computer science. “So what are you going to do with that?” they ask. “Programming” is my usual answer. There are many possible careers for computer science majors, but in this post I’d like to write about the role of a computer scientist. What is a main, overarching goal to our work?

Frederick P. Brooks gave a speech in 1994 in which he addressed the goal of computer science. The transcript is entitled “The Computer Scientist as Toolsmith II.” In it, he argues that when computer scientists write programs, their primary goal is to satisfy the needs of the user. Users will use our tools to get their job done. In short, we are toolsmiths. Brooks writes, “We make things that do not themselves directly satisfy human needs, but which others use in making things that enrich human living.” In other words, an engineer can use a computer drawing program as a tool to design a bridge. Or a parent will use a social networking program as a tool to communicate with friends.

In making our tools, we should make them well. It goes without saying that the tool should not break when you are trying to use it. The tool should not be too complex or hard to maintain. When we work as toolsmiths, we should do good work.

Merely talking about how we make our tools does not fully address the question. We also need to address this question: What types of tools should we make? To discern this requires some sense of morality. Wolterstorff writes,

There is something deficient about the person who does good work for its own sake without ever asking whether it’s a good thing that this work be done. The estimable craftsman asks two questions concerning the good. He asks whether what he is doing or making for its own sake is a good example of its kind: a good violin, a good arpeggio, and so forth. But he also asks whether doing or making a good example of this kind is a good thing to do. (quoted in Think, by John Piper, page 120)

In other words, we should ask two questions:

  1. Is this a good tool?
  2. Is making a tool of this type a good thing to do?

The second question is a challenging question to ask. It is a question that transcends individual preference. At the very least it requires people to think ahead of possible uses of their tool. I do not wish to analyze every tool that has ever been made and fit it in this grid. I do wish, however, to provide two examples of tools where this question should have been asked.

The first is the recent flu virus that was genetically modified to travel via airborne particles. Basically, a deadly flu virus was made even deadlier. The US government asked the researchers to limit the amount of information is published in academic journals, for fear that the findings would be turned into a flu pandemic. The New York Times has an article on the deadly flu virus. One researcher went so far as to say, “This research should not have been done.” In other words, it was not a good thing to even do this kind of research, even if it was done well.

The second example is the trend of personalization in internet websites. This results in “a bubble” around you that only includes news that you want to hear. For example, search engines change their first page of results depending on who is searching. Facebook internally sorts your friends into who you want to hear from and who you do not. This has been explained at and in a recent TED talk, “Beware online ‘filter bubbles’.” When a computer filters our results based on what we like, we miss out on things we need to hear. A human newspaper editor can create a balance of different articles on a front page, but a computer filter will only put things that we want to hear. The filtering technology is very good at what it does, but it is not a good tool, as it dulls our thinking and takes away our exposure to ideas we disagree with.

In conclusion, the computer scientist has two roles: to make tools well, and to determine which tools should be made. This requires both technical expertise and a moral compass. It is my desire to see more and more programmers have a moral compass to guide them in their work.