In search of small pieces of buggy code!

While reading the Dave’s blog about FUDCon, I was reminded that the mini gdb guide I wrote years ago for my students is woefully inadequate. I have used gdb since my days in university and while it is not the prettiest debugger, I’ve always found that it did what I needed it to do just fine but I don’t think many students are aware of it or make use of it.

While the guide I wrote covers the most common commands, most students still find it difficult to navigate through their code with gdb.  I would be interested in rewriting it but I think that it would be useful if the students could try it out on a piece of code that wasn’t their own.  Usually students often first try the debugger when they are unable to get their code running for an assignment.  Unfortunately this is also usually pushing up against a deadline and learning to use the debugger isn’t on the top of the to-do list… common attitude is to just stumble through assignment with printfs and hope that the bug will get fixed some how.  It would be nice if there was a way for students to be able to go through a series of small tutorials where they can go through some buggy code, step through it and learn to use the basic commands.

I would like to know is if anyone out there has some small pieces of code that have some or all of the following feature

  • compiles… not interested in syntactic bugs here just logical ones so code with syntax errors are not really what I need.
  • clear, easy to understand specs… can’t fix something if we don’t know its broken

but is buggy… in other words it exhibits one or more of the following problems

  • crashes (causes a segementation fault)
  • gives the wrong result all the time(or unexpected results)
  • gives the wrong result sometimes

If you do and don’t mind sharing it, would love to get it so that I’m not inventing a bug.

Fun with Motion Capture

This Thursday  (Dec. 3, 1pm to 6pm)  my Gam667 class will be doing a field trip to a motion capture studio where we will look at the process of capturing real actor movements for use in games.  My class is not big so we can take a few others that have interest in this area.  If you are interested in checking out a motion capture studio and what they do, please contact me.  This is a really cool field trip so if you are available, I’d highly encourage you to join us!

blog feeds

Currently C3DL’s Development news feed is included on the Planet CDOT. Recently while looking at other people’s work on WebGL I came across the WebGL planet.  I figured, it was a good idea to have our dev news there so I asked Chris Blizzard to add us to the feed.

Chris then told me that the planet was having trouble parsing our feed and that a stray character may be to blame.  I found this odd of course because it always showed up on Planet CDOT.  However, I know that the planet software was different for the two so perhaps one was stricter than the other when it came to blog feeds.  I decided to investigate this.

I was not sure where to start as my experience with blogging software is pretty limited.  I decided to start searching for planet venus (the software used by Planet WebGL) since it was the one thing I know was different between planet CDOT (which worked) and Planet WebGL (which didn’t).   I came across a lot of articles on the 2nd planet from the sun, but much less about planet venus the blog feed tool .  I decided to try looking at it from the wordpress perspective to see what else I could find.  Eventually I stumbled upon http://feedvalidator.org/ It lets you check if anything is wrong with your blog feed.

Upon putting in the c3dl feed, I discovered that there was indeed something wrong.  It was in one of the posts which had an <a> tag that didn’t have any url (basically <a href = “”>some text </a> ) . I took it out and the validator indicated that there were no longer any errors in the feed.  Sooo lessoned learned.  Not all planets are as forgiving with their tags, check your feeds and make sure everything is good.   Hopefully this will solve the issue with Planet Venus :) .

 

Planet CDOT contributes to insomnia

Having had a fairly long day, I was thinking about going to bed “early” (before 2am) when I decided that I just should check out Planet CDOT before sleeping.  Although I don’t blog as much as I should, once in a while some things make me want to blog to put in my thoughts on the matter.  Thus, my quick 10 minute pre-bedtime blog browsing is turning into a much longer pre-bedtime blog writting session.

Dave Humphrey blogged about comments being possibly harmful today.  Well that caught my attention because I know that I am one of those teachers that thinks that code should have comments in them.  However, having read Dave’s blog, I can’t say that I disagree with him.  I too have been led astray by comments left in some source file.   Sooo… to procrastinate on going to bed I figured I’d write what I think I would prefer for comments because I think there is a time and a place for them but the comments written should be meaningful and have semantic knowledge.

