Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

September, 2010

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Pretty Code


    Way back in the old days when programmers coded using simple text editors and command line editors there was a utility called Pretty Print (or some variation). These utilities would take text files as input and output code that was made more “pretty” and so easy to use. They would add consistent formatting of loops, comments, tab stops and space between keywords, variables and other elements of code. The results looked better when printed. One major benefit of all this is that reading code looking for bugs was a lot easier. I was reminded of this old utility when I read the post “You code like a girl!” which I included in my interesting links post.

    Modern IDEs like Visual Studio make consistent formatting much easier than the old text editors did. They even color code things for you so that the difference between reserved words and variable names jump out at you. The obvious effect of all this is that the formatting looks nicer to some definitions of nice. It’s largely superficial as the code would run just as well if the formatting was poor, spacing was inconsistent, and there were no color coding at all. The compiler ignores all of those things of course. And here we start the search for “inner beauty” of code.

    This is more complex a question. It also means that one has to be concerned about the difference between clever code and efficient code. Some are impressed by code that is difficult to understand but used as a means of impressing the reader rather than the compiler. Ternary operators and recursion sometimes run the risk of being incorrectly seen as beautiful when in reality they add unnecessary complexity. Though like so many things beauty can be in the eye of the beholder.

    I remember a recursive bit of code I once wrote that I just found elegant and cool. No one else in the group agreed with me and I had to rewrite it. It was clever (in my opinion) but it was also unnecessarily hard to understand. Is it really beautiful code of no one else can understand it? Isn’t that the modern art sort of question? But code has to be used, modified, expanded, and understood easily by everyone who views it. Art tends not to have those requirements.

    I’m not sure I have a good operational definition of beautiful code. Of course it is formatted nicely. Big deal! Highlight the code in Visual Studio and hit the Ctrl-e, Ctrl-f key sequence and everything will be lined up nicely for you if it is not already. For inner beauty I look for things like names that make sense without being obnoxiously wordy. I look for classes that properly handle public and private access and have clear methods for dealing with data. I look for methods that are not too long as to be hard to follow. I look for code that is as complex as necessary but no more complex. I look for comments that make things clear but don’t hide what is going on. I look for code that looks like it was designed and not patched together by adding semi-random code until things seem to work. I guess I sort of just know it when I see it.

    What do you think of as beautiful code? Does it exist in your world few or is it just the ravings of people who are just a little too much geek?

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Interesting Links 20 September 2010



    I’m happy to see that the Microsoft student website won the “Outstanding Website” award in the Education category from the Web Marketing Association. /Student as we call it is a very useful site for students to look for information about Microsoft tools, progucts, programs and special deals. And unlike a lot of corporate websites is not boring.

    The official Microsoft Twitter account send out a tweet @Microsoft -What does your school need? @Bing can help. New contest for students, parents, teachers called the  “Our School Needs” competition.

    Ryan Nutt (@RyanNutt) Tweeted a link to You code like a girl! which is an interesting look at both the differences between how boys and girls code and the idea of beautiful code in general. This is a topic I’d like to think and write more about in the near future. I’d love to read any comments any of you have on this topic and post.

    A new blog from the Microsoft Office team called Office in Education has started to help teachers and students get the most out of MS Office. Drop by and tell them what you want to see there.

    Dave Burkhart  has a nice post on the CSTA blog called Computer Science and Reading Literacy where he is looking for reading suggestions for compare science students. Helene Martin lists a bunch of books from teh SIGCSE mailing list in the comments. A good place to look for ideas and for you to add some of your own.

    Interested in game development? The new XNA Game Studio 4.0 is live! Lots of good stuff for developing for the Windows Phone 7 is included. Free download!

    A reminder from the Microsoft Tech Student Twitter account @MSTechStudent: Teaching Information technology in you school? Have you visited the Imagine Cup IT Challenge page?

    Some good news from the Kodu team this week.. First Consolarium in Scotland has posted 12 Kodu videos on YouTube for teachers getting started with Kodu:. They look great! Also Kodu was highlighted in a recent NY Time Magazine section- The 8-Year-Old Programmer Note that Kodu is a free download for PC,  as well as a $5 indie game on Xbox.

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    NCWIT Award for Aspirations in Computing 2010


    clip_image002 I really like this award program so I am happy to promote it on my blog. The following is from the official announcement. I strongly encourage you to share this opportunity with high school women and with teachers who may be able to suggest it to their students.

    The NCWIT Award for Aspirations in Computing honors young women at the high-school level for their computing-related achievements and interests. Awardees are selected for their computing and IT aptitude, leadership ability, academic history, and plans for post-secondary education. The NCWIT Award for Aspirations in Computing offers both national and local "affiliate" competitions to generate support and visibility for women's participation in communities nationwide.

    PLEASE help us spread the word about this competition with any K-12 or groups who serve young high school women!

    National Award-winners receive:

    • $500 in cash
    • a laptop computer, provided by Bank of America
    • a trip to attend the Bank of America Technology Showcase and Awards Ceremony in Charlotte, North Carolina
    • an engraved award for both the student and the student's school

    Affiliate Award-winners receive an engraved award for their home and school, and a range of great prizes from local sponsors. Visit Find a Competition to see details.

    Young women in grades 9-12 interested in computing and technology are STRONGLY encouraged to apply.

    Applications will be accepted until 11:59 pm Eastern Time on Friday, October 15, 2010. Check out the Preparing Your Application guide to learn more about the application process and information needed. Instructions are also available in Spanish! 

    Please let us know if you have any questions and thank you so much for helping us spread the word about this exciting competition and opportunity for our young women interested in technology!

    If you have any questions, please contact us at

Page 2 of 6 (18 items) 12345»