Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Memorable Programming Assignments? 126

Albert Schueller asks: "This fall I'll teach introductory programming for the third time. The class is generally populated by students from a wide range of backgrounds and interests-liberal arts and science types. While we use C++, the language isn't really the issue. Rather, the goal is to introduce basic programming ideas like loops, logic, modular programming etc. What are some of your favorite programming assignments that would be appropriate for students at this level?"
This discussion has been archived. No new comments can be posted.

Memorable Programming Assignments?

Comments Filter:
  • ..... teach all the #defines needed to make C++ look like Pascal!

    and after that.... beat any student that thinks main can return anything other than an int. Beat them well.

  • life? (Score:4, Interesting)

    by Innomi ( 566928 ) on Thursday June 13, 2002 @07:09PM (#3697764)
    Conway's Game of Life perhaps?
    • This gets a big ditto. This was the best first year programming assignment that I recieved. Fun, fun, fun, fun, fun. Many a short night over this one. And you get something really cool to look at once you are done, if you do it right :)
    • No, Milton-Bradley's!
    • It was the last project we did in a Pascal class in high school. We broke it into 3 parts:

      1) input (random, "drawn")
      2) Computing states
      3) displaying

      There were two of us working on competing versions of each sections, and they had to work interchangably. Funniest moment was when we compared the two systems for computing the states. One of the two was about an order of magetude faster. The guy who wrote the slower one said, "There's no way it can be faster. You used booleans. Boolean /sounds/ so much slower than integer. It can't be faster.
    • I remember that one. Quite entertaining.
  • by whee ( 36911 ) on Thursday June 13, 2002 @07:16PM (#3697814)
    One assignment I had gotten in my high school C++ course was a nice introduction to elementary image processing. The design required a simple program that would read a matrix of 1s and 0s from an ASCII text file to perform operations on. A 1 was considered white (on), while 0 was black (off); this part could be expanded to support the full spectrum, although it's good to keep it simple for beginners.

    After loading the 'image', we were required to provide operations that the user could select and perform on the image, such as blob detection, scaling, blurring, etc. (This would be a nice way to introduce modular programming by defining an API for each operation to use and such.) Saving of the image was also supported.

    An assignment such as this would be a great way to bring it all together; matrices, for loops, bounds checking, modular style and others would be covered, showing how all the little things contribute to a larger application.
  • A program that, when taking into consideration all the tests, absences, homework, and extra credit, figures out how many times they can miss the class and still have a chance to get an A (or B, or C) assuming everything else goes well.

    I bet you they'll actually want to program that one.
  • Mandelbrot set! (Score:2, Interesting)

    by nebbian ( 564148 )
    The standard test I use whenever I learn a new programming language/system is to display the mandelbrot set. Drawing the set isn't that hard, but it doesn't stop there! You can set things up so that when you click on a part of the image it zooms in, you can select different colours, etc. I've done this (including zoom) using C++ in XWindows on a silicon graphics machine, using objective C on MacOS X, and even in perl/apache/internet explorer on a windows NT machine! The problem is simple enough to be possible, and complex enough to be challenging.
  • I started my college career as an electricall engineer, and we were reqired to take a C++ class, the only projects we did that I remembered were a game in which we added the variables reqired to make it work, and the final project a pool simulation, it didn't have teams and you just watched the balls go around the table (bonus points if you added pockets), but it was fun to turn the friction down and hit the cue hard to have all the balls go screeming around the table. The class was at Rose-Hulman and I don't remember the prof's name, sorry. More recently I have been working to prick up programming again and the book had a simple exercise for rote beginners, making a F to C converter.
  • Whatever you pick (Score:1, Insightful)

    by Anonymous Coward
    step 1:
    Make it a game. They'll have fun, a few will even want to expand on it. Let them (preferably tell them beforehand they'll get better grades for well-programmed more elaborate versions of the game).

    step 2:
    let them choose which game, and give a basic explanation of an algorithm to drive the game (overlaying arrays for tetris, function-mapping for roads for a simple racing game, collision detection for asteriods (point them at at least 5 websites explaining this, as it gets rather mathematically), using unique pixel colors for platform games, ...)

    step 3:
    teach them to get network play operational (use kdegames for this, you won't regret it)

    step 4:
    give +2 for a kde game ;-). Watch them flow in. Community will be grateful ;-)

    just my .02 cents
    • by Anonymous Coward
      Great...more crappy, unmaintained, un-fun games to go in the kdegames package.
  • Mazes and parties (Score:5, Interesting)

    by linuxwrangler ( 582055 ) on Thursday June 13, 2002 @07:29PM (#3697887)
    Solving a maze is a good example of recursion.

    Still, my most memorable freshman programming assignment (punch cards/line printer/mainframe no less) was to simulate a cocktail party.

    The party was a two-dimensional array representing the room. At the edge was a door and in the center was the bar.

    You fed the program a list of guests including name, arrival time, planned departure time and how interesting the person is.

    Guests arrive and go first to the bar. From there they mingle by trying to move a square at a time if it will make the average "interestingness" of those surrounding that square more interesting that the average surrounding their current square.

    If the guest cannot move to a square such that the surrounding guests are, on average, more interesting the guest is then he will go back to the bar.

    One last provision...each trip to the bar causes a guest to become one point less interesting but to think he is one point more interesting and each drink also increments the planned departure time by one.

    • This was featured in a Scientific America article in the mid to late 80's (A. K. Dewdney's column, I believe). One could look up the specific article, if no one here can provide it.
    • by ChadN ( 21033 ) on Thursday June 13, 2002 @08:45PM (#3698277)
      Solving a maze is a good example of recursion.

      So is solving a maze.

    • each trip to the bar causes a guest to become one point less interesting but to think he is one point more interesting

      That is the funniest thing I have read all day. :-)

    • Solving a maze is great. We did this in my 2nd intro class. After learning a few linked list methods we had to solve a maze using a deapth first (explore one path at a time), then a breadth first method (take one step down every possible path each cycle). We also, as someone mentioned earlier, did simple image processing. E.g. take a two dimenssional array and run a blur filter by averaging each pixel with its neighboring pixels value. We didn't do game of life till the GUI class using Java.
  • Two points: (Score:3, Interesting)

    by devphil ( 51341 ) on Thursday June 13, 2002 @07:51PM (#3698007) Homepage


    First:

    The class is generally populated by students from a wide range of backgrounds and interests-liberal arts and science types. While we use C++, the language isn't really the issue.

    You'd better believe it's the issue. Language determines design is a Bell Labs aphorism. Another way of saying the same thing is that the (human) language in which you think and speak determines what you can think and speak about.

    While I happen to be a big fan [gnu.org] of C++, I will go on record as saying that it's not a good language to use for beginner programmers. (Neither is Java.) I'd say either Python, or Pascal (you know, that language whose major design goal was to teach introductory programming).

    At least, if you are going to use C++, use a good text like Accelerated C++ by Koenig and Moo. Otherwise you'll spend too much time teaching "how to use C++" and not enough time teaching "how to write a good program."

    Second:

    Rather, the goal is to introduce basic programming ideas like loops, logic, modular programming etc. What are some of your favorite programming assignments that would be appropriate for students at this level?

    My favorite prof in the intro sequence gave us a module that drew playing cards on the screen. (All ASCII-based with ANSI escape sequences for colors, no annoying graphics programming.) We had to write the logic to play Solitaire.

    While there are a lot of problems that CS majors would find cool to solve, those aren't necessarily the same ones that will grab the interest of people "from a wide range of backgrounds," as you say your audience is.

    • While we use C++, the language isn't really the issue.

      You'd better believe it's the issue. "Language determines design" is a Bell Labs aphorism.

      It's not the issue in a computer science class. Yes, language definitely affects design -- but this is not a real-world engineering problem. If the assignments illustrate theory, and it's theory that drives the curriculum, then the language is only an issue to the extent that it illuminates the theory.

      Please note that Bell Labs is not a teaching facility.

      In real-world engineering, however, your point totally holds. The end result of an undergraduate CS education should be adability, and the facility to think in whatever language the situation demands.
      • The end result of an undergraduate CS education should be adability, and the facility to think in whatever language the situation demands.

        Yeah, but this is an intro programming class we're talking about. C++ is fine for production code written by professionals, but they don't strike me as great teaching languages.

        The point of an intro class is to draw people in, help them to see how cool it is, get them thinking in the right way, and give them some foundation so that they can go on. Tracking down subtle malloc bugs or pointer problems is enough to bring seasoned he-man programmers to tears; I can't imagine what it would do to an unsuspecting liberal arts major.

        Personally, I started with BASIC and Pascal. Both are limited languages, but Pascal taught me a lot of good habits that helped me when I got to less anal languages. Without that kind of discipline, something as no-safety-guards as C or more-than-enough-rope-to-hang-yourself as Perl might have killed me dead. Or worse, killed the people who had to maintain my code.
        • Yeah, all of the above I agree with wholeheartedly. I'm of the opinion that CS education should de-emphasize individual languages -- and to that end, an intro course should use a language which facilitates de-emphasizing.

          C++ is certainly not such a language!

          Pascal is a decent choice. I'm personally a fan of Schemefor the first semester (worked marvelously at Macalester), but not religious about that. Java could work OK, if students use a very limited subset -- it's not a shoot-yourself-in-the-foot language -- but it's very hard with Java not to get into high-level structure questions inappropriate for the first semester. It's probably better for the second semester, when you start talking ADTs.

          Perhaps you'd quibble with some of the previous paragraph, but I think we've basically found consensus. On Slashdot!! And without any Microsoft-bashing, even....
    • way of saying the same thing is that the (human) language in which you think and speak determines what you can think and speak about.

      The linguistics side of that is called the Sapir-Whorf hypothesis, and in its strong form (the one you stated) generally isn't taken very seriously. However, language does influence thought, that's certain.

      I think a more direct relationship is true for computer programming, however, which is really the point of this discussion anyways.
      • "Language determines design" is a Bell Labs aphorism.
        The language determines the edge between what is worth doing and what is not worth doing, and therefore determines design. Of course a lot of the design will be much the same for a lot of languages, at least kinda-sorta. You don't use the same language for the measurements of camshafts and for the fish that got away.

        The linguistics side of that is called the Sapir-Whorf hypothesis, and in its strong form (the one you stated) generally isn't taken very seriously. However, language does influence thought, that's certain.
        What happens is jargon, which fills in the missing concepts and terminology.

  • by Rombuu ( 22914 ) on Thursday June 13, 2002 @08:04PM (#3698078)
    ..making students prove NP=P is a good assignment for 1st year students.
  • It's easy to maintain interest if the end result is something fun that you can actually show people.

    Now let's see - what's easy to write? Maybe a card game(solitaire?) or a tetris-type thing or other puzzly-thingy, or very simple 2D action games (hey, they fit in 4KB back in the day).
  • The wrong thing to do is to assign something where the result of their work is a bunch of printed text.

    Something along the lines of RoboCode would be ideal:

    http://www-106.ibm.com/developerworks/java/libra ry / -robocode/

    But since you're doing this in C++, you'll have to roll your own.

    Basically, whatever it is that they're doing, make it something that can take input from some external source, and have its output be read by something that can transform the output into something fun. This means a *lot* of work for the teaching staff, since they'll be writing lots of libraries and/or server/client code.

    For example:

    output for their code are integers ranging from 0 to 2^16. These integers are fed into a digital to analog converter and the students get hear the result. Student will go from producing a single tone (they'll have to create a sine wave, or even a triangle wave is fine) to chords and melodies in no time! lots of good programming and SIMPLE programming meat to chew on.

    students could write a black jack player. the input will be integers representing the value of their card, and they'll output if they want to hit or stay. then the staff (you) could write a nice gui and driver around the thing and the students can play black jack (or any other card game...) against a program that they wrote. you could also make the programs play against each other.

    etc., etc.

    Best,
    andrew

    • then the staff (you) could write a nice gui

      I like this bit of evilness: write your GUI beforehand, and then write a specifican, but make it wrong. Tell the students that the GUI won't be ready for a week, but they will be graded on how they interact with the GUI. Tell the class to write the program and test code to prove the interface works (error checking not required). On the day the assignment is due, collect the their program and the test code, and give them the GUI in library format (previously announced that way of course). Make sure the library doens't impliment the specification, but just tell the students "I will be testing with this GUI, not your test program, since you didn't have time to test with my implimentaiton I'll accept revised versions that work for one week, you will lose points, but not as many as if your program doesn't work. Of course you know that their program will not work with the GUI so they don't lose points, they just sweat a little.

      Evil, but fun to do, and it fits the real world very closely.

    • CS classes, as well as any non liberal arts classes, should not be designed to be fun. The students are there to learn because they are interested in the subject, not to be entertained.

      Also, I'm a big fan of 'weed-out' classes & projects.

      Mike Coles
      'bluelip'
  • by Anonymous Coward on Thursday June 13, 2002 @08:13PM (#3698134)
    I taught second quarter C/C++ about five years ago; the students were supposed to have had at least one quarter of C/C++ under their belts. I started off trying to give them an appreciation for the imperfection of computers. For instance, I tried to teach them that if you're dealing with ints, and you add 1 to (2^31 - 1), you don't get 2^31, but rather -2^31. I also tried to teach them that floats become granular at 2^24, i.e. if you add 1 to the float 2^24, you don't get (2^24 + 1), but rather (2^24 + 4). The class revolted, went to the dean [who let most of them transfer to a different section], and I was nearly fired.

    If you're one of the posters on this thread who thinks that a bunch of liberal arts losers are going to program pool table simulations and Mandelbrot sets, then you're living in a fantasy world.

    The following is THE MOST DIFFICULT homework problem they were able to solve: Write a C function that takes an int, and returns one of the strings "st", "nd", "rd", or "th" to describe the ordinality of the associated number [e.g. 1 returns "st", for "1st", 2 returns "nd", for "2nd", 3 returns "rd", for "3rd", 4 returns "th", for "4th", etc.] The trick was that e.g. 11 returns "th", but 21 returns "st". A handful of them were able to get that right.

    The final project was to write a program that would take large files and decompose them into smaller chunks, each small enough to fit onto a 1.44MB floppy. Not a single student in the class came close to finishing the project, and the class included at least three fellows who were already programming for a living.

    • I think your students just had a piss-poor teacher. In our first computer science course in high school we programmed a blackjack simulation once we had the basics down. Many of us were proto-geeks, but only one of the class had any actual prior experience. This was done on Commodore Pet's, the Vic 20 wasn't going to be around for another year or so.
    • And now to Final Jeopardy...
      Write anything !
    • Trippy... I would've figured that final project would have been dead easy, as long as you didn't have to also reassemble the file...

      In sloppy pseudo

      Open input.dat for reading
      while not eof
      open file x.dat for writing
      while isize of floppy in bytes and not eof
      readbyte
      outputbyte
      increment i
      increment x

      Am I missing anything?(ignoring the initialization of x and i each time through, or having to check how much room a floppy can really hold because of bad sectors or filesystem fluff)

      If you are actually writing to a floppy, I suppose you might need a "wait for new disk" bit.

      I think that kind of class sounds neat, but I also realize that you'd never have enough students at my uni to get paid.

      (my uni lowers your pay if you have less than a certain % enrollment and doesn't pay you at all below another % and usually force you to cancel the class, even if those enrolled comprise all of the students that meet the prereqs in the entire uni and all need that one class to graduate. Bastards.)
    • by t ( 8386 )
      Disclaimer: I am an Electrical Engineer.

      This is my biggest complaint about Comp Sci degrees. Many of these people are useless programming anything with math. At my old company, I would rather hire a math guy with zippo programming experience because it was easy for those people to pickup programming. Just try and teach a CS guy math! I seriously wish they would start differentiating the degrees, e.g., Comp Sci with specialty in numerics or something.

      That kind of nonsense is why there's 50+ email clients and only a handful of the important things like audio/video compression etc... Things with numbers.

      • There's also a lot more cheap quartz digital watches than there are atomic clocks, what's your point? The more complex something is and the less real demand for it there is the less people that are capable of and willing to designing such a thing.

        fortunately, I was the only CS student in my numerical analysis class, which was tought by an EE and full of EE & ME students.
      • That kind of nonsense is why there's 50+ email clients and only a handful of the important things like audio/video compression etc... Things with numbers.

        And here I thought it was because a very large number of people use email clients every day, and because the relavent protocols are well documented and publicly available, while compression algorithms are used by a relatively tiny number of people, and are typically patented, poorly documented if at all available, and require more math than i suspect the average EE knows either to invent.

        Besides which, it sounded like your parent was complaining about trying to teach CS to people "only taking this class because it's required" (and who apparently have more clout with the dean than should be allowed).

      • The problem is that there are few good math instructors that can relate math to the real world.

        The most common math instructor follows the book, example for example, and then tests you on similar things. Students end up going through the motions.

        The worst instructor does the above and then tests you on extreme extrapolations of the simple examples.

        The best instructor ignores the book's examples, points out the tricky stuff, why it is tricky, and other ways to look at the problem. They also relate the material to real life. The exams are a combination of stuff that was taught and a variety of extrapolations. (if the mean on an exam is 35/100, your exam or teaching is probably at fault, though an entire class of apathetic students is possible.)

        In general, math majors are the only people who really care about the classes as everyone else is required to take them in addition to their major. Non-math majors see no immediate relevance to what is being taught.
  • sort (Score:3, Interesting)

    by rabiteman ( 585341 ) on Thursday June 13, 2002 @08:54PM (#3698313) Homepage
    In high school AP C++ class, when we were learning about sorting my teacher mentioned the different 'standard' sort algorithms, describing how they worked theoretically, and how some were n! and some were n log n, but we never actually compared the output of programs using the different methods. Out of boredom one day I went and made a program that generated a bunch of random arrays of various and then timed how long it took each of six or so algorithms to sort them all. I took the output and graphed it in Excel (being too lazy to make my own graphs ;) and sure enough the better sorts did much better. Coding several different algorithms to perform the exact same task may seem needlessly redundant (because it most certainly is) but it's a great way to get a grasp of loops & recursion &c.
  • Ah, 15-127 (Score:4, Insightful)

    by nadador ( 3747 ) on Thursday June 13, 2002 @09:20PM (#3698394)
    (Oh, to be a freshman again. To take a "programming" class. To never have heard things like "this implementation is O of log n" or "NP complete" or "software cost estimation" or "preemptive fixed priority scheduling"...)

    The only assignment I remember from my first programming class was one in which we read in stuff from a file into a linked list, printed it forwards and then printed it backwards. The abstraction of the linked list was so cool, and when it actually worked I felt like king of the nerds (little did I know the horrors to come).

    When I was at CMU, there was one intro to programming class, and it was no fun for anyone. Now they've broken it up into people-who-might-take-another-CS-class, and people-who-don't-like-smelling-like-the-cluster, hence a class that is very light on fun and heavy on syntax and object oriented garbage, and one light on programming and heavy on pointy clicky fill in the blanks and make a game happiness.

    stepping onto my soapbox:

    While we're talking about intro classes, I think everyone who is going to take any additional classes in computer science, especially in the systems area, should take their first class in C, and it should be no fun. Every now and then you can toss them something fun, but learning the discipline of malloc/free, strncmp, etc., will serve you so well when you get to do object-y type computer science stuff. Writing good code, in a scientific or engineering sense, is just like learning to use UNIX - if you didn't suffer, you didn't learn. And if you get to new/delete or just new and then forget about it, you never learn the discipline that writing good code demands.

    -- steps off soapbox.
  • First year (Score:5, Interesting)

    by bertok ( 226922 ) on Thursday June 13, 2002 @09:25PM (#3698415)
    I studied Computer Science at the University of New South Wales [unsw.edu.au]. The introductory computer course in first year was "Comp 1A". Instead of C, C++ or Java, we started with a language called Haskell [haskell.org], a pure functional language. Everything has to be an input to a function, or an output - no local variables, no assignment, no loops. The only available form of high level flow control is recursion. After a few weeks, we could write functions to solve simple problems like: Write a function that has an integer input 'n' that returns a square character array representing the image of a square with side-length 'n'. Trivial stuff, even for beginner programmers.

    Sometime in the fourth week, our lecturer announced the eagerly anticipated first Assignment. I couldn't wait, because I expected to ace it, after all, I had years of programming experience, a huge advantage over my peers. Not so: We had to write an Optical Character Recognition (OCR) program. I was stunned. I had never done anything that complex in my life, in any language, and now I was being asked to do it in a functional language! However, many people achieved recognition rates over 80%, and some people rates as high as 98%, even though most students were first-time programmers. It just goes to show what people are capable of when pushed.

    The same lecturer (Andrew Taylor [unsw.edu.au]) later came up with a whole series of Evil assignments -- his students tell stories about them to this day. For example, our second assignment in Comp 1A was to write an AI for the card game Hearts [one.net]. To mark the assignment, he wrote a system that ran submissions in randomly chosen four-player games automatically, and ranked them by total score after some number of games. Half the marks were based on the performance of your AI! He even made the ranking software available beforehand so that students could test their algorithms against each other in mini-tournaments.

    • I've been subjected to a similar thing in a course on "Applied Atrificial Intelligence". We did an AI for checkers though, and it was not an introductory course. (It required at least one course in Algorithms and most had at least 3 years of experience of coding.)

      I guess courses like that are good at times. (I know I've had my share of "killer assignments/labs".) As a lecturer you need to have a good knowledge about how much work your students have in other courses at the same time. There's nothing worse than having multiple assignments like these due in one week.
    • Now that's bizarre. I knew not one but two Andrew Taylors when I did Computer Studies at Canberra University fifteen years ago, and the one you've referred to isn't either of them. What is it about the name Andrew Taylor that causes one to become a computer educator at an Australian University? Is this like the Eric Conspiracy but more detailed?

      : Fruitbat :
  • Dare I say was to generate the Fibonacci sequence!
    • i had to do this my freshman year

      so all i have to say is:

      no, god no.
    • Most of the suggestions have been too hard and/or in the wrong language. This one is WAY too easy. AND it doesn't teach any 1st semester CS stuff. Well, okay, one loop.

      As for a general response, all the books that I used for CS (C++ 1,2,3 and intro is asm) Had both example projects and "problems" at the end of the chapter. Why don't you open the text you are teaching out of or *gasp* go down the hall to the library and check some books out.

      One I happen to remember is along the lines "Write a program that guesses a number between 1 and 1000 in as few guesses as possible. Detect lying by the player." This is a perfect first semester problem. It forces the use of screen and keyboard I/O, it forces the use of loops. By assignment you can demand that it is broken down into functions. It introduces the idea that you have to detect and deal with bullshit input.

      Finally, to all those to say "make it something fun" or "make it games" GROW UP. Go to a bullshit "tech institute" if you need the professor to spoon-feed you and forcibly retain your interest.

      -Peter
      • Go to a bullshit "tech institute" if you need the professor to spoon-feed you and forcibly retain your interest.

        There is nothing wrong in trying to make the assignments interesting. Any assignment that encourages the students to experiment and go beyond the actual text of the assignment is good. The goal of a teacher has to be to make his students learn more, if they do that by having interesting assignments thats the way to go. Of cource if you cant make an interesting assignment to teach a particular thing then they have to take a boring one. But you can always add a little competition to the mix, eg sorting: all the algorithms are in the book, who can make the one that will run fastest, everyone should be able to finish the assignment but if people spen a little extra time fine tuning their code to beat the other person/group then they'll learn more

        One excellent assignment we had was pac-man in java, using inheritance for the ghost we could easily replace the 'AI', using inheritance for the walls we could make 'one way' walls, invicible walls, walls that opened/closed on a timer etc The 'board' was read from a file so we even made a 'level editor'. We never actually implemented all the extra ideas we had, but i Think I've got the source lying around somewhere so I might pick it up again

        This is probaly not stuff for the first C/C++ class. But if you can make the game yourself with a 'go in random direction' AI for the ghosts. Assignment: Replace the AI with one that goes in the direction of pacman unless there is a wall in the way. Bonus: Make a better AI, promise extra points for those that makes the one that is hardest to get away from, promise extra points to the one that is most fun to play.
        Second Assignment: Add 'power pill' make ghosts run away when pac man has power pill.

        • Hmm, you seem to have interpreted what I said as "A real CS class should be as dry and boring as humanly possible. A good CS instructor gets half his students to drop and fails half of those who remain."

          Sure, interesting is good. Fun is good. It is easier to work hard at something fun. But in a first semester "this is what a loop is, this is what it is good for, why not use "i" for the loop variable?" class a game is a distraction from the fundamentals and is a less than ideal way to teach them.

          BTW, I think that Java is a HORRIBLE language to teach total neophytes on. You either have to teach OOP right out of the chute (but you have to teach procedural at the same time so they can write some methods) or you have to do a lot of arm waving and "Don't worry about why you are doing all this "class" stuff, you'll get that at the end of next semester." which teaches them "this is all black magic, so just mimic what I do and don't worry about how it actually works" right out of the box.

          To illustrate, I asked several "Java people" (to include professors) if there was an assembler for the JVM. Not one of them knew, or could even make out if this was a sensible question. I finally found the set of (published?) machine instructions somewhere at java.sun.com and a couple of unofficial assemblers by google.

          Java has some really cool features, but it is a dumbed-down language aimed at dumb programmers with the effect of keeping potentially smart programmers dumb.*

          -Peter

          * Don't get me wrong. One of the smartest guys I have ever met, and probably the best programmer I have ever known is a Java wizard. The point is that as a teaching language it is exactly the worst thing in many ways.
          • Java has some really cool features, but it is a dumbed-down language aimed at dumb programmers with the effect of keeping potentially smart programmers dumb.*

            I do most of my professional work in Java these days, so you'd expect me to disagree. But you're 100% right. Java is a language with most of the sharp edges hidden away between a lotta cushy padding. And generally, I think "Thank god for that," even though I personally find it constraining.

            Why? Because half of the programmers out there are below average. (Or, as a mathematician I know reminded me, more than half the programmers are below the mean.) If I'm going to work on somebody else's code, I'd much rather it be in Java. Bad Java is salvageable; bad C or Perl is so impenetrable that you might as well just off yourself. Or, perhaps better, the person who wrote it.

            Personally, I like to drive fast cars, the kind of sports car where you can hear the engine's every growl and feel every pebble. The kind where you can turn on a dime and give yourself whiplash by stepping on the gas pedal quickly. But can you imagine the carnage if all cars were like that? For everyday people and everyday uses, minivans are all most people should be allowed to use. Ditto Java. But although minivans and Java keep people safe, they make it impossible to build your skills past a certain point.
    • Why would that be memorable? Seems pretty simple to me...
      #!/usr/bin/perl

      $foo = 1;
      $bar = 0;
      while (1)
      {
      print "$foo\n";
      $baz = $foo;
      $foo += $bar;
      $bar = $baz;
      }
  • Since Scheme is so simple, this is surprisingly easy to do, and it's a great learning tool. It helps students understand what's really going on when they run their program.

    See Abelson and Sussman's classic computer science text, Structure and Interpretation of Computer Programs [mit.edu] (aka The Wizard Book [jargon.net]), for details. This book is also an excellent introduction to the basic concepts of computer science.
  • Two years ago I was given a connect-four game in JAVA to program for first-year programming. The course sounds much like yours, assuming no programming knowledge. I'm unfamiliar with C++, but our assignment was simply to write the classes the connect-four game needed. a list of players (for tournaments) a board class to hold rows/columns etc - I forget, but the program started with selecting/adding players, size of board, len of winning line etc. We we're given a working game, complete with GUI, that used our classes as we wrote them. that way, if we hadn't finished all the classes, the game could still work. the programming tested knowledge of loops, checking for winning lines, stuff like public finals (player colours) as well as a further understanding of the communication between classes etc. email tim bell tim@cosc.canterbury.ac.nz for more info
  • One of my most memorable programming assignments was implementing Conway's Game of Life. With all of the bruhaha surrounding complexity and Wolfram's new book, this would seem particularly germane.
  • by ttfkam ( 37064 ) on Friday June 14, 2002 @12:54AM (#3699203) Homepage Journal
    Give the model of a deck of cards where the first card is the 2 of spades, the second is the 3 of spades, the thirteenth is the ace of spades, the fourteenth is the two of hearts, etc. In other words, each card in the deck (minus jokers) is assigned a number.

    When given a number from 1 to 52, spit out the name of the card to which it refers. If you want to make it interesting, tell them to solve it twice, using a different method each time. This has two probable solution types: 52 element lookup table or judicious use of the modulus operator. At the end of the assignment, there is usually a small amount of code (easier for beginners to debug -- easier to grade), but gets the gears turning for people not used to thinking in terms of algorithms.

    Keep your eye on those folks who write out a series of 52 if-else-statements or a giant switch statement; they're going to need some tutoring soon.

    ---

    Enter a number as input and spit out that number in hexadecimal and octal.

    ---

    Enter a number under 100 and spit out that number in longhand (36 turns into "thirty six")

    ---

    Read in a variety of data (user's name, age, favorite color, etc.) and spit it back out in a pleasant greeting: "Hello <name>! You are <age> years old and your favorite color is <color>."

    ---

    These aren't horribly difficult -- so you won't drive many people away -- but you still have the opportunity to teach basic I/O, general style, adequate commenting, algorithm efficiency, and (most important) how to approach real-world questions in the step-by-step manner required in programming (multi-threaded/multi-process smart-ass programmers here on /. can shut up now -- this is an introductory class).

    Far too many people who program suffer from lifelong-geek syndrome: knowing how to program for so long that they've forgotten what it was like to learn how to program. As long as you demonstrate sufficient patience, anyone can be taught basic programming skills. I truly believe that most can grok pointers as well assuming they stick with programming long enough and have a good enough teacher.

    Good luck with the class.
  • Honestly, games (Score:4, Interesting)

    by KurdtX ( 207196 ) on Friday June 14, 2002 @01:24AM (#3699283)
    Games are good because not only do they encompass a wide variety of possibilities, but they are acessable to everyone. None of my (non-programmer) friends cared that I could do the tower of Babel in x lines of code, but they liked my simple race car game I wrote in assembly (it was only single player). The coolest was the space invaders we did at the end of my 101 class; the TAs provided a mostly complete graphics library (so we could use images or shapes to make the baddies), and the really bored/advanced students modified the graphics library to change the players ship, weapons, ect. so there was something to challenge everyone.
  • GAMES!!! (Score:2, Insightful)

    As many othe rpeople have said, GAMES!!!

    For example start with somethign simple like Hangman, then move to somethign a little more difficult like the towers of hannoi (spelling?) I also had a lot of fun programming the game of monopoly in my introductory programming class. So many diffrent objects to create!
  • I once took a course in mathematical modeling, and we did some great stuff with simulating the motion of a spacecraft in earth orbit. We simplified the real problem by only using two dimensions, keeping the spacecraft confined to a plane that intersects the center of the earth.

    Another simplification was that we didn't use a continuous flow of time. We cut the flow of time into discrete ticks (minutes or seconds), and calculated the change in position of the spacecraft from one tick to the next. The spacecraft is given an initial position and velocity, which are used to calculate the position and velocity in the next tick (the x and y components being done separately).

    From one tick to the next and for each direction (x and y), it breaks down into:

    1. calculating the gravitational force exerted on the spacecraft by the earth using the masses of the earth and the spacecraft, the universal gravvitation constant, and the distance from the center of the earth to the spacecraft.

    2. Using a = F/m to find the accelleration of the spacecraft due to gravity.

    3. Using v_new = v_old + a * delta (delta is the length of a tick) to get the new velocity .

    4. Using p_new = p_old + v_new * delta to get the new position.

    5. Repeat.

    You can do some neat stuff with this. The two that I remember doing were

    1. Start with the object at say, 100 miles up, and find the minimum velocity needed to stay in orbit, and the minimum velocity needed to escape from the earth.

    2. Bring the moon into play and find the velocity needed to do a figure 8 orbit around the earth and the moon.

    One problem with this is how to look at the orbits. We used Gnuplot.

    This is quite heavy on physics, which might lose some students, so I'm not sure if it's a good assignment for an intro-level course, but I do remember it being a lot of fun.
  • We used Karel J. Robot [pace.edu] to teach the basics. It's a robot simulator with a good graphical display. The robots only a few basic instructions like move(), pickBeeper(), putBeeper(), turnLeft() and turnOff(). Robots can also sense beepers, walls, and other robots, as well as know their compass direction. The robots can also communicate with one-another. They roam the streets and avenues of the Robot World. It's all Java, and it was fun. Take a look if you're interested, the whole curriculum is online there at the previous link.
    Some of the kids had a hard time; but isn't that the point of introductory level CS classes, to weed out those who would rather chat on AOL or read their email in class?
  • 10 REM - Wow this TRS-80 is cool
    20 PRINT "CARACTACUS POTTS IS THE GREATEST!!!"
    30 PRINT "STRONGBAD IS A WUSS!!!"
    40 GOTO 20

    • TRS-80's kicked ass back in the day :) !!!
      I started out with a TRS-80 Color computer -w- 16K Ram and an external (audio)tape drive - upgraded to "extended color basic" a few years later... Ok, o the OS(basic interface) was written by Mirosoft - but they weren't really considered bad guys back then... funny, I seem to remember the trs-80's crashing a lot - displaying @ signs all over the screen... ah... some things never change...
      • Back in the day! Before we got rid of our TRS80 - about 3 months ago, I gave it one last sign-off run. geez, that thing never quit for me - and it's how I learned BASIC
  • I know it's easy, but it's such an elegant problem. I remember doing this for the first time in the fourth grade. I'm sure it will take your students back to try a kids' problem from a mathematical perspective.
  • by Zocalo ( 252965 ) on Friday June 14, 2002 @05:52AM (#3699861) Homepage
    One of the more useful assignments I had when learning to code (this was machine code, but the principle stands) was to debug someone else's code. All the code had been produced by the lecturer, but using several styles of writing, comments etc. to simulate a basic algorithm that had evolved into something more advanced. The code had numerous errors, some obvious, some subtle, some downright fiendish. The object was to find and fix the bugs and flaws.

    Ideally you want to ease them into this slowly, give away the location of the first bug - bombing if you enter a string where numbers are expected for example, provide test data for the second and so on. Another important thing is to ensure that if the student chooses to re-write an entire function they don't side step another part of the exercise by obliterating another of your carefully crafted flaws.

    The exercise tests the students understanding of the language, ability to prepare realistic test data, and ability to find common bugs like off-by ones, buffer underruns, overflows and so on. It's also pretty good preparation for the "real world" where you will need to read other code, fix other people's errors and improve their code, besides being damned interesting if done right.

    • From the early days of programming, I recall that everyone that is just starting out programming will automatically strew various bugs and imperfections around their programs.

      Hence, the big thing you learned outside of the classroom was how to debug and to interpret error diagnostics.

      Funny, but years later I'm still doing the same thing.

    • Okay, a day late, but this reminded me of an assignment that is too evil NOT to give your students, especially if you want to teach the basics of GOOD algorithms: Propose a problem (any problem, just make sure it is defined well. Mathematical problems or sequences, something with an elegant (or at least short) recursive solution, etc), and have each member of the class go home and write an algorithm to solve the problem. The next day collect the algorithms and hand them out randomly to other students. Have the students code up the algorithm AS GIVEN, making comments on the algorithm and in their code as they feel is appropriate. This was an assignment in my AP CS A class in 1999, and some of the algorithms were interesting (For example, one of them required the implementer to code an "if loop" (in C++)). Grading was based on (a) your algorithm (correct, clear, implementable), (b) how well you implemented the algorithm given to you (did you follow it or did you improvise your own solution?) and (c) the "quality" of your comments (corrections, etc.) on the algorithm you were given. This assignment was definately a good experience for me. Plus it served a good purpose for our teacher (who took the best algorithm writers/correctors) and used them as (essentially) TAs the next year.
  • Roman numerals? (Score:2, Interesting)

    by Pembers ( 250842 )

    The first programming assignment I got at university was to convert between Roman and Arabic numbers. Mind you, this was for a "real" CS course (that is, my whole degree was computer science), and I was told to write it in Ada, so it wasn't exactly what you'd call fun ;-)

    Something like this would help teach loops, and programming of simple logic and arithmetic. It would also teach the importance of input validation. A Roman number is all letters, so you have to read it into a string, but only certain letters have any meaning.

    Also, the Romans had no representation for zero, nor (AFAIK) for negative numbers. They may have used fractions, but not decimals. The Arabic to Roman converter should (probably) therefore accept positive integers only. What, then, does the program do if the user inputs, say, "3.7"? The library function that reads an integer may read "3" and stop on the decimal point, or silently round it to 4. This would not be a good thing, so you'd need some validation there as well.

    To simplify it, you could convert just one way. Roman-to-Arabic is probably easier than Arabic-to-Roman. You could also ignore the rule that says if a letter comes before one that has a larger value than it, you subtract the smaller from the larger. That is, 4 is normally written as IV (5 minus 1), but you can also write it as IIII. (I believe the Romans did this early on. You might also see clock faces that use IIII for 4. This is for the sake of symmetry with 8 (VIII) on the opposite side.)

    Tell them that the program has to handle numbers up to 1,000, just so that they don't type in a big array or switch or if-then-else.

  • This is probably too advanced for beginners course, but we recently had an assignment to implement Gomoku(5 in a row tic-tac-toe) played on a 31*31 board as part of an AI unit. The goal was to use proper search startegies like minimax, alpha-beta pruning. To make it a bit more fun, the lecturer added some weired rules to it. Have a look at www.computing.edu.au/unitpages/ami251.
  • Comp sci(101) - 3rd day of class, the professor gave me the following challange: write a program in pascal ( on old 386 ) that will calculate x^y for number too big to solve with compiler's functions - example 9999^999.

    Sounded simple at first.. ended up making a function that multiplies an array of numbers by an array & repeating it until done. Included functions for calculating amount of memory needed, estimating size of equation, time to complete, etc...

    Brought it in 1 week later - professor gave me a 4.0 of the course and said I didnt have to come back :)

    As far as writing in c++ goes, it would require the student to utilize pointers, arrays, type casting, functions, reserving & freeing heap memory, converting end result to decimal & displaying.
  • I'm a CS students. My first programming course was based on Scheme (sort of LISP, so the course itself was mainly based on functional programming). Anyway, the most interesting exercise I was given was a small URIM emulator. URIM is a simplified abstract machine (it just has 3 instructions: set-to-zero, increment-by-one, compare-and-jump-if-equal) we used in some programming exercises.
  • I fondly remember writting a spell checker in assembler. Gave me good experience of how computers really work.

    Another good one would be to enter into IBM's robocode programming challenge - write 'simple' java robots that fight to the death - http://apps.alphaworks.ibm.com/rumble/
  • The best way to learn is to do a project that is somewhat "bigger" than the usual small assignments.

    My favourite is to have them implement a simple recursive-descent parser for a minimalist computer language. This is not hard at all, and given that you can limit the scope sufficiently (e.g: a command-line calculator), it should be possible to have as a four-week assignment (assuming you have already teached them about ifs, while-loops, and recursion).

    Another great example is a small computer game. You could either choose the silly variant (paper-rock-scissor), or a more advanced variant (tetris, snake, asteroids, space invaders, pacman) using simple graphics. Write the graphics-routines yourself, and have them put in the game-code.

    A simple trick for making your students do larger projects, but limit the work, is to write everything yourself first, and then delete the lines you think they should be able to do, and replace them with a comment about what they should insert there. It's very efficient for learning.

  • This from a programming contest for Youths I entered when I was still young (10 years ago): write a program for 2 players (No AI needed) so that they can play the game of Rubik's Mirror. It's a four in a row game where the top half of the board is mirrored from the bottom half. You can put a new piece on the board, or move one of your own pieces one square. I don't know if you can find the complete rules somewhere, but google [google.com] should help.
  • by bluGill ( 862 ) on Friday June 14, 2002 @10:24AM (#3700768)

    I've always wanted to teach a class just so I could give this assignement: Write a RPN calculator that does addition and subtraction, no more. A few rules that are different from every other project: other class mates will see your code; redit will be lost for implimenting functionality byond addition and subtraction; the due date is next week, but you get MANY extra points by getting the assignment to me sooner; class dissmissed, get to work.

    Then the next week I would copy everyone's program, and randomly hand it out to other students, with a new assignment: add multiplication and division to this program, and fix any bugs in the code. Time counts again. Note that even though I say is the random, I will in truth pick out who gets what, those who did a good fast job get aweful programs to work with, while those who did a bad job get good ones, and there will be a comment as each studnet picks up his assignment that this is an example to learn from. After they turn in the completed assignment (remember time counts) they will get another assignment, write a short paper to the author of the program you graded on what you found good/bad. (english skills don't count so long as it is understandable, ideas do)

    Finially, everyone see's how their program looked after the second guy got done with it, and the comments. Grades for the second half will take into account how the first half turned out, so someone who got a horrid, non-working assignment and took all week to make some stupid algorithm work will get as much points as someone who was able to get their assignment done in an hour. How long it took the second programer to modify the orginal code is a factor, but minor since bad programs should not take down easy to modify code.

    Just make sure that this is done early in the year, if they are supposed to learn C++ in your class, this won't work, by the time they can do this all their other classes are in crunch time and a good student may notbe able to get this done quickly. I recomend giving this assignment the first day of class, if they can't hack it then, they need more expirence than your class can give.

  • If you want something interesting, fun, challenging, and scalable according to level of skill and talent, hold a Ro Sham Bo contest.

    Read the /. article [slashdot.org]. Find resources at the Google Web Directory [google.com].

  • It sucks that you have to consider this, but...

    Be sure to give assignments that lend themselves to lots of creative solutions. This is especially true these days, with academic dishonesty so commonplace. If the assignment is open enough to allow people to solve it in many different ways, you will get a lot of different answers - this will make your life much easier when it comes time to detect the cheaters.
  • Have the students write simple graphics assignments.

    You, the instructor, can supply the bootstrap code needed to get a drawing surface up in whatever platyform you choose. Supply a function like GraphicsMain() and ask the students to fill it in.

    You can do all kinds of neat things like reading in points from a file and displaying them (you supply the files initially). Then have the students write a program to generate their own point files. Have them make a simple 2D visualization program.

    This would be a great way to demonstrate modularity too, since you can emphasize that if carefully written, the code can be used later on the next phase.

    In addition, these types of assignments are a lot of fun (since there is instant visual feedback) and they really lend themselves to creativity. Encourage everyone to explore for themselves beyond the boundaries of the assignment and you will get the brightest, most talented students submitting really interesting things.

    I think a fractal engine which displays L-systems would be very appropriate, for example. Instructor supplies the bootstrap code, and a handout describing what L-Systems are, and asks the students to draw it. Not too difficult, a good example of file-io (to read the L-system) some basic maths (geometry, etc to get angles right - you can even supply this on the handout if you think the students might be lost), and string manipulation. There are a few ways to do it also, and the good students can come up with their own L-systems to demonstrate.

    Those are some of my most enjoyable ideas.
  • I recall a particularly cool assignment where the professor gave us a long-ish (~1-2KB) chunk of text that had been run through a rotation filter. He gave us the background info on what rotation filters were, how to defeat them (look for most frequent character, that's 'e', determine the shift, then reverse that and print out), etc. all the theory to solve the problem. It taught us simple file I/O (open old, read data, do computation, print out into new), really simple data structures (making us think about the best way to store the frequency information), as well as a little baby-step taste of how cool encryption/decryption was. There was just something magical about running the program and having it work right, producing the cleartext. It's great to feel like James Bond cracking the Secret Evil Message ;-)!

    The kicker was that he chose a very cool poem as the cleartext, so when you reached the finish line you got rewarded with a result that was actually interesting to read. This part might well appeal to liberal arts people, as well history types will be aware of how critical a role codes haved played throughout time.

    This is just my very humble opinion, but are you sure c++ is the way to go for beginning programmers? I fully realize you may not have a choice due to departmental constraints. It's just my experience that most intro-level programmers being taught C++ have such a hard time with the language itself that they can't see past that to the applications of it. Otoh, a language with a C-like syntax is probably a good move because so many things use that (I've always said that if you learned C well you were half-way or more to learning any of a dozen other languages). So, have you considered something like Java or Perl? (Or, god forbid, python ;-)) Both of those languages are easier to grasp, enabling you to focus more on what you can do with them than how to write a virtual destructor... Heck, with perl you could give them a very easy taste of web applications development using cgi and databases, for example, a collaborative story writing system (user A writes chunk 1, B writes 2, and so on)...

  • by orn ( 34773 )
    Have your students program the game of life.

    Supply them all the graphics primitives, teach them how to make a two dimensional array (or fake one), and teach them the loop structure necessary to traverse and iterate the machine.

    For extra credit, ask them to find a good solution to the boundary problem. Or ask them to come up with a new life primitive. Or just expose them to all the primitives that are out there.

    Finally show them that silly book written by that bright guy on finite automata.
  • In my first year CS class at the University of Saskatchewan [usask.ca] the assignment used to drive home the concept of recursion was, given a set of characters, produce a set of all the possible permutated strings with those characters. There was the "eureka!" moment when the concept of recusion finally clicked.

    Then there was the assignment where we had to write a program that produced itself as output...that made my head explode the first time I tried to figure out how to approach it....

  • hell (Score:1, Offtopic)

    by cr@ckwhore ( 165454 )
    In 2000, I was asked (and paid) to write a large application, in DOS, with quickbasic, and btrieve.

    After living through that experience, I shouldn't have even entertained the idea.
  • Comment removed based on user account deletion
  • Hello world(Duh!)
    reading from stdin printing it out on stdout
    taking a file name as an argument printing from it
    program that takes a number-date and prints day of week
    atoi itoa ect...
    find what int has the same binary pattern as the float for the same value(hint: make a float pointer point to an int)
    simple inventory program
    such things...

  • Our assignment was to make a calculator program (text based) on a VMS server in assembler. Addition, subtraction, multiplication, and division all in our own assembly routines. Fun!
  • In some of the Deitel books (e.g., C++ Learn To Program, Java Learn To Program, etc.) they have a really helpful problem: implement your own Virtual machine using a predefined machine language. You can monitor the register states and see what happens after each command. If having them write the machine code themselves is too complicated, at least having such a simulation to play with, giving them an intuition for how a computer "really" works, could be very useful.

    Of course, some people won't be that interested, but it's the kind of program that makes certain kinds of people fall in love with programming.

  • Here is a list of memorable intro-level assignments that have been given at Stanford, in no particular order: Game of Life
    Towers of Hanoi
    Boggle
    Tic-Tac-Toe
    Bunny World -ok, Bunny World wasn't that simple
    Lode Runner
    Simple Fractals
    Driving directions
    Mad libs
    Slot Machine
    Simple Drawing Program
    C interpreter - seriously, they gave this to second quarter students

    If anyone wants details on any of these please ask.

  • Even though it uses Java (conversion to C++ should be a breeze) as the implementation language, you might want to take a look at Great Ideas in Computer Science with Java [mit.edu] by Biermann and Ramm from MIT Press [mit.edu] (ISBN 0-2620-2497-7). It covers a wide range of ideas in a manner that is quite approachable for non-CS folk.

    You might also look at The New Turing Omnibus: 66 Excursions in Computer Science [whfreeman.com] by A. K. Dewdney from W. H. Freeman & Co. [whfreeman.com] (ISBN 0-8050-7166-0) which is a good source for important and interesting CS topics, though it may be more work to construct concrete projects.

  • In my experience, the problem most beginning CS students have is understanding "computer think", or how to solve a problem.

    Very early in my first CS class (like the second or third class after we got the obligatory lesson in history and basic terminology) our instructor brought in a loaf of bread, a knife, peanut butter, and jelly. She asked people to write instructions on how to make a peanut butter and jelly sandwich on a piece of paper.

    After about 20 minutes she called on one person and followed their instructions, smashing bread into the jar and using the knife to stab the bread. It took a visual exercise like this to make people understand how each instruction is very important, and to be attentive to details.

    Later when we did Towers of Hanoi she brought in three of those Fisher Price ring-stack toys. She showed us with those how to get the disks from peg one to peg two in a way we could understand.

    One other thing that was helpful was being shown that we weren't just "learning C++" or "learning Java", that we were learning skills that are portible to other languages. After our first looping program we got a small booklet from our teacher that showed the same problem solved in several different languages.

    As for actual problems we had to solve, I hated most of them, but I'm thankful for having done them. Most were intentionally difficult (reading and writing data in bizarre file formats) that made me a much better programmer.
  • by ginsu ( 37651 )
    My younger brother's been beating his way through AP computer science this year, so I've had a chance to think about this issue quite a bit.

    The best way to make people (moderate geeks at least) excited about the programs they write is when they are excited about the output they produce. There are a few ways to get those results:
    1. A very easy graphical library. Perhaps a simple physics-with-visualization library, or a stripped down 2d sprite manipulator. People would much rather write 'pong' if it's a GUI app than writing pong thats played in a little gimpy text window. If you make it as easy or easier to do the former than the latter, they'll be more excited with/proud of the results.
    2. Provide a program which filters their output. You wouldn't want people to have to deal with learning (let alone generating/outputting) something like HTML or flash files or DXF files or whatever you can think of. They have other classes for that. But if you can define a simple 'language' which, in turn, generates one of those more complicated file formats, they can again be proud of their output. For example, I wrote a small program for my brother which would parse his input files and spew out POV RAY files. A very limited set of scenes were possible (specifically, it was a logo generator -- you chose fonts, colors, textures, lighting etc) but his program was able to generate very simple '.logo' files to drive it. So his ~100 line C++ program had cool 3d rendered output. Beyond graphical things (which I've focused on so far) you could create tiny languages which, for example, created animations -- or midi files, or wavs, or ...


    In essence what you are trying to avoid is the "I'm embarrassed to be proud of this" factor. The first time you pick up a musical instrument and haltingly jam out "mary had a little lamb" it's a huge moment. But you can't stroll into class the next day and say "dude, check it out. Last night I was playing Mary Had a Little Lamb. Oh yeah, I'm serious." If you can avoid the analagous situation, make programming fun while teaching fundamental skills, then even for non-geeks the 'ugh I don't want to do -that-' inerta factor is easier to overcome, hence making teaching fundamentals (and grading, no doubt) easier and more fun as well.


    But what do I know . . . I took all my intro courses with hardcore CS majors. We were excited about spewing out ASCII UI's :)

  • The best "beginner" programming assignment that I ever heard of was about sorting. Very fundamental stuff. But the items to sort were graphically displayed, with a simple API to swap two items. The goal was to let folks see their software in action.

    In an improved version of this approach, each student was told to sort the numbers, and given the initialize(), value(i), and swap(i,j) functions. But they were not told how to perform the sorting. Afterwards, each different sorting algorithm that was implemented was described by the students, and the professor covered any techniques that had been missed. This leads to a discussion of O(N^2) vs O(NlogN). And a future assignment to implement and compare (graph) the efficiencies (number of swaps) of different sorting algorithms.

    Ultimately, if you can foster a attitude of "here's a little bit, lets see how far you can take this", and then shape their results further, they will learn far more.

    The most instructive assignment I ever had was based on this. It involved writing a simple 3D perspective drawing program from scratch. The instructor said we could use any language, on any computer, and write the code any way we wanted to. Grades were entirely based on how well it ran. Some time after we turned it in, he announced the next assignment: Extend the previous assignment to handle shading from multiple light sources. That assignment, whether intentionally or not, taught me more about commenting and documenting my code than anything else ever did.
  • Ok, so it's been awhile since ive been in intro to programming, so if some of this is beyond the scope of the class forgive me or feel free to modify it so that it fits. But one thing that makes a good assignment is a good reward at the end (other than credit), letting the student feel like they have really accomplished something neat.

    This is a program i had thought about writing and posting for free on the web, but i got caught up in other things.

    The map syntax for BZ flag is reletivly simple and could easily be generated in a C program, it would be interesting to write a program that would ask a few questions and based on the response generate a random map for BZFlag. I could write the program in a couple of hours, so if you give a group of 2-3 students a week to complete the project (plus time to examine the extrmemly simply BZflag Map syntax) it should do well at seperating out the good, average, and poor programmers.

    Make a point of specifiying that the program working should not be enough, it should be lean as possible, and include documentation.

  • A good quickie is to have them calculate all the prime numbers less than n, using ancient greek methodology. [utah.edu]

Real Users know your home telephone number.

Working...