Thursday, June 30, 2016

Eclipse and Karel the Robot


The Eclipse IDE

One of the first things I did for the Stanford programming methodology course was to install the Java JDK and then the Eclipse IDE. This was my first experience with an IDE, a step up from Notepad++. While a later book I read encouraged avoiding IDEs and typing out code with no assistance, I found the automatic code completion and instant feedback for syntax errors helpful for beginning to learn Java. For the course, Stanford developed a customized version of Eclipse. This version made it possible for beginners to get started with some basic object-oriented programming ideas without having to start with something like the main() class.

I have since had experience with the Android Studio IDE, which seems quite similar to Eclipse, and have learned of a few others. In time I would like to try out Emacs, NetBeans and others.

Karel the Robot

The first few course assignments were to be written in Karel, a simple object-oriented language similar to Java. Karel is the name of a little robot that will follow programming commands as he moves through a grid. Karel has only four main functions:

  • move()
  • putBeeper()
  • pickBeeper()
  • turnLeft()

You are told what to have Karel do and then you must accomplish it using only those four functions. 

move() tells him to move forward one step. putBeeper() has him put down a marker in the grid and pickBeeper() has him pick a marker up. turnLeft() does what the name suggests. You may need to have him turn right but there is no turnRight() function. So you can have him turnLeft() three times, then you learn to write your own turnRight() function to use.

Karel the Robot was a fun introduction to programming. It teaches you to problem solve, using logic, and to begin to think in a object-oriented way. You can find the Karel the Robot Learns Java book here.



i++

Sunday, June 5, 2016

Stanford Programming Methodology (CS106A)

The Programming Methodology course is a part of Stanford University's Stanford Engineering Everywhere. Through this program, students and educators can access many of Stanford's courses online, free of charge. I was essentially able to audit this introductory, semester-long, computer science course for free. I watched the lectures, did the reading assignments and the programming assignments. I found it very interesting and learned a lot. You can find the course at https://see.stanford.edu/Course/CS106A. Here's some basic information about it.

Professor

The course was taught by Mehran Sahami. You can read his profile here. You can tell that Mehran enjoys teaching the course. I found his enthusiasm for the subject to be very engaging. He uses a lot of helpful illustrations for what could be complicated topics and even throws in some fun pop culture references that I could appreciate. Through his video lectures, I got a sense of what it would have been like had I pursued computer science in college.

Textbook

The course textbook is The Art and Science of Java by Eric Roberts. It is available for purchase and a free PDF version of an early draft is also available online. Just search for it and you should find it. I found the book to be informative and easy enough to follow. I even put up a quote from the book in my cube at work, his definition of software engineering - “the discipline of writing programs so that they can be understood and maintained by others”.

What's Covered

As one would expect from the course name, it provides an introduction to good programming methodology and uses Java as the language of choice to do this. It covers, among other things, Variables and Types; Expressions, Statements and Control Structures, Methods, Randomness and Events, Objects, Strings, Classes, Arrays and ArrayLists, HashMaps, Interactors, Collections, Debugging Strategies and Searching and Sorting.

Assignments included three games, Breakout, Hangman and Yahtzee; a data graphing program and a simple social networking program. I enjoyed working on these programs.Naturally it would be better to actually take the course and get feedback on your code but because so many people have taken the course, it's easy to find other people writing about the assignments online. I also created a Stack Overflow account and was able to get some help and feedback that way.

I do recommend the course to anyone looking for an introduction to programming in general and to Java in particular. I will get into some of the specific things I learned through this course in future posts.

i++