Semester end wrap up

Finals week starts from tomorrow and that means another semester has come to an end. I’ve done a number of interesting things this semester, and I think it would be a good idea to tie them together at the end.In many ways this semester has been a continuation of things I started earlier and a starting point for new things. I cna’t say that I wrapped up many things, but I don’t think that’s a bad thing. In fact it’s probably a sign that I have things to keep me busy and interested. So here goes with the end of semester wrap up:

1. My research work

Over the summer I started doing work with a professor on using formal grammars to understand pattern formation. Summer was very much a ‘testing-the-waters’ phase. We worked on two separate projects: automated urban design and auto-generated art in the hopes of being able to find some underlying rules for creating patterns. Though we produced some good work (and a number of good looking graphics), there was still a lot to be done. This semester we decided to drop the urban design aspect and instead refocus on a more basic topic: representing general patterns as grammar rules for artificial languages. To do this I’ve been working on building a simple language to describe languages and then generating samples of those languages, which can then be visually displayed. I hope to have a working version ready by the end of January. This project has been interesting because I got to learn a lot about language design and it was my first time writing a lage piece of software as part of a team. It also fit in very well with my programming languages course, speaking of which…

2. Programming Languages Course

I was supposed to take an algorithms course, but due to a scheduling conflict ended up taking a programming languages course as an independent study instead. I’ve always had an interest in programming languages and working with formal grammars over the summer furthered that interest. Taking the course gave me a chance to formally study about my interests and introduced me to a number of new and interesting ideas.  I learned about a number of new languages on the way, including ML, Prolog and Smalltalk. The course also helped to clarify some earlier ideas I had about what constituted good language design. I realized that syntax can be very impotant and that a lot of times appreciating the full power of a language involves a steep learning curve, but it can be well worth it. And this course led me to one of my best discoveries of the semester, namely…

3. Scala

I’ve liked the Java platform, but never had much love for the language. However, I recently discovered Scala, a really nice statically-typed, multiparadigm language. It feels a lot like Java, but is much cleaner. Its features of note include a good merging of object-oriented and functional paradigms, a clean way to reuse code without the problems of multiple inheritance, static typing and good interaction with existing Java code. I’ve started a series evaluating Scala as an alternative to Java. I’m planning on using more Scala next semester, so we’ll see how that goes.

4. Beginning my electrical and computer engineering major

I’m pursuing an electrical and computer engineering major at college and this semester was the first course in the sequence: a basic digital circuits course. I enjoyed this course, learned a lot and made some good friends. I like dealing with low level logic gates and pushing bits around as much as I do slinging functions all over the place. I’m taking the second course in the sequence next semester alongside a computer organization course. I’m looking forward to having another exciting semester coming up.

5. Web design work

I’ve been making websites for a good few years now, but I’ve only started takin it seriously this semester. I’ve started to design websites for a number of student groups on campus as well as preparing templates for ePortfolios for foreign language students at our college. I started using Dreamweaver and despite my normal scepticism for WYSIWYG tools, I quite enjoy using it and it beats manually managing links. Most of my work isn’t online yet, but it should be within the next few months  (once students start using it). This is certainly I’ll be pursuing and considering that I plan to move to paid hosting early next year, I might just end up making my own WordPress theme.

6. A new focus on blogging

I might have put this last on the list, but it’s certainly not the last thing on my mind. I’ve realized that if you’re doing things that are fun and interesting, there are probably a lot of people out there who would like to know about it. I think being able to communicate your work is as important as actually producing it. I’m looking forward to many more semesters of fruitful blogging ahead.

That basically wraps it up for things I’ve done this semester. There’s a bunch of things that I have planned for next year, but I think I’ll save that post until the start of next year.

Advertisements

Last call to change feeds

This is the last call to change feeds. Please redirect your feedreader to

http://feeds.feedburner.com/bytebaker

I’ll be shutting down other feeds for this blog in a few hours. If you find yourself not getting new posts for a few days, that probably means you’re still subscribed to the old feeds. Once again. sorry for the inconvenience.

Variables are not boxes

One of the common metaphors taught in intro computer science courses is that a variable is a similar to a box. Just as you can use a box to store something, you can use a variable to store a value. This metaphor is useful for introducing the concept of variables, but it is a very flawed metaphor. What makes it particularly bad is that holding onto this metaphor can be limiting when a student starts to go even slightly beyond the beginner stage.

In the good old days of down-to-the-hardware procedural programming, a variable really was a box: it was in essence a memory location. The fact is, those days are mostly beyond us, unless you use C/C++ or Assembler as your main programming language.  In fact, it is much more likely that you are using some sort of object-oriented language as your main language. With object orientation, the box metaphor doesn’t work. Why? Because of references.

With an object-oriented language, a variable is actually a reference. The object that you seem to be storing in a variable doesn’t actually get put into your variable box. The variable just ‘refers’ to the object. You can get to it through the variable, but it isn’t stored there. Consider the following (in Python):

foo = SomeClass()
bar = foo

Thinking of variables as boxes leads to confusion: how do you put one thing into two different boxes? Or does it just get magically duplicated? Add to that the fact that you’ll see that whatever you do to foo also gets done to bar.

