Daniel Forhan
Computer Science Teacher and Java Programmer

Using Video Games to Teach Programming

As a programming teacher one of the things that often comes to mind is; how can I teach programming in a way that is interesting and dynamic? Very recently I came up with a plan that I hope will address this idea. My plan is to add a new and exciting programming course called "Game Development and Programming with XNA" to our course offerings.

Coincidentally this morning I came across an interesting article in the Science Daily that really connects with many of the thoughts I have had related to this kind of approach to teaching programming. The article discusses how teaching rapid video game development can strengthen critical thinking skills an improve overall participation.  The article also discusses how using video game development can and bolster students' interest in computer science and help to bridge the digital dived. I quote, "...using rapid computer game creation as an innovative teaching method could ultimately help bridge the digital divide between those people lacking computer skills and access and those with them."

I am very excited to offer a video game development course to my students next year. This approach appears to hold much promise. Stay tuned for updates.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

I'm back with Big News!!!

As you can tell by the gap in the posting dates it has been a while since I last posted on this blog. With all that has been happening in my personal as well as professional life, blogging has taken a back seat. Many things have happened since I last posted. I won't enumerate them, but let's just say life has been exciting to say the least. One of the more exciting events in my life been the appointment to a new position at Algonquin RegionHigh School as a Programming & Math Teacher.  As great as that has been it is not the big news that I referenced in this article title.

Algonquin, like many high schools in the U.S. has a computer programming team that competes against other high schools in regional competitions-- typically sponsored by local colleges. I am fortunate to be the coach of this team. The big news?...

On December 11th our Programming Team participated in a contest sponsored by Fitchburg State College and did exceptionally well. Our school took 1st, 2nd and 5th place.  Although this may have happened before, I have never personally witnessed a team in this type of event accomplish this feat (taking first and second place). This is very difficult to accomplish given the level of challenge we faced.  There were 27 teams that participated from at least 14 different schools in MA, RI and CT representing some of the most talented young programmers in New England.  Way to go team!!! 

I am very proud of you!!!

Results:

Team 2- First Place

Matteen, Sooyong, Ofir, Alekhya

Team 1- Second Place

Ben, Taylor, Ehsan, Vijay

Team 3- Fifth Place


Ian, Wilfred, Nick, Arjun



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Hunt for the Wombat

Very often as us AP Computer Teacher's approach exam time we start to think of interesting activities that our students can do the weeks that follow the exam. I was fortunate enough to come across a real nice project that was developed by a teacher and his former student who is now an employee at Microsoft. The project is called “Hunt for the Wombat”. Alfred Thompson does a great job describing this project on his blog (link). Thank you for that Alfred.

I thought that to promote this I would do a little covert advertising around the school and in my classroom. What I did was printed out some color copies of the Wombat and put them up in my classroom without telling my students what they are. All I am telling them is “you will see what this is all about after the exam”. I am hoping to build their interest a little by creating some anticipation. I have to be honest, I am getting pretty excited about this project myself and  can't wait to introduce this to my students.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Great Idea For a Computer Science Education Day

Brian Scarbeau has a great idea posted on his blog to promote Computer Science Education.

Check it out. I'm in!!! 



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Professional Development in Phoenix, Arizona

A couple a of days ago I attended a conference in Arizona that was hosted by a new (to me anyway) and exciting company called 21st-Century Learning. This was a very exciting trip for me as I had a chance to see demonstrations of some very interesting ways to introduce lessons into to the classroom. The main focus of what this company does is deliver live web presentations to schools using a software program called “breeze”. The presentation might be a professional development session for teachers, or a special speaker that talks to students. They have what is called “passports”. These passports are very cool. The nice thing about them is that it is kind of like a field trip, only students don’t have to leave the building. They usually have speakers that are experts in their field (i.e. Astronomy, Medicine, Geology), and the person speaking is visible via live streaming video. Theer are also supplemental resources that are presented by the speaker (such as streaming video/audio). I was very impressed with the demonstrations.

 

This company also provides professional development for teachers. Our school has been using this service for a few months now. Our teachers are involved with a series called differentiated learning. Just like the passport series, the presentations are live, and involve multiple schools.

 

What really topped it all off was the wonderful weather. I also had a chance to see a lot of professional athletes that were part of the World Baseball Classic (roster). Many of them were staying in the same hotel as me. Very exciting! As luck would have it the American team was eating dinner right across the hall from our group so we had a chance to see most of the players. The next morning I nearly dropped my coffee as I was walking through the hotel lobby when Roger Clemens walked past me.

 

