Lecture 1: Computers,
Programming, Java and Linux
What You Will Learn Today
- Understand the structure and purpose of the course.
- Locate course-related resources for independent learning.
- Review concepts related to the programming
process.
- Compare the features of Java and other programming
languages.
- Describe how to create,
compile and run a simple Java program.
- Compare the features of Linux and Windows operating systems (separate
handout).
- Course prerequisites
- An introductory first-year programming course in C++ or C.
Object-oriented knowledge is not assumed.
- Coursework
- 5 programming assignments, 2 programming projects, final exam
- Course schedule
- See the calendar for course meeting dates
and times. Note: no class next week.
- Lecturer
- Mr. G. Vogl, 077-606404, gvogl@umu.ac.ug (Nkozi Wed.-Fri.),
GregVogl
@
yahoo.com (Kampala Sat.-Tue.)
- Design, code, compile, run, test, debug, modify, and document
programs
- Explain and use programming concepts, algorithms and processes
- Be prepared for further study of the software development aspects of
computer science
- Review basic C-like language features of Java including:
applications, variables,
types, operators, expressions, statements, comments, I/O, selection, repetition, functions, arrays, strings
- Use object-oriented features of Java including classes, inheritance,
interfaces
and polymorphism
- Use basic algorithms (recursion, searching and sorting) and data structures
(stack, queue, list)
- Use Java applets, GUI components (AWT and Swing), two-dimensional
graphics, event and exception handling
- Use database and networking features
- Primary library textbook
- Big Java, Horstmann, Prentice Hall, 2002, 005.133 HOR
- Photocopies
- QuickStudy Guides: Java, Unix, C++
- Major electronic resources
- Java 2 Software Developers Kit, including API documentation, and Java
Tutorial
- Primary Intranet resource
- digital electronics and number systems
- bits/bytes, kilo/mega/giga, binary/octal/decimal/hexadecimal
conversion
- functions of a computer system
- processing, input, output, memory, storage, communication
- hardware components of a computer system
- CPU, input, output, RAM, ROM, secondary storage, communication
- software components of a computer system
- application software, system software, operating systems
- program vs. programming language
- programming activities
- obtain specifications, design an algorithm, write code, compile, run,
test, debug, revise, document
- software development activities
- project planning, resource management, analysis, specification, design,
coding, testing, debugging, installing, training, supporting, documenting
- work roles involved in software development
- project managers, systems analysts, subject matter experts, programmers,
technical writers, testers, and end users
Features of Programming Languages (Revision)
- low level language vs. high level language
- machine language vs. assembly language
- procedural language vs. object-oriented languages
- compiled language vs. interpreted language
- hardware dependent language vs. portable language
Java Overview
- Java is a relatively new, powerful, general purpose, object-oriented
programming language.
- Java is quite similar to C++ and probably easier for learning the
basics.
- Java has extensive libraries for creating graphics and GUIs,
interacting with databases, and creating Internet applications.
- Java applets are applications that can run over the Internet in a
web browser.
- Java source code is compiled to produce a type of object code
called byte code.
- Byte code is interpreted (translated into machine language) when a
program loads.
- Java supports multithreading, garbage collection and document generation
and has many built-in safety features.
- See the comparison of programming languages
for differences from other languages (JavaScript, C, C++ and Visual Basic).
// This program prints two string literals.
public class Hello
{
public static void main (String[] args)
{
System.out.println("Hello, world!");
System.out.println("My name is your name.");
}
}
Creating the Source Code
- Start a text editor such as kedit or kate (for beginners) or emacs or vim
(for advanced users).
- Type in the above program, replacing your name with your
first and last name.
- Save the file with filename Hello.java into your account or onto
a floppy disk.
- Open a shell window such as Konsole.
- If necessary, change to the directory where the file is located, e.g. type
cd /mnt/floppy
- Compile the file by typing javac Hello.java
- If the compiler reports any errors, fix them and compile again.
- If no error is reported, type ls -l to see that a file named
Hello.class has been created which contains the compiled byte code.
- To run the program, type java Hello
- You should see the following output:
Hello, world!
My name is your name.
To Do After Class
- Fill in the student survey form and return it to the lecturer at
the beginning of the lab.
- Locate Java books in the library and briefly compare their format and
contents. Read the first chapter of one to get further introduced to the
language.
- Circle any words in these notes that you do not understand, look them up
in a book, and write down their definitions using your own words.
- Log in to a computer running Linux and explore its programs, files and
features.
- Type the above Java program into a text editor, compile and run it. Make
some changes, recompile and run again.
- Browse and become familiar with the course web site (available soon).