2010-02-20 101 views
8

我将在今年夏天教授我的第一部大学水平的计算机科学课程,目前我正在努力提出学生将完成的有趣任务的想法。该课程是该课程的第二部分,涵盖了算法和基本数据结构的分析,如堆栈,队列,列表,树等。计算机科学入门课

我有很多想法可以运行(创建带有马尔可夫链的音乐,Twitter客户端等),但我总是在寻找对学生来说很有趣/有趣的新想法 - 毕竟,当一个人玩得开心时,最容易成为/仍然从事课程材料。我正在寻找关于您或其他人可能在过去完成的第一年级别任务的意见。

之前有人提出这个问题,是的,我知道关于漂亮的作业,并已检查出来。只是请求你可能有的任何其他想法。我们都记得大学的一些特别有趣的作业。这些是我理想中要求的体验。

+0

看看我在同一领域的问题,也许你会发现有用的东西在那里http://stackoverflow.com/questions/1318770/impressive-examples-in-java – Roman 2010-02-23 14:09:58

回答

2

SICP有一些非常不错的作业。

4

“有趣”作业的麻烦在于,他们通常对学生来说比学生希望的更多的工作。特别是英语不好的学生和学生在最后一刻离开作业。 [然后用“请做我的作业”的问题开启SO。]他们中的很多人在设置任务时都会遇到困难,但是你不需要一大堆抱怨练习的学生感到恶化太难了,或者没有被你的讲义报道。

我的建议(从经验)是尽量保持背景知识的数量和对标记的编程任务的“挑战”低。

为可选的练习设置有趣的问题是一个合理的想法,但重要的是要警告学生不要花时间在他们身上,而牺牲其他更重要的工作。

+0

我绝对同意,并期待保持作业简短且相对简单 - 但也希望甜蜜。 :)我有机会在过去为同一课程创建一些作业(在教学助理角色中)。一些运作良好,而且有些结果正如你所描述的那样 - 有趣而有趣,但对于学生来说太长和复杂。尽管如此,我希望找到一些可能足够简单的理解和完成的宝石,同时仍然很有趣。当然,我尊重你的答案,并会大步前进以保持简单。 – 2010-02-20 07:33:08

+1

英语不好的学生和将作业留到最后几分钟的学生在达到大学水平之前应该已被过滤很久。在“乐趣”级别上仍然合理,在检查作业和与学生互动时会减少麻烦。 – Anonymous 2010-02-20 15:13:37

+1

@匿名 - 不幸的是,这不是它真正的作用方式。 – 2010-02-21 01:52:55

1

我一直在使用下列网页中的一个灵感:

你。也可以使用竞赛中的任务(example),但这很可能需要您的一些工作 - 以确保分配作业的公平性(有些可能会比较棘手,而不是集中于你提到过的)。

0

有一件事可以考虑,也许不适合学生所做的第一门编程课程,但是稍后会将他们的代码从他们以前的作业(他们自己或他人的)手中修复。如果您选择不正确的提交,理想情况下有微妙的缺陷,这会更好。

一个类似的想法是有一个实验序列,使用前面实验的(成功完成的)代码作为起点。当我在很久以前的LiU上做了介绍性编程课程(PINK--增量系统编程)时,有一部分实验室工作(实质上)归结为实现日历,使用抽象类型和访问器,然后事后改变抽象类型的实现。对于说明提供良好界面的需求非常有价值,如果没有其他内容(从内存来看,我最终花了一两天的时间思考“更改实施”),然后实际改变了15-20分钟我的抽象数据类型,因为我在前面做了艰苦的工作,只是需要说服自己)。

0

猪拉丁文。

让您的学生编写将英文文本流转换为Pig Latin的代码。 The rules非常简单,但它们需要一些有趣的特殊情况,特别是在标点和大写时,要求它们编写基本的扫描仪/标记器。

在一个典型的一句话是这样的:

Quietly, Anne walked into the forest. 

你应该得到这样的:

ietly-quay, Anne-ay alked-way into-ay e-thay orest-fay. 

,但你很可能得到:

uietly,-Qay Anne-ay alked-way into-ay e-thay orest.-fay 