The people from 21st-Century Learning gave us a chance to do a little sports as well in between the the wonderful presentations. Another highlight of my trip was that I was selected from one of there drawings to take a chance to win money in on “the putting green” . Well, I have to tell you it has been a while since I played golf last, but I managed to sink the put for $50!  

 

All-in-all the trip was great!



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Programming Contest at Providence College

On Monday some of my AP Computer Science students had a chance to participate in the annual programming contest at Providence College. This the 21st year that PC has hosted this event. The contest was a fantastic 

experience for my students. They had a chance to compete against students from all over New England. It was very challenging. Most of the problems were fairly tough, but fair. I don't know how they come with so many cleaver new problems each year.  Anyway, we didn't win this year, however our team placed in the top ten out of a field of 23 schools. Nice effort guys!!!



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

What is a "brrreeeport" ?

Here is something kind of cool I came across on Brian Scarbeau's blog today. Looks like fun. To find out what this is all about go here.

 



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Exception handling

This week, in addition to re-visiting the Marine Biology Case Study,  our class wrapped up the unit on exception handling. My students seemed to get a good handle on this topic and it went much smoother than other units we have covered. We did also get into the idea of writing our own exception classes (that extend the Java Exception class) and how we might design them. Then we discussed the benefits of exception handling, and various approaches to handling “tricky code”.

As a side note, I came across a nice article by Heinz Kabutz that couldn't have been timed better. It has an interesting take on exception handling.  He talks about managing exceptions from constructors. Normally I don't  refer my students to his articles as they are usually considered expert-level discussion, but I think this one they handled fine (without exception).



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

MBS Simulation-Inheritance

Today our AP Computer Science class will be doing the Marine Biology role play exercise. Many AP teachers, like Brian Scarbeau  use this to help students visualize the role of objects in the MBS classes, and how they relate to one another. Earlier this school year we did a version of the role play that simulated fish in an environment. This week will are doing the version that uses specialized fish (i.e. Darter, and Slow fish) which helps to reinforce the OOP concept of inheritance.  The Marine Biology case study can be overwhelming for students because of its complexity, so these role plays really help them (particularly the visual learners), get a handle on the basic mechanics of the case study. I have also used this exercise as an opportunity to discuss design issues. I will have student discuss what think about the class structure of the MBS and decide if perhaps there are other ways one could engineer this project. This makes for good dialog with the class and really invokes critical thinking. Give it a try if you have an opportunity to incorporate the role play into your curriculum.

 

MBS



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Linux Lab fun

