The Eclipse IDE
An Introduction
|
Prof. David Bernstein
James Madison University
|
|
Computer Science Department |
bernstdh@jmu.edu |
|
Integrated Development Environments (IDEs)
- Defined:
- A tool that provides integrated capabilities for the
development of software
- Common Capabilities:
- Source code editor
- Debugger
- Build tools
- Document management
- Categories:
- Student-oriented (e.g., jGRASP, Dr. Java)
- Professional (e.g., Eclipse, NetBeans, IntelliJ)
Integrated Development Environments (cont.)
- Two Observations:
- Most professional IDEs have similar capabilities
- Most professional IDEs differ in "important" ways
- An Implication:
- Most people have a favorite IDE and are staunch supporters
of it
The IDE for this Course
- Which One?
- Why?
- No particular reasons except that it is free and
available on all major platforms
From Student-Oriented IDE to Professional IDE
- Why Now?
- A professional IDE will make you more productive
(and you'll be writing a lot of code)
- Downsides:
- Professional IDEs have a "steeper learning curve"
- Professional IDEs assume a level of understanding of
programming and the language that you may not have
yet
- Implications:
- Spend some time becoming familiar with Eclipse right away
- Think before you click (i.e., don't work for Eclipse,
let Eclipse work for you)
From Student-Oriented IDE to Professional IDE (cont.)
- Important Differences:
- Project-oriented
- Oriented towards large code bases
- Dynamic compilation
- "Intelligent" completion
- Implications:
- You may need to change the way you think
- You may need to change the way you work
Project Orientation
- What It Means:
- Code is organize based on the product or library it will
be a part of
- What It Means for You:
- You will need to create a project for each programming
assignment and each lab
- You may need to have multiple copies of the same code
if it is used for different programming assignments
and/or labs
- You will need to backup entire projects (if you don't
have a systematic way to backup your entire hard drive)
- It will be hard for you to move a project from one machine
to another
Large Code Bases
- What It Means:
- Eclipse uses a complicated scheme for organizing
source code and byte code that is appropriate for large
projects
- What It Means for You:
- Until you understand packages you must manually put your
code in the default package (and Eclipse will complain)
- It will be difficult for you to work from the
command-line (i.e., you will have to work from within
Eclipse almost exclusively)
- It will be much easier to change the names of variables and
classes
Dynamic Compilation
- What It Means:
- Eclipse will compile your code (to check for syntax errors)
and analyze your code (to check for style errors) while you
type
- What It Means for You:
- You must think more carefully about different kinds of errors
- You must not rush to correct "mistakes" that are highlighted by
Eclipse because they might just be things that you haven't
gotten to yet
"Intelligent" Completion
- What It Means:
- Eclipse will try to reduce the amount of typing that you need
to do by completing things for you
- What It Means for You:
- Because you make unsophisticated mistakes, the advice
is often wrong and/or confusing
- The order in which type can have a dramatic impact on
your productivity (e.g., if you type the signature of a method
before you type the comments it will scaffold the comments
for you)
- You may not need to use a browser to read the API
documentation
A Warning
- An Observation:
- "Techies" have a tendency to become obsessed with gadgets
- A Consequence:
- Programmers have a tendency to become obsessed with
tweaking their IDEs
- What This Means for You:
- You can trick yourself into thinking that you're being
productive when, in fact, you aren't
The Parts of an Eclipse Window
The Parts of an Eclipse Window (cont.)
- Important Views:
- Package Explorer
- Editor
- Problem
- Other Important Components:
The Parts of an Eclipse Window (cont.)
- The Editor Area and Editors:
- The editor area can (and usually will) contain multiple
tabbed editors
- Each editor is for a single source file
- Editors use color syntax highlighting and include the
ability to "fold" the code in various ways
- The Tool Bar:
- Contains buttons to save, run and debug the code (among other
things)
- Does not contain a button to compile the code since it
is compiled dynamically
Creating Projects and Classes
- Creating a Project:
-
File+New+Java Project
- Remember to un-check "Create module-info.java" (or,
if you forget, click on Don't Create
when asked for the name of the module)
- Creating a Class:
-
File+New+Class
- Until we discuss packaging, you must put the class in
the default package (i.e., the "Package" field must be blank)
even though Eclipse will warn you that "The use of the default package
is discouraged"