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

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Readability in Programming Languages

    • 37 Comments

    I saw a side by side comparison of a bunch of scripting languages online recently. Scripting Languages: PHP, Perl, Python, Ruby My first, and second reaction was yuck! Now I have my biases – biases which may  not be shared by others of course. But I like readable code and for me anytime I see a special character (anything not an alphanumeric) it slows me down. This got me thinking about where we are going in design of programming languages? Are we moving forward (what ever that means) or backwards or just sideways?

    Back when I started programming close to 40 years ago the big three programming languages were FORTRAN and COBOL with an up an coming language called BASIC. FORTRAN (short for FORmula TRANSlation) was used by mathematicians (my math major brother had to learn it) and scientists. COBOL (the B stands for Business) was used for business applications. BASIC was a teaching/Learning language that was spreading into business. COBOL was both loved and hated by different people for its wordiness. But it was at least understandable. Take the loop below:

    PERFORM VARYING WS-BOTTLE-NUM FROM 98 BY -1
                   UNTIL WS-BOTTLE-NUM < 2
    END-PERFORM

    Pretty close to an English sentence. Compare that to this sample for a C-style language (C#)

    for (WSBOTTLENUM = 98; WSBOTTLENUM >= 2; WSBOTTLENUM--)
    {
    }

    Which one is more obvious? Pretend you are not an experienced programmer.

    BASIC (Visual Basic in this case) is somewhere in the middle.

    For WSBOTTLENUM = 98 To 1 Step -1
     
    Next

    The step – the counting down – is more easily understandable for me at least. Now let’s take a look at something very simple. k = i / 10;

    This drives beginners crazy. What’s going on here? Sure we programmers know but a lot of beginners struggle with which direction the operation is going. Compare that to the same code in COBOL

    divide i by 10 giving k

    Wordy? Sure, but at least even a beginner can read it. Now I am not arguing that we should all go back to COBOL though honestly with modern IDEs and features like Intellisence it would be a lot easier than it was back when I was typing out punch cards. Rather I am suggesting that beginner languages can and probably should be more wordy rather than more obscure – that English is easier to pick up than “what does # in this programming language mean?”

    Just for fun, if you want to see what different programming languages really look like visit the 99 Bottles of Beer site.

    This Website holds a collection of the Song 99 Bottles of Beer programmed in different programming languages. Actually the song is represented in 1434 different programming languages and variations.

    Somewhat related posts:


  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Are You Applying for the 2012 US Forum?

    • 1 Comments

    image

    Last summer I attended the US Innovative Education Forum in Redmond and came home quite inspired by the teachers and projects I saw. Dozens of teachers using technology to improve the quality and quantity of learning with their students. Microsoft Partners in Learning is now looking for this year’s crop of interesting, inspiring and innovative teachers and projects to attend the 2012 US Forum  in Redmond, this summer. I’ve copied some of the information about this event below but I hope you will check out the 2012 US Forum  page for yourself to learn about this wonderful opportunity for teachers. At the bottom of this post as links to some of my blog posts from this past summer’s event as well as some posts by teachers who attended it. Please read what some of these amazing teachers had to say about their experiences. And if you are doing interesting things with technology give some thought to applying. (BTW computer science teachers have been some of the top award winners recently.)

    Showcase and celebrate innovative teaching

    Show us how you engage students in problem-solving, inspire their creativity, and prepare them for life ahead. You could be selected to attend the forum in Redmond, Washington, July 31 – August 1. Winners there will proceed to the Worldwide 2012 Global Forum in Athens, Greece.

    There is an extra opportunity for computer science, graphic design or technology educators who are selected – an Xbox/Kinect system.

    Computer science, graphic design, and technology educators: You might win an Xbox 360 and Kinect for your school.
    Here’s how:

    • Computer science, graphic design, or technology educators who are selected to participate in the forum are eligible to win an Xbox 360 and Kinect for their school.
    • When you apply online to the Forum, be sure to select which Microsoft web design or software development tools are used in your project.
    • Educators eligible to win the Xbox 360 and Kinect must submit a gifting letter.

    Who can apply?

    • K-12 educators or teams of two educators who lead class projects that use technology to positively impact student learning
    • School leaders who direct programs and initiatives that use technology to enhance education throughout the school community

    Related posts:

    By teachers

    By me:



  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Languages That Make You Think

    • 6 Comments

    The old joke used to be that “a good FORTRAN programmer can write a good FORTRAN program in any programming language.” The problem and what makes the joke not all that funny is that it involves not taking full advantage of the language in question. It is not a FORTRAN specific problem by any means. I have known many so called C++ programmers who really wrote C programs using a C++ compiler. Many programming languages are designed with an idea towards changing the way programs are written, problems are solved and how people think about problem solving.  Taking on a new programming language without  changing ones thinking is often a missed opportunity, at best, and a cause of serious problems at worst. I recently came across two posts inspired by one of  Alan Perlis's epigrams: "A language that doesn't affect the way you think about programming is not worth knowing." This comes after the same issue from a slightly different point of view.

    To some extent programming languages are idiomatic. That is to saw that there are particular ways that the language should be used. While it may be possible to use it the same or similar ways to other languages, the FORTRAN program in any language way, that is not the best most efficient way to use it. To get the most out of a language you have to think a little differently. A lot of languages are pretty similar – Java and C# for example. But there are still differences. Most obviously those differences involve libraries but there are subtle differences in the languages themselves. For example Java and put and set methods which are a little different from properties which are a different form of get and set.. The thinking involved is a little bit different.

    Other languages are very different. Scheme and F# are two examples of functional languages which are a completely different paradigm from languages like Java and C#. You’d really run into trouble trying to write FORTRAN programs using one of them.

    Visual languages like Scratch, Alice and Kodu are different (from each other and from other more traditional languages) in still more ways. I think we often focus on simple concepts, like loops, that feel the same but miss out on different ways of thinking about things like subroutines and methods. Kodu for example uses pages in much the way that subroutines are used in other languages. They have a a different sort of feel to me though. There isn’t a traditional return statement for example. This changes things. It means that leaving a subroutine doesn’t automatically go back to where it was called from. I’m still thinking about how best to take advantage of that. I am finding that Kodu is changing the way I think about programming. This is a surprise to me but in a good way.

    At the high school level there is a tendency to stick with one programming paradigm and even often a single programming language. I wonder it that is too narrow a way to teach programming. Younger students seem to adapt to different languages and paradigms faster then older students – much faster than their teachers all too often.  There isn’t a lot of room in the curriculum at most high schools to cover multiple paradigms in a single course. Over a couple of courses a school might cover a couple of languages perhaps. I recommend at least two and would prefer three. Mostly people tend to concentrate on the similarities between languages rather than the differences. There are advantages to this. The disadvantages are less clear though but I am starting to think that there is some value in talking about the differences. A good education widens ones horizons rather than focusing too narrowly. Something to think about. You know, while we are talking about making people think. Smile

    The blog posts that inspired this post are both well worth a good read.



Page 4 of 618 (1,853 items) «23456»