The most recent adventure my computer club has embarked on is the development of a new Linux lab. So far they have installed about five different Linux distributions on various computers on the computer club lab. Their goal was to further developer their networking/TCP/IP skills and at the same time see how different versions of  Linux perform in parallel in a network. Really they are trying to see what version can perform the best on a computer system with limited resources (i.e. cpu speed, memory).  The server computer is a AMD Athlon 64 box that they built themselves from spare parts. The server software they are using is Windows Server 2003, Enterprise version.

 It has been real exciting to watch them set it all up. They all came in on a Saturday morning (how's that for dedication) to accomplish that. I must confess they have taught me a few things.

Now that everything is set up our goal is to use that lab for various networking experiments. They students are also considering using the lab to set up a programming competition simulations to help prepare for future competitions. By the way our next programming competition will be be at Providence College on March 6th. That event is always an exciting one. I have a real talented group of students this year, I think we will do well.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Be careful what examples you give your students

Yesterday I sent my students an e-mail link that I came across, of what I thought was an interesting little program that might make for a good project once the AP students took the exam. Well let me say that I wish that I had waited, because many of the students got hooked on the example program. Take a look. See if you can last for 2 minutes in the game. (btw-there is a claim that comes with the game that fighter pilots must last two minutes with this game -I can't verify that though). 

 If you have time try to code it in Java.  I think it would be much easier to write the game than to play for 2 minutes.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Arrays: Copy vs. Clone

Occasionally when working with an array is may be useful to make a copy of that array. What might not be apparent is that by making a copy of an an array there are implications that can cause unintended side-effects if one isn’t aware of what actually happens when a simple copy the array is made.

 

For instance let’s consider:

 

         int [] numbers = { 2, 3, 4, 5};

         int [] numbersCopy = numbers;

 

The “numbersCopy” array now contains the same values, but more importantly the array object itself points to the same object reference as the “numbers” array.

So if I were to do something like:

 

          numbersCopy[2] = 0;

         

 What would be the output for the following statements?

 

          System.out.println(numbers[2]);

          System.out.println(numbersCopy[2]);

 

Considering both arrays point to the same reference we would get:

0

0

for an output.

 

But what if we want to make a distinct copy of the first array with its own reference? Well in that case we would want to clone the array. In doing so each array will now have its own object reference. Let’s see how that will work.

         

          int [] numbers = { 2, 3, 4, 5};

          int [] numbersClone = (int[])numbers.clone();

 

The “numbersClone” array now contains the same values, but in this case the array object itself points a different reference than the “numbers” array.

So if I were to do something like:

         

          numbersClone[2] = 0;

 

What would be the output now for the following statements?

 

          System.out.println(numbers[2]);

          System.out.println(numbersClone[2]);

 

You guessed it:

4

0

 

I spent some time going over this with my class but was not satisfied that we nailed this concept down very well, so I created a simple application using J# (that my student can eventually build) that I think may help illustrate this point further. It dives a little deeper into the basic mechanics of the Java Code with respect to copying or cloning arrays. So here it is. Give a try and see if it helps you draw conclusions about this topic.

 

I started with a simple Windows application as I did in my previous post. This example uses Strings but you could have also coded it for other types.

 

 

 The idea is to compare the hash code that is generated for each array object, and compare those values.  If the hash code values are the same then we can say that the two arrays point to the same object reference.  What is interesting about this program is what it illustrates when you continue to click the “Clone Array” button and then the “Hash Code” button that corresponds to it. Compare that with what happens when you make copies of the array, and check the hash code. You can download the whole program here.

 



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Java Puzzle

Today four of my students are competing in a programming contest at Fitchburg State College (MA). Since I cannot interact with them during the competition I have had a little time to catch up on some of the blogs/newsletters that I enjoy reading (and update my blog). One thing I came across this morning was a neat Java puzzle from one of my favorite Java sources, the The Java Specialists' Newsletter . This probably falls under the expert category. The result is a little surpising, and interesting to say the least. Here it is. See if you can predict the output. (assume each class is in a separate file). Have fun.

package com.cretesoft.tjsn.issue117;


public class Greeter {
  public void hello() {
    System.out.println("Hello from Greeter");
  }
}
  
package com.cretesoft.tjsn.issue117;

public class Exec {
  public static void run(Greeter target) {
    System.out.println();

    System.out.print("method call> ");
    target.hello();

    System.out.print("base class > ");
    run(target, Greeter.class, "hello");

    System.out.print("obj class  > ");
    run(target, target.getClass(), "hello");
  }

  // this calls the method using reflection

  static void run(Greeter target, Class cls, String method) {
    try {
      cls.getMethod(method, null).invoke(target, null);
    } catch (Exception x) {
      System.out.println(x);
    }
  }
}
  
package com.cretesoft.tjsn.issue117;


public class InsideJob {
  public static void run() {
    Exec.run(new Greeter() {
      public void hello() {
        System.out.println("Hello from InsideJob");
      }
    });
  }
}
  
import com.cretesoft.tjsn.issue117.*;

public class Main {
  public static void main(String[] args) {
    InsideJob.run();
    Exec.run(new Greeter() {
      public void hello() {
        System.out.println("Hello from Main");
      }
    });
  }
}
  

This material from The Java(tm) Specialists' Newsletter by Maximum Solutions (South Africa). Please contact Maximum Solutions for more information.

Try on paper before you compile. Did you get it?

More detailed discussion can be found here.

 



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Working with Arrays

 This past week we have been studying arrays and ArrayLists in my AP class. It didn’t take long for students to become excited about using them once they saw how valuable of a tool they are. One of the issues I try get across with them is how arrays/ArrayLists are a key part to use of sorting/searching algorithms. Since sorting and searching doesn’t come up officially until later in the course I take this opportunity to discuss it a little with them now saving the in-depth discussion on various sorting algorithms for later.

Although I don’t get into the actual algorithms right now, I do show them how they can use existing methods to do a sort using arrays. It also seemed like a good opportunity to show how easy it is to build an application using J#. So this lesson accomplished two major things; It familiarized them with the benefit of using arrays, and gave them some exposure to a nice programming tool (J#). So here is the example.

Let's start with the set up of J#. We used the express version.

Go to file-> new Project-> windows Application.


Once the application files are created we can now build a simple application that will sort the values that are entered to it.

In my example we added a text-box for entering the values, a text-box for displaying the sorted values and button to trigger the sort. Most of the action occurs in the SortButton_Click method of our Form class (Form1). The easiest way to get to that method is to double click on the button in the “design mode” and that will take you to the method automatically (see code example below).

The code example below illustrates how the sorting was done. Keeping in mind that we are just using the sort method to illustrate the benefit of arrays, not to learn how sorting algorithms work (at least not yet). This example also illustrates how one can use the StringTokenizer class to break down a string. Note: This method requires as few extra imports (java.util.Arrays, and java.util.StringTokenizer).

private void SortButton_Click(Object sender, System.EventArgs e)

{

     answerBox.Clear(); //reset in case text already there

     String values = numberTextBox.get_Text(); //get string


     //class that allows one to break down a string.

     StringTokenizer tokens = new StringTokenizer(values);

     int size = tokens.countTokens(); //to get token count

     double[] doubleNums = new double[size];

     int tokenCount = 0;


     //grabs each token, parses to double and stores in array.

     while (tokens.hasMoreTokens())

    {

     doubleNums[tokenCount] = Double.parseDouble(tokens.nextToken());

     tokenCount++;

     }


     Arrays.sort(doubleNums); //sort array

     //Display array elements in text box

     for (int x = 0; x < doubleNums.length; x++)

     {

     if (x < doubleNums.length-1)

     answerBox.AppendText(doubleNums[x]+ ", ");

     else

     answerBox.AppendText(doubleNums[x]+ "");

     }

}


private void button1_Click(Object sender, System.EventArgs e)

   {

     System.exit(0); //Exits application

   }


}//end of class

The students in my class seemed to really like the simplicity of using J# and were anxious to try it out. I gave them a few simple programs to practice using J# for their weekend homework. Who says homework has to be boring.

You can download the whole program here if you wish



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

LINQ

There is an awesome article about LINQ on Azam Sharp's blog today, http://geekswithblogs.net/AzamSharp/archive/2005/11/05/59201.aspx

The Microsoft Faculty Advisory team had a nice opportunity to hear about this from Anders Hejlsberg at our meeting in Redmond. Chanel 9 also has a nice interview with him as well where he talks about some of the exciting features of LINQ.  I am really excited about this new programming tool. I hope to now download it an see what I can do with it.  Once I get it running on my system perhaps I can introduce it to my students. 



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Apple's and Banana's

By now you are thinking, what the heck is a title like this doing on a computer science teachers blog?  Now that I have official entered the blog world and started dumping my thoughts/opinions into cyberspace I have also started reading many blogs that other people are writing as well. One thing I have noticed is that in many respects blogs have become an extension of the office “water cooler“, and other respects they are more like a intellectual symposium . Either case may very well have some value.  

The thing about blogs is you can encounter discussion about anything imaginable. The possibilities for blog topics/formats are practically without bounds. So what's with today's title? This past week in the course of reading one of the many blogs I now subscribe to I would occasionally encounter comments that were so bizarre that even your best guest would probably not be what the person may have been thinking when she or he posted it. So I thought to myself,  I could have posted back “apples and banana's” and it would have been equally coherent. Fortunately most of the articles I have encountered this past week were enriching and worth my time.  Just the same, this whole idea got me thinking about the value of blogging in general and forced the question- is blogging a worthwhile endeavor?

Many of you will right away react to this by saying to yourself, of course it is. Others may feel that blogging is a waste of time. My personal opinion is that blogging, when done well can be a very positive thing, and that overall bogging  is a positive phenomena. The down side of it is, how do we filter out the garbage and focus on reading blogs that offer something that is worth the time we spend reading it? And I am not sure I have a solid answer for this. It seems to me that blogs sites like geekswithblogs can help remedy that by giving the blog surfer a filter to guide them to the general type of content they are looking to read. 

The net effect of blogging for me has been a very positive one so far. Not only have I enjoyed articulating ideas, but have expanded my horizons by reading ideas posted by other computer science teachers, and professionals. As a new member of the Technology Committee for my school district I am going to recommend that we start encouraging teachers to start blogs for their classes as a means of communicating ideas to students and parents. It could be as simple as posting homework assignments, or be a little more involved. The wonderful thing about it is that blogging is so easy to do. Teacher may find it overwhelming if asked to build a Website, but if asked to build a blog, they can accomplished that in a matter of minutes.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Microsoft In the news

I came across an interesting article today about Microsoft. I would be curious to hear peoples opinions on it. Looks like this could be an exciting opportunity for Microsoft's customers.

 Microsoft Acquires FolderShare, a File-Synchronization Technology Provider.

 



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Method overloading, is this.good(idea) ?

The short answer is yes, but…

The ability to overload is one the many powerful tools built in to the Java Language (as well as many other programming languages). Like many of the powerful tools in the Java language that we use to program there are often complexities that get in the way of proper use. I hope to describe some of them here.  There can be certain stumbling blocks/pitfalls that my students will encounter when using this technique. I hope to clarify some confusion with this matter with my example today. First let’s see if we start by understanding what overloading is, and then look at some code examples:

 

So what is method overloading? It is really just a fancy way of saying that you can define two or more different methods with the same name. What differs with each respective implementation is what we call the method signature. The method signature is the type, order, or number of parameters. Changing the return type alone does not constitute overloading.

 

A classic example of method overloading is the “println” method of the System class. There are actually 10 different versions of that method defined in the Java language. When you think about how one might call println you start to realize that we often provide different parameters to that method. Sometimes a number such as an int, double, or float, and sometimes a string, or a character or even character array. That method doesn’t just work magically for all those cases. There has to be an implementation for each case, or overloaded version.

 

It starts to become clear why this technique is beneficial when you think about the alternative. Without overloading you would need a different method name for each case of println instead of just remembering one. So from a design point of view it allows us to produce more elegant code.

 

Now let’s look at some potential pitfalls. One of the mistakes my students when asked to give examples of method overloading is they simply change the return type. Technically the return type is not part of the method signature. For instance,

 

public int getBalance() and  

public double getBalance()

In this example both methods have the same number of parameters (none), so the second is not overloaded.

Or..

public static void setBalance(int value) and 

public int setBalance(int value)

Same idea here, all that has changed is the return type.

 

We can fix the second example to provide an actual example of overloading as follows:

public void setBalance(int value) and

public void setBalance(double value)

 

In the last example the methods have different parameter types, so we can say that they are overloaded.

 

Constructors can also be overloaded just like any method. In the example I am using today I will use constructors. We will see that is very easy to create ambiguity in our code when we start overloading methods.

We can easily fall into a trap. Consider the following example:

 

class OverLoad {

 

   public OverLoad ( int a, int b) {

 

      System.out.println("int, int version");

   }

 

  public OverLoad ( double a, double b) {

 

    System.out.println("double, double version");

      

  }

 

}//end of OverLoad class

 

public class OverLoadTester {

 

   public static void main (String [] ol) {

           

              int intNum1= 5, intNum2 = 10;

              double dNum1 = 5.0, dNum2 = 10.0;

 

      OverLoad one = new OverLoad(intNum1, intNum2);

                                                       //(int,int) Constructor

     

      OverLoad two = new OverLoad(dNum1, dNum2);

                                                  //(double, double) Constructor 

 

      OverLoad three = new OverLoad(intNum1, dNum1);

                                                    // What about here?

 

      OverLoad four = new OverLoad(dNum1, intNum1);

                                                     //or here? 

   } 

}//end of class

 

output:

int, int version
double, double version
double, double version
double, double version

 

The compiler knows which constructor to call by matching up the parameters with the correct method. However in certain cases the compiler will need to assume your intention and that might not be correct.  These last two examples illustrate that point. What if the user of the class accidentally entered a double when an int was indented (or visa versa)? The program will still execute but the wrong constructor may get called. This class is designed poorly for that reason. It presents itself with the potential for ambiguity. So the point is to be cautious about creating such scenarios.

 

I have found that students often confuse method overriding (which is taking an existing method and providing new implementation) with overloading. Soon I will post some thoughts on that topic and compare the two techniques.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Networking 101 -the Student way

Yesterday after school a few students from my AP class came by for our weekly computer club meeting. At this meeting they took a computer system, which was an amalgam of spare parts, and installed Ubuntu ( a user-friendly open source Linux shell) with the intent on building a Web server for our school. They then installed Apache, MySQL, and a PHP web interface for remote access to our Web server. The whole experiment went great. We did have to call the cable company to get port 80 forwarded to or domain (from our cablem modem/router), but other than that it went off without a hitch.

 Our headmaster loves the idea of what we are doing, and may let us buy a new server for this now that we have “proof of product”. We hope to do the scale up by purchasing a Dell Xeon server. Our ultimate goal is to install Windows server 2003, and set up an exchange server so that our school community can take full advantage of the wonderful resources Microsoft has to offer through our MSDN subscription. We also hope to eventually set up subdomians for teacher's to host their Web sites like many colleges do. Another aside, AP student Brendan (TCP/IP guru) has found a nice blog utility that we will use to set up blogs for every teacher in the school using our Web server. Once everything is online I will post the URL.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

What's with the Modifiers?

Each year that I have taught Java or AP Computer Science I have found my that students tend to get confused with the proper use of modifiers when designing classes. Partly from a misunderstanding of what the modifiers mean, and partly because they haven't really developed a strong conception what the whole OOP paradigm is all about. So here is a brief explanation that I give to my students, starting with a few definitions. This usually helps to clear this matter up a bit.

Modifiers:

public- Can be accessed from any class from any location.
default -Available to classes in the same folder/package (no modifier)

protected- Available to all classes in the same package and its subclasses.

private- Same class access only. Not available outside the class defined in.

Now when using these modifiers we have to be careful. Some students think that having public methods means that your data is exposed or unprotected. I get questions like, “shouldn't methods be private just as the instance fields are private?“ Of course I tell them no. To help them understand why I remind them of some of the OOP principles that come into play here and how we model that with the proper use of modifiers. One of the basic principles in object oriented programming is the who idea of "data hiding" or "encapsulation". The way that works is you design your classes so that data can only be changed by the class that it is defined it. That is accomplished by declaring your instance variables (class variables) as "private". If they are private no class can change them other than the class that they are defined in.

The question remains, how can other classes use that data? Well it is simple, the class has a *public interface* . These are the class methods (ex. getSum() ). So we need to have public methods otherwise no other class could use our data. These methods update (mutator methods), and provide access (accessor methods) to or private data.

Classes that use our class need an object to access those methods, so it makes no difference if two or more classes have the same method names (although you should avoid this) because you need an object of the class to access them, and the object decides what class methods will be used. [And remember that classes are designed so that other classes can call their methods. If a class method is private then no other class can use it.]

Now that all said, there are some cases that we might declare a method as private. Occasionally your class might need what is called a helper method, which is a method that supports another method in the class. In other words other classes don't ever need to call it or use it, because it serves the class itself. So the bottom line is to design classes with a constructor that initalizes the private data (instance fields), and a public interface (mutator and accessor methods) that acts on the private data. And remember to make methods private only when their purpose is to serve the class that they are defined in.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

SPM LAN Party

Students in my AP CS class decided that it would be fun to test out their TCP/IP knowledge by setting up a mini- LAN in one of our old computer rooms. They planned out the whole thing during after school meetings with our Computer Club.

 Yesterday (yes Sunday) each student brought in their own computer systems to school, and they linked them together. They decided that it would be kind of boring to just do simple file sharing to test their LAN so they set up a “Counter-Strike” match. It was very impressive, and I was very proud of them for pulling it off without many glitches. Here are a few screen shots of their set up.

 Brendan, the network admin for this experiment was using Windows Server 2003. The next phase is they want to start learning how develop their own half-life 2 mod using Visual Studio 2005.


  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Welcome

Hello, welcome to my new Blog! - Just dropping in to introduce myself. My name is Daniel Forhan and I am a new member of Microsoft’s K-12 Faculty Advisory Board. I have been a certified teacher now for over 15 years and in that time I have taught many different computer languages such as Pascal, Basic, C, C++, and now Java. During my teaching career I have also taught many science classes such as chemistry. In the mid 90's I discovered the Java programming language and was immediately drawn to it. That eventually led to me becoming a certified Java programmer (2003).

 

Right now I teach programming courses at Saint Peter-Marian Jr./Sr. High School. This is my 9th year at SPM, and I have enjoyed every minute of it. In past years I have taught courses in Web Design and Java at one of our local community colleges.

 

One of my most recent ventures is my appointment as the VHS Site Coordinator at SPM (The ‘VHS’ stands for Virtual High School). I also teach an online course through VHS called Computational Science & Engineering Using Java. This course uses the Java programming language to teach students how to develop mathematical models.

 

Back to programming languages, I have recently been developing curriculum for my students using the .NET technology. Some specific examples of this would be the use of ASP in my Web design course, and J# with my AP Computer Science class.  The purpose of this blog is to discuss lessons (recent and not so recent) that I have found to be effective, and to share my "best practices" with you.  Stay tuned.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati