I took Udacity’s seven week intro to CS course when they launched it in February. It was a great intro to programming and Python. I’m now taking Web Applications Engineering with Steve Huffman, co-founder of Reddit.
Steve is a great teacher, and the fact that Udacity has him teaching a class is a key part of their potential. Steve just has to make the course once. If everything goes well, they can run it forever. Steve can go back to working on Hipmunk, and continue to teach thousands of students with his videos.
Something I made – My ROT13 Homework Assignment
So, what have I learned so far? Judge for yourself. Here’s a rot13 web page I made for this week’s homework:
https://graeme-udacity.appspot.com/rot13
The assignment told us what to do (“make a web form that applies the ROT13 cipher to some text”), but not how to do it.
(What’s ROT13?: The rot13 algorithm shifts text by 13 letters. That means after two shifts, you’re back to the original text. Try entering some text and submitting twice. It’s a poor cipher, but better than nothing)
What I’ve Learned So Far
I know, I know. It’s very simple, and completely pointless. But it’s the first “app”? I ever put on the internet, and the fact that it works makes me unduly happy.
Also, the page took me only 10 minutes to make. I made everything from scratch, including the algorithm. This blog post has taken more time. But here’s what I had to learn to make it:
- How to write a ROT13 algorithm. I’m sure mine could be better (here’s the code), but it works.
- How to create a new class to handle the POST and GET requests to my rot13 page.
- How take the user’s data, error check it, and return the rot13’ed text.
- Write the html to display everything.
None of that is particularly useful, yet. There is a lot to learn to become a good programmer.
But that list is a lot more than I knew how to do ten weeks ago, and I haven’t been doing this full time. And I’ll repeat, the page only took me ten minutes to make.
When the class is done, I may actually be able to make a rudimentary app that does do something useful. Meanwhile, I’ll try to keep the sense of satisfaction and wonder I get from seeing my simple rot13 cipher work on the internet.
Learning By Doing
I like Udacity’s project based focus. In this class, we’re building a blog. You learn so much more by actually doing it yourself. When something breaks, I have to figure out where I messed up. If I’m missing a component, I go read about it on forums or on the internet.
You get very quick feedback with the quizes and homework. Quizzes ask you to apply the material you just learned to confirm understanding. Usually the structure is “Youtube video –> short quiz on video”.
Homework assignments present larger problems, to make sure you can put everything together on your own. The homework is graded but doesn’t count towards the final mark. Only the exam counts for the certificate.
Udacity’s Potential
This is a great time for online education. Khan Academy continues to be an incredible resource for all subject, math especially. MITX, Coursera all launched around the same time. Coursera has the most courses and MITX has the advantage of the MIT brand.
Udacity offers one thing that none of these competitors do: a starting point for beginners. Both Coursera and MITX are (currently) aimed at those who already have technical knowledge.
Newcomers to programming (like myself) can start with CS101. Once we finish, the 200 level classes are waiting for us. Currently they offer:
- Web Applications
- The Design of Computer Programs (With Peter Norvig)
- Programming Languages (an interpreter class)
And so on. Anyone who finishes the 200 level courses can take the 300 level courses, and probably some of the Coursera courses aimed at more advanced students.
We’ll have learned enough to make work on our own projects, and do research when we get stuck.
Not everyone who tries Udacity will come out a programmer. But now many more people have the opportunity to learn.
Daniel says
I love the idea of blogging to document your progress with Udacity. I’m currently going thru programming languages and we’re making finite state machines to process HTML and later javascript. The end goal is to have made an HTML5/javascript compatible web browser. Which I think is really cool and I’m hoping it will boost my knowledge to the point where I can start putting a lot of fun projects into action on the web. I crave making useful things for people and the web is the best place to provide those services. Keep up the good work sir!
Graeme says
I will be starting that soon. I just finished 30 days with no internet, one of my earlier posts explains why.
I decided to go back to the internet, chiefly because internet cafe bandwidth was worse than I thought, and made Udacity too slow. Glad the homework isn’t strictly on a deadline now. I’ve got a lot of catching up to do!
Asokan Pichai says
Assuming you are ..klm”interested in another idea for ROT13 implementation,
Create two strings called say ALPHA and BETA
ALPHA = “ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFIJKLM”
BETA = “abcdefghijklmnopqrstuvwxyzabcdefijklm”
if letter in ALPHA:
newletter = ALPHA(ord(letter)-ord(‘A’) + 13)
elif letter in BETA:
newletter = BETA(ord(letter)-ord(‘a’) + 13)
else:
newletter = letter
Hope this is useful
Graeme says
Oh, thanks. That was how first instinct for how to do it (I started with C), but I didn’t know about ord().
Marshall posted a good method (I think) in the reddit thread:
import string
def rot13(input):
chars = ‘ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz’
print string.translate(input, string.maketrans(chars, (chars[26:]+chars[:26]))
edit: I checked the run time. Yours is twice as fast as both mine and Marshall’s.
Steve Krenzel says
FYI, Python has built-in rot13 encoding. Here’s an example:
>>> “This is a message.”.encode(‘rot13’)
‘Guvf vf n zrffntr.’
If you did want to write your own implementation though, I’d recommend using maketrans and translate ( https://gist.github.com/ccda26ce1df4e72c1d53 ) :
>>> from string import ascii_lowercase, ascii_uppercase, maketrans, translate
>>> target = ascii_lowercase[13:] + ascii_lowercase[:13] + ascii_uppercase[13:] + ascii_uppercase[:13]
>>> tr = maketrans(ascii_lowercase + ascii_uppercase, target)
>>> translate(“This is a message”, tr)
‘Guvf vf n zrffntr’
Halex says
Here is another method i hacked:
def rot13(inp):
s=[]
for c in inp:
if c.isalpha():
beg=ord(‘A’)
if c.islower():
beg=ord(‘a’)
s.append(chr(beg+(ord(c)-beg+13)%26))
else:
s.append(c)
return ”.join(s)