Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Saturday, August 02, 2008

Eclipse for Web Development

Well, I've been doing quite a bit of programming lately, however, it has been in a number of different languages. Naturally, I have considered Eclipse as a possible editor. Vanilla Eclipse is usually geared to toward Java development and can become tricky and tedious to setup for Web Development (hence the rise of Aptana). Eclipse can be great to work with, but only when you can get it working how you'd like. The following update sites may be helpful to get Eclipse setup how you hope to have it:

JavaScript
http://download.macromedia.com/pub/labs/jseclipse/autoinstall (JSEclipse)

Python
http://pydev.sourceforge.net/updates/ (PyDev)

PHP
http://update.phpeclipse.net/update/nightly (PHPEclipse)

Java Tapestry
http://m2eclipse.sonatype.org/update (Maven2)
http://jettylauncher.sourceforge.net/updates (Jetty)

Currently, all of these plugins can be loaded into a single installation of Eclipse Europa. However, I'm not sure that they are all compatible with Ganymede (latest version of Eclipse).

Friday, May 16, 2008

Java Programming Notes

Java Programming Notes is a handy Java reference by Fred Swartz. In his words, he explains:
These Java programming notes are written to fill in missing or weak topics in textbooks that I've taught from. Many pages are useful for reference, but not as an ordered tutorial. Some pages are still rough drafts, but I'm slowly working on fixing them.

Friday, May 02, 2008

Abstract classes and Interfaces

In response to some of the questions asked in class today, I compiled some properties of interfaces and abstract classes that should help guide your choice when deciding when to use an Abstract class or an Interface as a parent class.

Neither an Interface nor an Abstract class can be instantiated. Both can be used to as a template for concrete (implemented) child classes.

Interfaces
  • example interface definition:
public interface Monkey {
public double getWeight();
public void setWeight(double w);
public void walk();
public void talk();
}
  • fields (i.e., members, variables) are not allowed
  • all methods are implicitly abstract
  • a child class can implement many interfaces in Java
  • child classes must implement all methods
Abstract Classes
  • example abstract class definition:
public abstract class Monkey {
private double weight;
public Monkey(){
}
public double getWeight(){
return weight;
}
public void setWeight(double w){
weight = w;
}
public abstract void walk();
public abstract void talk();
}
  • may have members (e.g., weight)
  • may have implemented methods (e.g., getWeight, setWeight) and abstract methods (e.g., walk, talk)
  • a child class can only extend a single parent class in Java (multiple inheritance is not allowed)
  • child classes must implement all of the parent's abstract methods
Section 4.4 in Data Structures and Problem Solving in Java discusses this more extensively. 

This talks more about when you might use one, the other, or both. Furthermore, I found some questions and answers about the two that interviewers like to use. ;)

Java Tutorials

Sun provides some excellent tutorials that cover most aspects of programming in Java. Learning the Java language is a set of tutorials, or "trails", on the following fundamental topics:
The content of these trails is also available as a book, called The Java Tutorial, Fourth Edition.