My thoughts are simply as follows… I hate comments that repeat code.  This is actually something that I have observed students do and it is a pet peeve of mine.  Comments should say something that code does not or possibly cannot say.  If your code is so complex that no one can possibly understand it without a comment… perhaps it is time to consider rewriting it so that it is understandable.

For example, I ask my students to provide a data dictionary… that is variables should have comments stating what they are used for.  And once in a while I get comments like:

double weight;  //a double holding the weight

err…???? What I want to know at this point is why on earth this person is coding in english inside the comment… If I wanted to see code in English I would use COBOL  (/shudders).  Repeating your code in your comment is not useful.  A comment should provide information that cannot be gleaned from your code… for example:

double weight;  //the weight of the car in kg

I don’t need to know that its a double or that its name is weight because I’m fluent in the programming language.  it would be like saying:

/*this loop runs 10 times*/

for(int i=0;i<10;i++){…}

really? nah… it cannot be…how did I ever manage without that comment (/sarcasm)

The other situation where I think it is useful to actually have a comment is in the function description.  That is, when you code a function you should be able to state what it does (not how, just what),  what its expected return values are and what argument it expects.  While how you implement that function may change, what it does should not change nearly as readily.  Thus, the focus of your comments really should be on a very high level what (and even sometimes a short why) but forget about the how .

Anyhow… my 10 min. blog reading session is now way longer than 10 min.  Time to sleep.

Twitter – good or bad

Well, I finally succumb to peer pressure and signed up for Twitter (my id is cathyatseneca).  I had resisted joining it because I know that I’m fairly easily distracted while at the same time focusing on something that is really a distraction.

So far I have made 3 tweets (one was more like a note to myself to check out certain apps).  There was a silly comment/joke I tried to write but I ran out of characters so I didn’t bother with it.  I can see that fitting in your tweets to the given length will definitely be a challenge.  Unlike blogs where you can go on and explain your points, twitter is definitely a place where you need to say what you want to say and do it quickly.

As of day one the distractions have not been too bad but I don’t have too many people I’m following or are following me so far.  Maybe it will grow as the list grows.  For now though, its ok and I can keep up with it :)

Processing.js at FSOSS 2009

This year’s FSOSS was a bit smaller than usual which is to be expected given the state of the economy and a flu virus that seems to be jumping around like a mad grasshopper.  However there was still a quite a bit of neat stuff going on.  I didn’t get to go to as many talks as I would have liked to but I did catch Al MacDonald’s (side note, Al’s site does NOT use Flash!) talk on Processing.js.

I was really interested in it because it is similar in some ways to my own project, the Canvas 3D JS Library.  Processing.js is a language for programming graphics and animations by drawing onto the Canvas Element using the Processing Language.  I had learned a bit about Processing.js before hand but seeing Al McDonald explain it was much much better.

The neat part about Processing.js is that not only will it allow you to create stunning visual effects but being part of a web page means that you can drive the visualization with data from the web.  Al showed a demo of a search engine that visualized search results with processing code. Drawing with processing requires only that you include the Processing.js files as part of your page (similar to how c3dl works).  It does not require add-ons.

There are several students at Seneca working on adding more functions to Processing.js (it is not the complete processing language after all).  Part of this will include adding 3D functionalities to processing.js using WebGL.  As c3dl has already done a lot of work in this area, we are looking forward to working on this aspect with the Processing.js project.

One strange thought I had while attending the Processing.js talk was that for some reason it reminded me of Apple Logo (or was it Apple Turtle?).  This was the second programming language I ever learned (the first was BASIC).  It ran on my old Apple II and basically you can use it to draw pictures by giving commands to a “turtle” (think of it as a cursor that told you where the pen was). As the turtle moves, it draws a line.  You could tell it to go forward, backwards, turn a certain amount lift the pen or put it back down and a probably a whole bunch of other stuff that I cannot remember now.  It was not a fast language but it was really cool because I could visually see what my instructions were doing.  Although I had not used it in years nor was it a practical language it was part of what sparked my interest in programming when I was young.