已放错地方的标点符号,不当放置曲和不正确的大写。

0

一对夫妇的我发现与学生产生共鸣的想法:

  1. 分形艺术 - 一个很好的方式来教递归,因为学生可以可视化的过程(如谢尔宾斯基三角形,L-systems雄心勃勃的学生)。您可以在context free art上看到使用上下文无关语法生成的一些非常令人印象深刻的图形。
  2. 图像处理 - 通过在图像上映射像素操作函数来教授函数式编程(例如交换颜色通道,高斯模糊,处理色调);这比典型的syntax tree-based generative art作业要简单一些。

关于教授入门级计算机科学课程最难的部分是整个典型班级的编程能力差距。因此,如果您可以为能力较差的学生创建足够简单的作业,并且可以轻松地将其扩展(例如通过额外学分),以便为高级学生解决更复杂的问题,那么在我看来这是理想的选择。

1

package assignment01;/*确保这个类在包assignment01中。 */

import java.util.ArrayList; import java.util.Arrays;

/** *该类是执行各种数学函数的方法的集合。这些方法都是静态的。这个 *类是作业#1的一部分。 * * @author .......... * @version 2010年6月15日 */ 公共类MathLibrary {

/** 
* Computes and returns the mean (average) of the numbers in the list. 
* 
* If the input list is empty, the returned mean is 0.0. If the list contains illegal values, the behavior of this 
* method is undefined. 
* 
* @param list 
*   an ArrayList of double values 
* @return the mean of the values in the list 
*/ 
public static double mean (ArrayList<Double> list) 
{ 
    // Variables 

    Double sum = 0.0; 
    int arraySize = 0; 

    // Check for empty list 

    if (list.size()== 0) 
     return 0.0; 

    // Take sum 

    arraySize = list.size(); 
    for(int i = 0; i < arraySize; i++) 
    { 

     // Check for null Double 

     if(list.get(i) == null) 
     { 
      System.out.println("Mean Function: Array has null element at index: " + i + "."); 
      return -1.0; 
     } 

     // Add element 

     sum += list.get(i); 
    } 

    // Return average of results 

    return (sum/arraySize); 
    } 

/** 
* Computes and returns the median value of the numbers in the list. If the list has an odd number of elements, the 
* exact median value is returned. If the list has an even number of elements, the average of the middle two 
* elements is returned. 
* 
* If the input list is empty, the returned mean is 0.0. If the list contains illegal values, the behavior of this 
* method is undefined. 
* 
* The order of the elements in the input array may be changed by this method. 
* 
* @param arr 
*   an array of double values 
* @return the median of the values in the list 
*/ 
public static double median (double[] arr) 
{ 
    // Variables 

    double arraySize = 0; 
    double arrayMedian = 0.0; 
    double temp = 0.0; 
    boolean unsorted = true; 

    // Check for empty array 

    arraySize = arr.length; 
    if (arraySize == 0.0) 
     return 0.0; 

    // Sort array 

    while(unsorted) 
    { 
     unsorted = false; 
     for(int i=0; i < arraySize - 1; i++) 
     { 
      if(arr[i] > arr[i+1]) 
      { 
       unsorted = true; 
       temp = arr[i + 1]; 
       arr[i+1] = arr[i]; 
       arr[i] = temp; 
      } 
     } 
    } 

    // Find median 

    if((arraySize % 2) == 0) 
    { 
     // Take average of two middle array indicies 

     arrayMedian = (arr[(int) (arraySize/2.0 - 0.5)] + arr[(int) (arraySize/2.0 + 0.5)])/2.0; 
    } else { 
     arrayMedian = arr[(int) (arraySize/2.0)]; 
    } 


    return arrayMedian; 
    } 

/** 
* Computes and returns the largest integer that divides (without remainder) both of the input integers (the 
* greatest common divisor). 
* 
* If either of the input integers is not positive, this method returns -1. 
* 
* @param a 
*   any positive integer 
* @param b 
*   any positive integer 
* @return the greatest common divisor of a and b 
*/ 
public static int gcd (int a, int b) 
{ 
    int gcd = 1; 
    int minimum; 

    // Check for (a || b) < 0 

    if ((a < 0) || (b < 0)) 
     return -1; 
    if ((a == 0) || (b == 0)) 
     return 0; 

    // Compute half the minimum(a,b) 

    minimum = Math.min(a,b); 

    // For each number below half the minimum of the two check for divisibility 

    for(int i = 1; i <= minimum; i++) // zero case is already accounted for 
    { 
     // Check for divisibility 

     if(((a % i) == 0) && ((b % i) == 0)) 
     { 
     gcd = i; 
     } 
    } 

    return gcd; 
} 

/** 
* Computes and returns the smallest integer that can be divided by (without remainder) both of the input integers 
* (the least common multiple). 
* 
* 
* If either of the input integers is not positive, this method returns -1. If the least common multiple exceeds the 
* maximum possible integer value, the behavior of this method is undefined. 
* 
* @param a 
*   any positive integer 
* @param b 
*   any positive integer 
* @return the least common multiple of a and b 
*/ 
public static int lcm (int a, int b) 
{ 
    // Variables 

    int lcm = 0; 

    // Check for negative numbers 

    if((a < 0) || (b < 0)) 
     return -1; 

    // Use gcd to get lcm 

    lcm = (a * b)/gcd(a,b); 

    return lcm; 
    } 

/** 
* Given a number n, this method computes and returns the smallest prime number larger than n. 
* 
* If the input integer is not positive, this method returns 2. If the next prime number exceeds the maximum 
* possible integer value, the behavior of this method is undefined. 
* 
* @param n 
*   an integer 
* @return the smallest prime number larger than n 
*/ 
private static boolean isPrime(int n) 

{ 

if(n == 2 || n == 3) 
{ 
    return true; 
} 

if(n == 1 || n % 2 == 0) 
{ 
    return false; 
} 
for(int i = 3; i * i <= n; i += 2) 

if(n % i == 0) 
{ 
    return false; 
} 


return true; 

} 

public static int nextPrime(int n) 
{ 
    if (n<0) 
{ 
    return 2; //if n is not positive. 
} 
    int value = n; 
    if (n == 2) 
    value = 3; //finds the next prime number. 
    else 
    { 
    do 
    { 
     value += 1; 
    } while (!isPrime(value)); 
    } 
    return value; //displays the next prime number. 
} 

}

