View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Jeff Watson

4th Year
Computer Science/Pre-Law
Graduating August 2006

Fall Semester Classes:

Discussion 1

Article: Can C# Replace Java in CS1 and CS2? – by Stuart Reges
Available via the ACM Digital Library (accessed through Georgia Tech Library)

In this paper, Reges explores the possibility of using C# rather than Java in introductory computer science courses. He mentions several times throughout the paper that the two programming languages are very similar. He begins by discussing the features that the two languages share, just a few of which are the use of interfaces, exceptions using try/catch, and threads. He devotes the majority of the paper, however, to discussing differences between the two languages.

Some of the features present in C# and lacking in Java may allow for students with little or no programming experience to more easily learn to program with C# as opposed to Java. C# includes a main method very similar to the main method in Java, but C# also includes a much simpler main method as well. Although this may seem trivial to experienced programmers, this simpler main method may be helpful to novice programmers who may be confused by the parameters of the traditional main method in java. C# also includes a foreach loop that is not present in Java. This could provide incentive for novice programmers to include iterators in the structures that they define, thereby introducing what is typically a slightly more advanced topic (iterators) at an earlier point in the course (same time as for, while, etc.).

The main drawback for using C# rather than Java in introductory programming classes, or any other class for that matter, is that C# is not a great multi-platform programming language as Java is. Students who program in Java are generally encouraged to choose among several different operating systems and pick whichever they like best to program their assignments in. C# limits students' opportunities to program in different environments.

Although many similarities exist between the two programming languages, some of the differences prove to be important to consider when deciding which language to use for introductory computer science courses. These differences affect the order in which students learn different programming concepts and the ways in which students learn these concepts. This will likely affect the students' future programming practices. For example, students who learn C# as a first language may become more comfortable with iterators because of their use in conjunction with foreach loops and therefore use iterators more often in practice than a student who had little use for iterators when learning how to program in introductory courses. Additionally, students who take classes that are taught in Java and who are encouraged to experiment with programming across different platforms may develop a better understanding of similarities and differences of different platforms and be more comfortable programming across a variety of platforms. I will admit, however, that the differences between Java and C# are few enough as to not cause much of a rift between those who are introduced to programming through one of these languages vice the other.

I also read Mark Shalda's discussion of "A Comparison of Java and C#." He mentions several specific differences between the two languages (operator overloading in C#), but also makes sure to point out that there are similarities as well (large set of libraries for each language). He also points out that although Java is a free interface and C# is not, this should not be a problem for many students because of the MSDN-AA program that allows students to get C# free of charge. He concludes by saying that he sees no good reason for C# to not be used rather than Java. I agree with his conclusion, but at the same time, I am not convinced that the few benefits of C# over Java for novices are enough to warrant a change in introductory computer science curricula from Java to C#.

Discussion 2

Part One: What is the difference between creational, structural, and behavioral patterns?

Creational design patterns "abstract the instantiation process." In such a design pattern, a system does not depend on how its objects are created, allowing objects in the system to vary both in structure and in functionality. The system may be configured either at compile-time or at run-time. Additionally, there are two types of creational design patterns: class (varies the class instantiated via inheritance) and object (instantiation delegated to another object). The Abstract Factory, Builder, Prototype, and Singleton design patterns are all object design patterns. Factory Method is a creational class design pattern.

Structural design patterns consider the ways in which classes and objects can fit together into larger structures. Because multiple inheritance involves taking several classes and forming one class(taking many different parts and forming one "structure"), it can be considered as a type of structural design pattern. When structural design patterns are implemented, object composition is more flexible and can change at run-time. In the object-scope, the Bridge, Composite, Decorator, Facade, Flyweight, and Proxy design patterns are structural. The Adapter design pattern is a structural design pattern in the class-scope.

Behavioral design patterns focus on the interconnection and interaction among objects. To make communication among objects flow as smoothly as possible, these design patterns look at algorithms and assign responsibility to objects. Whereas behavioral class patterns use inheritance, behavioral object patterns use object composition. There are many different behavioral design patterns. In the object scope exists the Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, and Visitor design patterns. The Interpreter and Template Method patterns are behavioral class design patterns.


Part Two: Template Design Pattern

The Template design pattern is not only one of the more often used design patterns, but is also quite easy to implement. By creating an outline of an algorithm in the form of an abstract class, one can avoid unnecessary duplication of code among various subclasses that may share some methods/functionality. Functionality that is different for each of the classes can be implemented separately in each class, while functionality common to all classes is inherited. Even if different classes need to accomplish the same tasks but carry them out differently, these differences can be sorted out within each specific class. For example, in creating a program used to sort data, an abstract class (the template) may contain a method "sort()" and its subclasses determine how the sorting actually gets carried out by selecting which helper functions to use in conducting the sorting.

I am primarily interested in this pattern because it is so easy to implement. It makes sense to me because it is logical to use one class as a template and avoid duplicating code, thus saving time. I can definitely see using it in my coding, as I have used this pattern several times before in my code. Obviously, this code would be most useful when working with a program that requires multiple algorithms that share the same basic functionality, or that share the same basic goals but get these goals accomplished differently.


Discussion 3
(also available at Discussion 3 - Jeff Watson)

Part One - Overcoming Problems

In detail, describe a problem that you experienced in Squeak. What was the problem? Why did it happen? How did you eventually overcome this problem?

In trying to add the automatically resizing text functionality to our project in M2, I was easily able to figure out a good process for determining when the text size needed to be changed. Unfortunately, I spent a great deal of time trying to figure out the right calls to make to actually change the text size. At first, I used 'scaleFactor:' (part of the Morph class, therefore available to all subclasses of Morph as well) to change the size of the text (the text is in a TextMorph). While this did technically accomplish the task, simply changing the scale factor made the text very difficult to read after only a few scalings. I then decided to attempt to change the actual font size of the text. I found many different methods that altered the font, but I was unable to find any that simply changed the font size without also setting the style, emphasis, etc. Even after finding these methods, I had trouble figuring our the right way to use them. This happened because I did not fully understand the different font-related classes and some of the terminology used in those classes confused me. I was finally able to resolve this problem using the 'beAllFont:' method in the TextMorph class. The following code will set the font to 'Accuny' and the font size to '10' (in the example, 'self' refers to a TextMorph):

self beAllFont: (StrikeFont familyName: 'Accuny' size: 10).

Part Two - Learning From Classmates

Discussion 3 - David Figlar
David describes a way to show a window listing all accesses to a particular instance variable in all classes. This is particularly useful in helping to understand how different methods in classes relate to one another when one is looking through code that he or she doesn't understand. Also, it can help the programmer visualize the way his or her own classes/methods are interacting.

Discussion 3 - Wes Floyd
Wes mentions a way to adjust syntax highlighting in squeak. Syntax highlighting is especially useful for novices who haven't yet completely grasped Squeak's syntax. Also advantageous is the ability to choose between different syntax highlighting schemes.

Links to this Page