2012-01-13 @ admin
Introductory computer science courses often provide students with their early impressions about what careers in computing are all about. Without experience in that job market, students decide what they think about this type of work based on their experiences in courses like Computer Science I and Computer Science II. However, Computer Science I and Computer Science II courses do not provide an good overview of work in computer programming jobs, anymore than an introductory course in biology can provide an adequate example of work in various medical fields. The purpose of Computer Science I and Computer Science II courses is to provide a pedagogical foundation for the increasingly difficult content material that comes in later courses – courses which do reflect real career opportunities over time, but just not in that first year. Unfortunately, many students never make it to those later courses because they often loose interests in computer science in that first year if the material is simply not compelling to them.
A potential area of redress for this problem lies in the fact that a broad cross section of young people from different backgrounds clearly enjoys exploring the capacity for using technology for different types of social networking. The online social networking phenomena involves sites like Facebook, Myspace, Twitter and Bebo, all of which have enormous appeal. The biggest of them all, Facebook, declaring that it had topped 500 million active users in July of 2010. Yet, online social networking should not be confused with social computing. Social networking and social computing are both involved in the evolution from Web 1.0 to Web 2.0 applications, but social networking is mainly focused on building online communities and relationships, while social computing is focused on the development, distribution and processing of online content.
Social computing is an easy concept to incorporate into other more traditional computing paradigms taught in first year Computer Science courses. However such efforts are not usually made in Computer Science I and Computer Science II courses because writing networking software is not generally seen as an area that can be adequately covered in a these introductory courses. Yet this should not remain the state of affairs, because networking software is increasingly becoming critical to many careers involving computer science, so developing simple models for teaching networking principles in introductory courses would serve both intrinsic student interest and provide real potential insights for those students into career opportunities.
By integrating networking software that involves social computing paradigms into first year computer courses, we can provide a chance for students to explore the inner workings of the type of programs that have become intrinsic to online environments that they are familiar with. Moreover, helping first year Computer Science students build versions of social computing software will help them explore how a social and collaborative dynamic is at work in fields that are connected to computer science disciplines. This issue involves can help address the fact that research has shown the drop in interest in pursuing computer science disciplines is at least in part connected to the perception that work in computer science fields involves an inordinate amount of isolated work, making programmers less social and less collaborative than employees in other fields . This issue has been shown to be especially troubling to female students and may be one of the reasons for the disparity between the number of male and female students choosing Computer Science disciplines . However, a professional survey has shown that the perception of the isolated programmer is not reality .
In two of my Computer Science I classes, both teaching Java but using different textbooks, I have developed a networking and social computing unit that I believe is a case in point. In these two Computer Science I classes, my students create a type of program called a chatbot, or a chatterbot. A chatbot is a program that has a dialogue with a user during a chat session. The chatbot takes input from a user and produces outputs that usually attempt to be conversational in nature. In fact, some chatbot programs attempt to respond in as human-like a fashion as possible, at times attempting to act as a general conversational program. This type of chatbot has the distinct potential for fooling a user at times into thinking that they are chatting with a human. For this reason, discussions of chatbots in my classes lead to a discussion about the Turing Test and the potential and limits of artificial intelligence.
Chatting online is an engaging activity, and developing a program that can do this is an engaging idea. To accomplish this, a program must process text typed by a real user in a chat, searching for key words or phrasings that trigger the program to respond with one of set of predetermined responses. Perhaps the earliest example of this type of software was created by Joseph Wisenbaum in 1966. His Eliza program acts as a psychoanalyst to some extent in the way that it responds to the user, and I show my students a version of his program in order to help them see the potential. This type of computing is social computing because it consists of computational analysis of data from a chat session. Put another way, this type of program is social computing because it involves taking content that is from an online social context, and producing something creative in response
My students work together in groups of two on the ChatBot project, and both students design a separate ChatBot program with different dialogue responses and rules. The reason they need to work in groups of two is so that they can run each other’s programs, and give each other useful feedback. My students have told me that developing a ChatBot program is especially enjoyable because of the interactions they have with each other while they are developing it.
Each student is given a ChatBot library class that I have developed that offers two interfaces, one less complex and one more complex. In both of these versions, when the ChatBot class is instantiated, the ChatBot object registers the student with a ChatServer that is also a program that I wrote. When the ChatBot object makes an online connection to the server, it then waits for the other student (the partner) to make a connection to the server using a corresponding ChatSession object that simply passes chat text back and forth between the second student and the server. The server is an intermediary between the ChatBot object and the ChatSession object. The ChatSession object gets something typed by the second student, and then it sends it to the ChatBot object that the first student is running, which produces an automatic response, which is then sent back to the second student.
In the simpler interface of the ChatBot object, the student gives the ChatBot object a list of keywords and phrases to search for along with a corresponding list of sentences as replies to send back to the user whenever a keyword, or a group of keywords or phrases is matched. If the user talking with the ChatBot program uses the right words or phrases, the corresponding reply is triggered. If the user doesn’t trigger a match, the ChatBot will send one of a set of generic responses supplied by the programmer. Matches can be set up so that any one of a set of keywords triggers a reply, or they can be set up so that all of a group of keywords must be present to trigger a reply.
In the simpler interface, the student relies on the ChatBot object’s methods to handle the complexity of searching through the input strings for matches and triggering the appropriate responses. However, in the more difficult interface, the student must create a class which will be instantiated by the ChatBot object. The student’s object class is then passed each response from the user as a string, and the student must create the data structures and selection statements necessary to match appropriate inputs and trigger the appropriate responses. This requires a fair bit of understanding of how to handle strings, arrays, selection statements and loops, which are very traditional concepts for a Computer Science I and Computer Science II class. The client and server network communications involved between the ChatBot, the ChatSession and the ChatServer are hidden from the programmers in both the simple version and the more complex version, but with interested students I do share some of these details.
The following shows an example of code that could be written by two different students, and then the chat session that might follow. These examples use the ChatBot object’s simpler interface, and they involve a chat conversation where Student #1’s ChatBot code asks Student #2 to guess the favorite movie of Student #1:
Sample Student #1’s Chatbot Java Program Source Code:
public class RobotChat {
public static void main(String[] args) {
ChatBot chat = new ChatBot("Student #1's Chatbot");
chat.talkTo("Student #2");
chat.welcomeMessage("Hello World! Can you guess my favorite movie?");
chat.keyResponseAny("Nope.","western","comedy","animation","love");
chat.keyResponseAny("Yep, that's the genre.","scifi","action","adventure");
chat.keyResponseAny("Yep. That's right.","neo","morpheus","trinity","agent");
chat.keyResponseAll("Yep. He's in it.","mr","smith");
chat.keyResponseAll("Yep, that's the genre.","science","fiction");
chat.keyResponseAll("You got it! Congratulations!","matrix");
chat.noMatchMessage("Oh come on, you can do better than that!");
chat.noMatchMessage("You're getting closer!");
chat.noMatchMessage("That's a strange thing to say?");
chat.noMatchMessage("Can you rephrase that?");
chat.exitMessage("See ya later!");
chat.startConversation();
}
}
Sample Student #2’s ChatSession Java Program Source Code:
public class NormalChat {
public static void main(String[] args) {
ChatSession chat = new ChatSession ("Student #2");
chat.talkTo("Student #1's Chatbot "); chat.startConversation();
}
Sample Output Produced While The Above Programs Are Being Run Concurrently:
-> Student #1's Chatbot said: Hello World! Can you guess my favorite movie?
-> Student #2 said: Is it a western?
-> Student #1's Chatbot said: Nope.
-> Student #2 said: Is it a comedy?
-> Student #1's Chatbot said: Nope.
-> Student #2 said: Is it a scifi movie?
-> Student #1's Chatbot said: Yep, that's the genre.
-> Student #2 said: Is it Star Trek?
-> Student #1's Chatbot said: Oh come on, you can do better than that!
-> Student #2 said: 2001?
-> Student #1's Chatbot said: You're getting closer!
-> Student #2 said: Blade Runner
-> Student #1's Chatbot said: That's a strange thing to say?
-> Student #2 said: Is Morpheus in it?
-> Student #1's Chatbot said: Yep. That's right.
-> Student #2 said: Is it the Matrix?
-> Student #1's Chatbot said: You got it! Congratulations!
In the above RobotChat code, when the ChatBot object is instantiated, it makes a connection with the server, and it passes to the constructor a name to be used for the ChatBot object during the connection. Then the program must specify who the ChatBot will “Talk To,” which identifies for the server which user to connect to the ChatBot. The partner will be the user who will connect to the server with a ChatSession object, which is not automated like the ChatBot, which means that user must type in each of his or her responses during the chat explicitly. The ChatBot can talk with multiple users at once, so multiple users can be specified using the talkTo() method.
Next, in the code above, the welcome message is identified, which is the first message the other user will see. In my opinion, it is a nice outcome when students in an introductory class can really make the “Hello World” message go out from their computer and into the world somewhere, and not just back to their own screens.
On the next three lines the keyResponseAny() method is called three time. On each of those lines, that method is first given a reply as the first argument, followed by any number of keyword arguments. The reply from each of these three lines is triggered as a reply the ChatBot object’s will give whenever any of the keywords from the latter arguments is given by the other person in the chat (i.e. if either “scifi” or “action” or “adventure” is in a sentence typed in by the user, then “Yep, that’s the genre” will be returned by the ChatBot object).
Then three keyResponseAll() methods are called. On each of those lines, that method is also given a reply as its first argument. The keyResponseAll() reply is triggered during the chat whenever all of the keywords that come after that first argument are encountered in the chat (i.e. both “mr” and “smith” must be given by the user for “Yep. He’s in it” to be returned by the ChatBot object).
Then code for four replies are specified on four lines with the noMatchMessage() method. On each of those lines, a string argument is given which will be shown when something is typed in by the user that doesn’t match any of the keyword rules. When multiple noMatchMessage() methods are used, each of those replies is used alternatively, one at a time. This is to say that the first noMatchMessage() reply is given the first time the user types a sentence with no keyword matches. Then the second noMatchMessage() reply is given the second time that happens. And the third is given the third time, and so on. When each of the noMatchMessage() replies has been used, the program returns to the first one and cycles through them again if needed, and it does this as many times as needed.
Then the exitMessage() is called, and that method is passed a reply to give whenever the a user exits the chat by typing “exit”. This line is followed by the final line of code that calls the startConversation() method, which starts the chat dialog by entering the ChatBot object’s internal loop, receiving input and returning the proper output during the actual chat session with whatever user or users are involved in the chat.
In the above NormalChat code, the second student instantiates a ChatSession object and identifies who they will talk to in an identical way as the first student did with the ChatBot object. Then, the second student enters the actual chat by calling the startConversation() method, again in the same as the first student did with the ChatBot object. Both students must enter the chat for the session to begin, and so whoever executes his or her code first must wait while the other student gets his or her code compiled and executed as well. Then the chat begins and something like the sample output shown above is then produced. It is important to remember that the first student’s code causes that student’s responses to be automatically generated, while the second student is just given a prompt to type in his or her own responses to the first student’s ChatBot while the programs are running. It is also important to note that the goal of the online session can vary widely, which is to say that the students are not always creating programs to ask the second user to guess a movie. The goal can be to guess a favorite food, a favorite state, a favorite color, or any person, place, thing or animal, using adjectives other than “favorite” to describe the object to guess.
In my experience, students can get the simple version of the ChatBot assignment done very easily because it is very engaging and they are using a ready-made set of methods that they did not create, like keyResponseAny() and keyResponseAll(). However, later in the course they learn to create their own methods and then they are assigned a project to get the same rules for their ChatBot working without using these predefined methods. Instead they must implement their rules by creating their own data structures, methods and selection statements necessary to match appropriate inputs and trigger the appropriate responses. This changes things from being very easy to very complex. However, I have found that the students are very motivated with the complex version because they are committed to their program, so they want to figure out how to get their logic and functionality working again the way they got it to work with the simple version.
I have found that adding collaborative networking activities like this ChatBot project that involves Web 2.0 and social computing paradigms is a very useful way to engage students who are not very attracted to typical Computer Science I and Computer Science II programming projects. By providing students with familiar activities that have some of the feel of social networking, I have been able to provide a bridge for new students into more traditional programming content areas. This was possible because my back-end software classes that the students import to make use of (the ChatBot and ChatSession
classes) hide some of the complexities to client server networking communications. However, hiding these complexities does not remove the challenging and compelling nature of writing software that engages in social interactions. In this way, Web 2.0 and social computing paradigms can be successfully aligned with the concepts and skills that need to be taught in the introductory Computer Science I and Computer Science II courses. In my opinion, more examples of this type of Computer Science education curricular content need to be explored and distributed for review.