0

一个任务我思念的时候我回想起我在大学初期的任务,旨在教导我们关于GUI的任务。我们被要求实施一个网页浏览器。

Web内容的实际显示并不特别重要 - 我们被鼓励使用Swing的Web视图 - 这是更多关于这支持了这一功能:

  • URL栏
  • 历史
  • 前进和后退
  • 设置主页
  • 保持书签/收藏夹
  • 标签browsi NG

分配给了你自由发挥来选择它们的任意组合,只要你做了至少一组号码。这让真正热衷的人能够实现绝对所有的功能,并且允许任何更加匆忙的人实现最低限度的功能。

多年来,还有一些类似的方式构建了更多的任务,并且它们总是顺利完成。你会感到惊讶的是,学生们会多花多少时间去做更多的事情,并且做得比所需要的多。


根据经验,一般情况下,这个事情我和我的coursemates似乎找到了最吸引人的是更直观:在OpenGL,图形用户界面,网站等任何基于命令行程序并没有想象中的乐趣。

也许正如你专注于算法,让学生可视化排序/搜索算法可能是一个好主意。除了教他们关于图形框架外,它还有助于可视化算法并加深对它的理解。你可以用数据结构的自定义实现做类似的事情。

这个关键在于找到一个图形框架,这个框架合理直观,记录完善,使用方便,支持得当。没有比让我们使用现实世界中没有人真正使用的技术的任务更令人沮丧的了。你不想让这门技术成为这项任务中最难的部分。

我不认为你会教他们使用一个可能被认为超出该模块范围的框架是一件坏事:学习如何使用新的框架和库本身就是一项技能,如果你想成为一名有效的软件开发人员,并且大学似乎没有明确地教授这一点,就需要开发它。