A far more appropriate metaphor in this case is to think of foo and bar as names for the new SomeClass object. The new object is created and you choose to use it by the name foo. But then you decide also want to call it bar. How do you that? Well the only way to get it is through the name foo. Thus ‘bar = foo’ says ‘find whatever object has the name foo and then give it the name bar as well’. After that, giving either bar or foo another value, means that something else has the name foo or bar.

Though this metaphor does seem like a better one, it’s important to realize that the metaphor is deeply involved with the concepts of object orientation and doesn’t work perfectly. Consider the following:

foo = 1
bar = foo
bar += 1

The box metaphor fails because even though integers in Python are objects, bar and foo won’t refer to the same object. When dealing with simple integers like this, it’s actually the box metaphor that works. bar = foo copies whatever was in box foo and puts it in box bar.

So the question is what are variables? I would argue that the correct metaphor is context-sensitive. If you’re in a object-oriented environment, thinking of them as just names for independent objects will make your life much easier (and help prevent bugs arising from incorrect use of reference properties). But when you’re doing simple number crunching, the box does the job. But before you pick the metaphor you use, invest some time in learning about your language/framework and what metaphor suits is best.

Metaphors in computer science

Thanks to Slashdot I came across the transcription of a very interesting lecture given by Edsgar Dijkstra, one of the most important computer scientists before the age of the personal computer. The lecture is interesting and a worthwhile read for anyone into computers, especially computer science education. Though there are some parts that I don’t quite agree with, one thing that struck be as being every important is the Dijkstra’s realization that computer science comes with a vast array of metaphors to help beginners and experts alike think about what it is that they are doing. Dijkstra claims that these metaphors are misguided and are very damaging to the profession.

That may very well be the case, certainly some metaphors are questionable at best. But what’s of greater concern in my opinion is that most programmers I know don’t bother to really understand the metaphors and dig under the surface of the explanations that instructors present them with. It’s fine to use a metaphor to help you think (even if that metaphor is inaccurate) as long as you know what the metaphor means, where it comes from, and how things work without the metaphor to give a simplifying abstraction.

Metaphors are just that: abstractions. They let you think about things at a higher level without being bogged down by what the actual details are. However metaphors can be problematic because they describe something unfamiliar in terms of something familiar that may actually be very different. Problems start to spring up when you expect the unfamiliar object to behave like the familiar one. Abstractions in computer science (functions, objects, interfaces etc) can be safe because you can define precisely what the abstraction’s properties are. But unless a metaphor is very carefully crafted it can easily become a leaky abstraction: one where the boundaries are undefined and weird things can happen as you approach the edges.

Take for example the desktop metaphor. It’s useful because the way windows are placed on a screen can be thought of as similar to placing papers on a desk. Files and folders also fall in rather conveniently with this idea. But what about applications? What is an application icon supposed to mean? How do you explain dragging a file onto an application’s icon to open it? This isn’t to say the desktop metaphor is bad, it’s just that it can be confusing if you interpret it literally. Some other common metaphors are:

  • A variable is a box
  • Porsche is a class and your car is an object
  • A compiler is a translator

Each of these has it’s pros and cons and some are better than others. I’ll be looking at some of these metaphors in future posts and seeing if there are ways in which they can be improved.

How to consolidate your online presence

In the last post I looked at what an online presence and why it’s important. Your online presence is a two-way street, it’s what others see of you and how you interact on the web. Here are some tips to get your online presence under control.

Google Scrubbing

Google is quickly becoming the world’s homepage. If anyone who doesn’t know you wants to look for you, then chances are the first thing they will do is type your name into Google’s search box. So the question is, what are they going to see? Hopefully you’ve been smart enough not to leak your personal life onto the internet. But even if everything that a Google search reveals are things you wouldn’t mind people seeing, they might be very random and chances are they won’t give the full picture about you. So it’s up to you to make sure that Google does present the real you. How do you go about it? Well, that’s what the next section is about

Get a domain name

Domain names can be had for under $10 a year and there are lots of free hosting options. Having a domain name lets you carve out a part of the Internet and brand it with your own signature style. Trying to get a meaningful domain name that you can keep around for a long time and which you won’t mind telling lots of other people about.

Once you have a domain name, put it to use by building a good website around it. Put up normal things like a resume, but also put up PDFs of articles or papers you’ve written and link to your other work online. If you write blogs (one or many) consider turning them into subdomains of your website. This way there is a central location for your work on the web. Unless of course, you specifically want your blogging life to remain separate.

Consolidate your email

Another great reason to get a domain name is so that you can have email addresses attached to it. Having an email address attached to a domain name means that you don’t have to change it whenever you change jobs or schools and it looks more professional than a free email address. I would recommend having multiple email addresses for each domainL one for business, one for friends and family, one for mailing lists, one for free subscriptions etc. This way if you start getting spammed you can find out where it’s coming from and take measures.

Of course having a separate inbox for each email address would be very unproductive. I strongly recommend using the free Google Apps for your Domain and then using the Gmail app to alias multiple addresses to the same inbox. Then you set up filters to appropriately label, hide or delete emails sent to the various emails. Look at the first chapter of Upgrade Your Life for more useful email tricks.

Get your nicknames under control

Chances are you have multiple nicknames for different forums, IRC and IM. It might be a good idea to stick to a uniform set of nicknames so that people can find you. However, depending on whether or not you want to actually want to be known or if the nicknames are available, this might not be an option.

If you have any advice on how to get your online life under control, please drop me a note in the comments.