With that in mind, I can’t help but to think how this could be a really good way to introduce to programming for students at younger grades.  It has some very unique benefits:

  • It’s seems to be a simple language to learn.
  • It’s highly visual and graphical (its not just text… /yawn /boring)
  • It’s open source (no proprietary licensing required to develop or publish with it…just a text editor and a browser)
  • It’s part of the web, you can do some really neat stuff that interacts with the web and data on the web.
  • What you do is on the web…you can do something, publish it and show off your work.

I have done workshops for high school students in past to trigger their interest in programming.  I think something like this would be far more interesting than plain old web pages.

GitX

I’ve been watching the Seneca Open Source planet for a little while and noticed that a few students are using Git.  A friend had recommended it to me when I was working on my website for school this summer.  For those of you using a mac with Git, you may be interested in trying out GitX.  It has a nice gui for some of the tasks (not all… I still had to got to command line for some stuff).

Prepping for the Fall

A new school year is about to begin and this semester promises to bring some very interesting challenges indeed.  The courses I have taught in the past were usually C++ based.  It is the language I am most familiar with and the one that I am most comfortable with by far.  This fall I will teaching something totally new/old… COBOL.

Why?  I am not exactly sure how I ended up with this course… but somehow I did.  It is not a language I am familiar with but I have always believed that programming languages are usually not all that different.  There are however little nuances to each language that make them unique and special.  Grasping that nuance is the key to becoming fluent with it.

While I was studying at the University of Manitoba, my uncle, CT Leung,  was teaching a night class in COBOL at the University of Winnipeg.  He had asked me if I wanted to take the class as I would be able to transfer the credit back to my school.  My reaction then was along the lines of “ha ha… funny, why would I want to take COBOL?”.  Ah… well guess my uncle is getting the last laugh now.  As I was prepping for this course, my uncle spent a bit of time going over some of the those COBOL nuances with me.  Cindy Laurin has also very kindly helped me with learning about the AS400 environment and providing some much needed resources for this course.   I would like to thank both my uncle and Cindy for their help

I am now working on putting up my course materials for this semester.  Mostly this involves getting my web page in order.  This past summer I created a new web page for myself.  It is built with Django and so far it is definitely easier to manage than my old site (basically a bunch of html files that I would modify by hand).  It is not without problems though.  I made a couple of stupid design decisions that I am currently kicking myself for.  For example, I decided I only needed 1 programming standard (I was clearly half asleep at that time).  This is great when all my courses were C++ based but I really can’t use it for my COBOL class.  I also should have made the ability to add non-html style notes for my notes link.  Most of the notes that I have for my courses are done in word.  I would not mind redoing them but that will require time and being able to keep my old notes posted while developing new notes is really not a bad idea.  However, these issues should be pretty easy to fix.

Still much to do so time to get back to it!

Wow… People Do Read What You Write!

Yesterday I decided to get back into the school mode by starting to blog again.  I figured I would start light and blog about my pottery class at the Haliburton School of Arts this summer.  In that blog I had mentioned that I used something called the Steve Tool to make some of the pieces for that class.  Surprisingly, today one of the comments I got about the post was actually from Steve of the Steve tool fame.  He kindly offered some suggestions on how to finish off one of pieces (although I admit… It is highly unlikely that I would actually take a power drill to anything, just a bit too squeamish about using power tools) I thought it was pretty cool and pretty unexpected that my little blog was found and read by people outside of the usual Seneca open source community.

Why Blog?

I admit it, I’m terrible at blogging.  I don’t do it nearly as often as I should but I will try to do better this year… maybe its like brushing your teeth.  You just have to make it habitual.

Anyhow, while I was at my little Raku workshop I had mentioned in passing that I would probably end up blogging about the class when I got home. And the question I got was … why?   I didn’t have a great simple answer at the time other than wanting to keep a record of my experience but perhaps now I that I have gathered my thoughts I would better be able to do it.

