Wednesday, September 26, 2012

Showing More Solution Code

Show Solution Code

This is something I've been meaning to do forever.

As a start, I've changed the String-1 and Logic-1 sections so that for about 20% of the problems, it will put up a "Show Solution" button once someone has solved the problem. (To see solutions before solving the problem, see the Warmup sections.)

Inside the solution code I've also added "Solution notes" comments -- a couple sentences pointing out what's useful or interesting about those lines of code.

Very often I see submitted solution code that works, but which could be better, sometimes quite a lot better. Hopefully seeing clean solution code will help people see how to write better code. It does seem like a great moment to learn from the better code, since the person working on the problem has all the right context at that moment, thinking about that problem and its code. Sebastian Thrun of Udacity makes a good argument that putting good solutions in front of people at the right moment can be a big win. Heh, of course having some "perfect" solution put in one's face could be a little annoying! Here they've just made this little victory, and now they have to look at the better solution. Well the benefits seem well worth a little annoyance and humiliation!

The Show Solution button will appear for problems with hints, as they always have. I've added hints for several problems, so those will now show solutions too. I've also added the Show Solution button to a bunch of random problems, doing it for roughly every other problem running down the middle of the three columns in the String-1 and Logic-1 sections. The phrase "Post-solution available" down at the bottom of a problem page means the bit is set so it will show the solution once it's solved. All told, about 20% of the problems in those sections have solutions available, so I figure most people will run in to them here and there.

Custom problem authors: you can do this yourself by adding the showpost:true tag to your problem, or by adding a hint.

Clear Code vs. Short Code

Another slight issue is that not everyone agrees what code is best. For the record, I'm aim for code which is the clearest, which is the IMHO the best sort of code for almost all projects. Sometimes there is a solution which is very short but kind of ugly, and I tend to avoid code like that. However some people argue for the most dense code, even if it's hard to read. Anyway, the balance between short code and clear code is a whole separate article I need to write one of these days. Maybe the best approach is to show the clearest solution, and then mention other approaches in the comments. There's probably not a single "best" anyway, just a few good styles.



Thursday, August 30, 2012

Codingbat DDOS Outage

Well here's topic with zero fun -- Codingbat.com is currently unavailable due to a DDOS attack. I guess someone saw one too many test failures and just couldn't take it any more.

On a more positive note, I have a list of Codingbat features I should have time to work on this fall, so I'll make a separate post about that.

Monday, October 3, 2011

DDOS attack, codingbat collateral damage

Ouch -- apparently there's a DDOS attack going on against some site at the same facility that hosts codingbat. Codingbat, its data etc. etc. are all fine, it's just a question of actually reaching it! Anyway, sure hope the provider fixes it, so I can go back to not thinking about this sort of stuff. Bleh.

Saturday, May 28, 2011

Progress Graphs

Progress Graphs is a new CodingBat feature using HTML5 to draw a little time series graph of the struggles and failures and eventual success that make up the work on each problem. Here's some random makeBricks() graphs. Since it made me laugh during development, you can also see random "epic" graphs which are basically problems that took a long time: random epic graph.

Individuals can see the graphs of their own work as they go, and the graphs appear on the done page. My hope is that the graphs are just kind of fun to look at, giving a sense of iteration and gradual progress. Of course the progress is basically made of quite a lot of failure, punctuated with occasional success.

See About Progress Graphs for more info.

The graphs can also suggest to teachers which students might be cheating, since the graph of just pasting in the solution doesn't look anything like someone actually doing the work. Of course the students can get around that with effort, but the graphs do raise the cost of doing the wrong thing. At Stanford, I make code-writing exams that look very similar to the homeworks, and an F on the exam gets an F in the class automatically, so there's a clear incentive to make an honest effort on the homeworks, using them to learn the material.

Monday, December 20, 2010

ATT DSL -- making ppoe password work

Ok, this is just a regular blog post I wanted to help out others with this att setup, but it's nothing to do with cs-education.

ATT is offering $20/mo DSL in my area, and it seems like a great deal. It goes up to some terrible price in one year, so you have to remember to call them. Seems shabby to count on the customers forgetting to call and reset the rate, but for $20 I'm in, so I guess they have me figured out.

I don't mind that they have the super no-brainer install script to run things, but it's crazy that they don't ALSO have just include the few needed factual details for the tech savy. Not only are there no instructions included, but what's on their help boards is incorrect, so here is the right answer. I'm assuming you want to connect their modem to some networking gear, like a router or whatever:

1. Make a hardwire connection to the modem. Connect to 192.168.1.254 and change PPP to bridged

2. Now on your router, the att instructions tell you to enter your att username and password for the ppoe login. This is incorrect on my setup (I'm guessing it was correct at some time in the past). Instead, there is a special "network" password which you are not told, and this is what ppoe wants. Seems like this password would have been good to print on the data sheet that comes with the install. You can go to the following url, and use it to get a new auto-generated network password. Then type that in as the password for ppoe.

https://uversecentral2.att.com/uvp/home/password_reset

I suspect att would have been better off just leaving the ppoe without any authentication, instead solving it with a little logic at their end. Just looking at the help forums ... a vast amount of user and support time has been wasted on this, in contrast to the elegantly hard to screw up "I'm on my telephone line so I'm me" authentication scheme.

Tuesday, March 9, 2010

JavaBat gets Python support, now CodingBat

Wow, well there's a big new feature -- Python support! So now there's online python problems on the 'bat! This is something I've been thinking about for a long time, but it just took a lot of coding. I had to change the name of the site from JavaBat to CodingBat. The name JavaBat sounded silly and weird at first, but I grew fond of it with so much use. So I hope the name CodingBat will grow to make sense, although of course today it sounds a little funny.

There are not as many Python problems as Java problems as yet, but I'm adding them quickly. I wanted to cut the Python capability over to be live so I can see how it works before adding any more. I am, of course, very interested to hear bug reports given the large new features -- email me at nick.parlante@cs.stanford.edu

I had to make the front page look very different .. now it lists some Java sections on the left and some Python sections on the right. I hope this is not too confusing for people accustomed to the old all-Java look. You can get to the old all-Java page by clicking the Java link.

If you don't know Python, try it out for a few problems. You can start playing with the Python Warmup problems where the solutions are available to get a feel for the language. I wrote some basic Python help docs to help you get started.

Since the Python problems are so parallel to the Java problems, it might be an interesting way to learn Python .. since you can look at your own Java solution for a Java problem, and then work out how it goes in Python ...heh, your personal Rosetta stone.

Sunday, January 17, 2010

JavaBat Jan Features GO

There's a few features in the pipeline for JavaBat. Prompted by a suggestion from a loyal reader, I tried putting a copy of the GO button up at the top, so writing code is less constrained by the availability of vertical space, like on a netbook. I'm hoping we all get used to it, since it seems useful, but it does look a little funny after all this time with the button at the bottom.

Also, for people using the authoring feature, the tag parsing was so primitive, it could not tolerate any spaces like in "section : Logic-1" ... anyway I fixed that bit of lameness.

A teacher suggested that it would be nice if a teacher could see all the problems a student has attempted, rather than just the ones completed. That would be easy enough to do. One disadvantage would be that currently students can attempt but not solve a problem privately, and I like it that way. I don't want anyone to feel inhibited about thrashing around trying to solve things, since that practice will lead to excellence, but it won't look excellent at the start! Anyway, it's maybe worth trying as a feature.