Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Programming: Advanced Topics1 Introduction to Advanced Java Programming Chapter 1.

Similar presentations


Presentation on theme: "Java Programming: Advanced Topics1 Introduction to Advanced Java Programming Chapter 1."— Presentation transcript:

1 Java Programming: Advanced Topics1 Introduction to Advanced Java Programming Chapter 1

2 Java Programming: Advanced Topics2 Objectives Review what Java is and differences between the three editions of the Java 2 platform: J2SE, J2EE, and J2ME Explore the context in which Java and related technologies are evolving See how Java supports object-oriented programming and look at some popular design patterns

3 Java Programming: Advanced Topics3 Objectives (Cont.) Learn how to use the basic tools that version of Java 2 Software Development Kit provides, especially javac, java, javadoc, and jar

4 Java Programming: Advanced Topics4 Overview of the Java Platform The Java language is object-oriented Java code is architecture-neutral and portable Java is network-savvy Java programs are secure Java is high performance

5 Java Programming: Advanced Topics5 Java Programs and Components JavaBeans: classes or program components that conform to strict programming conventions Applets: components that can be launched from HTML documents and run in a Web browser or applet viewer utility Servlets: components that generate content for Web pages at runtime Enterprise JavaBeans (EJBs): server-side components used in distributed enterprise environments

6 Java Programming: Advanced Topics6 The Three Editions of the Java 2 Platform The Java 2 platform comes in three versions: –Java 2 Standard Edition (J2SE) –Java 2 Enterprise Edition (J2EE) –Java 2 Micro Edition (J2ME)

7 Java Programming: Advanced Topics7 Containers in the n-Tier J2EE Architecture

8 Java Programming: Advanced Topics8 A Brief History of the Java Platform 1995: Version 1.0 (Sun Microsystems) 1997: Version 1.1 1998: Java 2 platform 1999: J2SE, J2EE, and J2ME 2001: Version 1.3 of J2SE 2002: Version 1.4 2002: Version 1.3 of J2EE

9 Java Programming: Advanced Topics9 Object-Oriented Programming in Java The key benefits of object-oriented programming are: –code reuse –flexibility to respond to changing circumstances and requirements –ease of maintenance

10 Java Programming: Advanced Topics10 Object-Oriented Programming in Java (Cont.) A program is a collection of objects that send messages to each other Object-oriented analysis and design (OOAD): –First stage: perform object-oriented problem analysis –Second stage: Identify classes to be implemented Identify fields and methods the classes must contain to model the behavior of real-life objects

11 Java Programming: Advanced Topics11 Object-Oriented Methodology Java lends itself to iterative and incremental object-oriented development methodology In large projects, functionality is typically added in stages and each identifiable stage is an increment An iteration is a short-term development cycle within an increment

12 Java Programming: Advanced Topics12 Object-Oriented Features of Java Java supports the following fundamental features of all object-oriented languages: –Abstract data types –Encapsulation –Inheritance –Polymorphism

13 Java Programming: Advanced Topics13 Design Patterns and Frameworks Design pattern: proposed solution to common design problem Frameworks: collections of reusable classes Popular design patterns : –Model-View-Controller design pattern –Singleton design pattern –Factory design pattern –Adapter design pattern –Façade design pattern

14 Java Programming: Advanced Topics14 Model-View-Controller Design Pattern

15 Java Programming: Advanced Topics15 An Implementation of the Singleton Design Pattern

16 Java Programming: Advanced Topics16 An Implementation of the Factory Design Pattern

17 Java Programming: Advanced Topics17 Standard SDK Tools The Java platform includes a tool set for developing Java programs The J2SDK tools run only in a command- line window and provide basic functionality

18 Java Programming: Advanced Topics18 Standard SDK Tools (Cont.) Standard J2SDK tools: –javac compiler –java launcher –javadoc documentation builder –jar packaging utility

19 Java Programming: Advanced Topics19 How the Launcher Finds Classes Java command locates bytecode files by class name Launcher loads bytecode from the file with the extension.class and with the case- sensitive base filename that matches the class name

20 Java Programming: Advanced Topics20 How the Compiler Finds Classes For public classes –Source file must have the same name as the class –Every public class must be in a separate file javac command has a -sourcepath option to specify the location of input source files when different from the location of compiled classes

21 Java Programming: Advanced Topics21 javadoc Comments The javadoc tool is a utility for generating HTML documentation directly from comments in Java source code Doc comments –Start with a slash and two asterisks (/**) –Terminate with one asterisk and a slash (*/)

22 Java Programming: Advanced Topics22 javadoc Comments (Cont.) Doc comments can appear before the following kinds of declarations: –Class –Interface –Field –Method

23 Java Programming: Advanced Topics23 javadoc Comments (Cont.)

24 Java Programming: Advanced Topics24 Creating HTML from javadoc To get HTML output in the standard format, run the javadoc program Doclet: plug-in program for javadoc that formats and outputs required documentation The javadoc tool –Preprocesses doc comments into a data structure –Delegates to a doclet conversion of data into output

25 Java Programming: Advanced Topics25 An index.html File Generated by javadoc

26 Java Programming: Advanced Topics26 Packaging Programs for Distribution The standard way to distribute J2SE is to combine files into a Java archive file using the jar tool Before running the jar tool, make sure your files are in the proper folders

27 Java Programming: Advanced Topics27 Summary The Java 2 platform comes in three versions: Java 2 Standard Edition (J2SE), Java 2 Enterprise Edition (J2EE), and Java2 Micro Edition (J2ME). You can write different kinds of programs in Java including standalone applications, applets, servlets and JSPs, JavaBeans and Enterprise JavaBeans (EJBs).

28 Java Programming: Advanced Topics28 Summary (Cont.) Java is an object-oriented language and lends itself to the creation of reusable components. Java language supports abstract data types, encapsulation, inheritance, and polymorphism, uses iterative and incremental methodology, and implements design patterns. The SDK includes command line tools: the javac compiler, java launcher, javadoc documentation builder, and jar packaging utility.


Download ppt "Java Programming: Advanced Topics1 Introduction to Advanced Java Programming Chapter 1."

Similar presentations


Ads by Google