Record Keeping – Those of you who know me well know that my memory is pretty much like swiss cheese.  I really wanted to have a record of the things that I learned.  Raku is not something that I would have a chance to get a lot of practice on.  It may be months, even an entire year before I’m able to put what I learned back into practice and by then the things that I have learned may already have slipped my mind.  Re-reading some of the experiences will likely trigger memories on things that I should keep in mind when I do Raku again.

Sharing of Knowledge/Experience – This one is tricky.  I know that there is often a resistance to publication of techniques and methodology. We see this even in our school where some teachers publish their notes openly while others put them behind some sort of access restriction, while some teachers do not post their notes at all.  The debate rages on. My raku teacher had commented that perhaps this instant access to knowledge is not a good thing.  I think that underlying most of the the argument against open access is the idea that it would cheapen the experience (even if it is not put in those terms).  That somehow if many people were to have instant access to the material that it would become less valuable.  Here is where I think I highly disagree with that sentiment.  I have always openly published my notes for courses I teach.  This has not led to students not showing up for class.  I believe that students go to class because that class room experience is such an important part of that education experience.  The written material, the notes and so on, those are things that complement the course but they do not make up the whole course.  I can read about someone firing raku but I cannot experience the course by reading about it.  By actually doing the class, discussing the process with classmates and instructor I learned much more than I possibly could have by just reading about it.  There really is no substitute for that experience.

Spreading the word – The Raku course that I took had a low enrollment (which worked out nicely for us as we were able to get more pieces fired :) ).  I think that part of the problem is that not enough people necessarily knew about the class (or possibly thought the class was too basic for them as the course was called Raku basic).  If people were to blog about it maybe it would have more reach than the usual word of mouth sources.  You never know… I mean Steve found my little blog after all :) .  Maybe other people looking to do raku will see it also.  For me, doing the pottery classes on the weekends have always given me a chance to get away from my computer and do something very low tech (can’t get lower tech than mud right? ).  However I know that most of the people that go never actually make use of the net in that same way.  For example my regular pottery teacher always hands out fliers to the Durham Potters Guild’s show and sales which is great… our entire class of 12 knows about it but that flyer never goes beyond our class.  I can’t help but to think how much more effective it would be to spread the word via the web.  To expand that community beyond the people that we might see day to day.  One thing that I learned last year is that blogs help keep your name and your project out there.  People interested in your work will keep following up on what you are doing and sometimes will participate when they can.

How to Blog 101

Ok, so with all that said, I figured I would write up the thing that I do to make my blog more interesting and draw in interested parties to my blog.  One of the things I do is a lot is I link… a lot.

For example, in this blog I linked to the school where I took my raku class, my previous post, the Seneca open source planet, Steve’s page etc.  Remember that your blog is not … for lack of better description, 2 dimensional.  It is not just the words that you write but the topics that are related to what you are writing about.  By including links, people will be able to more easily find related articles to your post.  Likewise, when you link your site to other people’s blogs and pages, they will be able to find you via pingbacks and related comments. People interested in a related area will find their way to your post via other posts and other sites.  So, don’t forget to spend those few extra minutes at the end to link up what you can.

New School Year, New School Year Resolution

The summer is finally over and its time to go back to school.  I really enjoyed the summer this year.  The weather wasn’t too hot which is a nice change from the normal humid Toronto summers.  My cousin came for a visit from Hong Kong.  He will be teaching CS full time at the American International School in Hong Kong this coming year.  I gave him tons of links to awesome open source software and projects.  Hopefully it will help expose open source to a wider audience.  Other than visits from relatives, I also had the opportunity to take a 1 week course intensive Raku course which I wrote about here.

To kick off the school year I am going to make the following new school year resolution.

I will blog at least once a week.

Last year I learned what a wonderful teaching tool blogs/wiki’s and irc could be.  I loved how it was possible to see what students were working on and what they thought, if they were having trouble in one area and so on…  I liked the collaborative creation of wiki’s.

This year I hope to encorporate it into the courses that I’m teaching.  I think the key to doing this is to practice what I preach… can’t expect students to blog if I don’t.  Anyhow…that is the plan… now to learn about the iseries and cobol  (/me wonders if its possible to program space invaders with cobol on the iseries)

« Older entries