2) java development


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Main Point: IBM is continuing to evolve and enhance the value that we bring to companies by building on the SOA announcements we made last fall…today we are going to talk to you about how a Business Centric Perspective to SOA is necessary to drive innovation that matters* As you know, SOA is one of IBM’s long term strategies to enable innovation that matters. IBM will continue to deliver SOA centric offerings. But we also want you to know that IBM’s view of SOA is business centric. and we’ll talk about this important concept. Further, we’ll discuss ways to get started through existing parts of your business (people process, information). Additionally, we’ll show how reuse and connectivity is critical to support the business centric approach. We’ll then give you detail on how the specific entry points are accelerated by SOA Foundation products and the business insight these products provide. Lastly, we’ll discuss an important part of the story called SOA Governance to ensure we’re aligning the business with IT.
  • Notes: The Java perspective provides a set of views to help you develop Java applications, numbered in the previous figure as follows: The Package Explorer view displays the contents of your Java projects, and groups package names into one entry. The Java Editor allows you to develop Java classes. This editor supports syntax highlighting, error indication, and automatic incremental builds. The Java toolbar provides quick access to the wizards and functions associated with Java application development. The Hierarchy view shows the relationship between one class and its superclasses, subclasses and interfaces. The Outline view provides a graphic representation of the current Java class in the editor. 6. The Problems view lists all compilation errors or warnings from any Java class in the workspace. 7. The Javadoc view renders the currently selected Javadoc in the Java editor in HTML format. 8. The Declaration view shows the implementation for a method selected in the Java editor. You can also show the same information by selecting a Java element and pressing F3. Instructor notes: Purpose -- Provide a brief overview about the Java perspective. Details -- Provide a general overview of the different views and editors in the Java perspective. Most students feel slightly overwhelmed when they see the perspective with all of its views in the start. Assure students that you will be covering the different parts of this perspective in more detail in this module. The numbered list in the student notes correspond to the numbered items in the screenshot. The items are arbitrarily numbered; feel free to present the views in the most logical order for you and your students. Additional information -- Remind students how to open up a perspective if they have forgotten, or refer them to the workbench basics lecture. Transition statement -- Let's examine the files that make up a Java application.
  • Notes: JUnit is a unit testing framework for Java applications. A JUnit Test Case is a Java class representation of a single unit test. A Visual Class is a regular Java class that represents a part of a graphical user interface. The visual class wizard allows you to choose from one of three graphical toolkits: the Standard Widget Toolkit (SWT), Java Swing, or the Abstract Window Toolkit (AWT). Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Describe the concept of the Java project. Details -- A Java project contains the source code and binary files for a Java application. The Package Explorer view provides pertinent information about Java applications, grouped by packages and utility classes. The Java project represents the structure of a JAR archive. Additional information -- The Package Explorer view translates the folder structure in a Java project to the proper package name. You can also examine the structure of a Java class or interface within the same view. Transition statement --
  • Notes: Usually, the wizard creates the new Java project as a subfolder within the workspace. However, there are some special circumstances where you might want to place the project outside of the workspace. For example, ClearCase can automatically maintain a repository of files over a network shared drive. To use this feature, you can create the Java project on the network share, instead of a local workspace folder. By default, Java class files are kept in the same directory as the source file. For better maintainability and ease of packaging, you can separate the source files from the binary class files into separate folders. The New Java Project wizard provides additional Java build path and dependency options on the second page of the wizard. You can access this page by clicking Next instead of Finish . Instructor notes: Purpose -- Describe how to create a Java project. Details -- Stress the importance of creating a Java project. In a manner of speaking, projects are first-class citizens in a workspace. Developers must create a project before he or she can add resources to the workspace. Additional information -- There are other methods of accessing the new Java project wizard. For example, you can click the New Java project button on the perspective toolbar, or right-click the Package Explorer view and select New -> Java Package. The slide material focuses on the main menu bar because developers can create any artifact in the workbench through that menu. Students will always be able to create a Java project, irrespective of which perspective is currently open. Transition statement -- How do you add existing classes to the Java project?
  • Notes: Use the exclusion filter to hide files in the Java project from the compiler. To configure the exclusion filter, select the Excluded item under the Java project name and click Edit . The inclusion filter works in the opposite manner, specifying which files are explicitly marked for compilation. The exclusion pattern always takes preference over the inclusion pattern. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: By default, the source files from the current Java project are always visible to any other project that references it. Therefore, you cannot clear the current Java project. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: You must create a Java project before you import a JAR, .zip or TAR file into the workspace. Otherwise, the Import Archive file wizard returns an error stating that the destination folder does not exist. Instructor notes: Purpose -- Describe the steps for importing a Java Resources contained in a Archive file such as a JAR, ZIP, or TAR. Details -- Point out that all J2EE archives (JAR, EAR, WAR and RAR) are essentially Archive files with a specific folder structure. In the workbench, the Archive file import wizard also handles Java JAR, ZIP, TAR files. Additional information -- Make sure that the Into Folder field points to the right folder in the Java project. Transition statement -- Instead of importing new resources, how can you create new Java classes and packages in the project?
  • Notes: By default, Java packages appear directly underneath the Java project folder. If you want more control in logically grouping certain Java packages, you can create a source folder within the Java project. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: If the package does not exist, the wizard creates a new Java package along with the class. Certain combinations of class modifiers are not allowed . For example, you cannot create a final static class. Specifying java.lang.Object as a superclass does not appear in the class signature, since all Java classes implicitly extend the Object class. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: The gray area in the left indicator column highlights the scope of the current Java fragment. For example, if you put the cursor within a Java method, the gray bar starts from the method signature and ends at the ending brace for the method. The purple bar next to the left indicator column highlights lines of code that have been modified since the last save. Instructor notes: Purpose -- Introduce the Java editor interface. Details -- The left and right indicator bars are also known as rulers. This concept is difficult to describe using the slide material alone. It is much easier to demonstrate the editor for the next series of slides. Additional information -- You can customize the text and background colors from the Windows -> Preferences menu. Transition statement -- How are errors indicated in the Java editor?
  • The location of the task (the line and file with which it is associated) is filled in automatically. The description is by default the code that is on that line (you can replace the default with your own text). Priorities are High, Normal, and Low. The Completed box can be checked here to indicate that the task has been resolved (for example, a developer may simply want to indicate to the team that the task discussed during a meeting has been dealt with). Both Priority and Completion are indicated in the leftmost columns of the Tasks view.
  • If there is a problem in a class, the package by definition also has a problem, and the JavaSource folder therefore shows the problem marker as well. There is no indication of how many problems there are in the class. The error is marked to the left by a red circle with a white cross. Hovering over the marker will bring up a pane showing the nature of the error. The warning is marked by a yellow triangle. The light-bulb behind the error marker indicates that Rational Application Developer has a suggested correction (in this case, it suggests adding an argument to match one of the constructors of PrintWriter). The Problems view shows the resource, which contains the problem and a description. If the description is not completely visible, you can select one row and read the description at the bottom of the window. These messages are deleted only by correcting the problem. See the next slide for a description of the filter icon.
  • See the previous slide for the placement of the problem filter icon. It is often convenient to restrict visibility of problems to a subset of resources, rather than a subset of problems. This dialog provides you with several different ways of doing this. You may, for example, only want to see errors and warnings (no informational reports), on the resource that is currently active in an editor.
  • Notes: The indicator bars indicate errors and to-do items in the current Java class. In the example above, there are two TODO items in the comment. The left indicator bar uses a blue checkmark icon to highlight the TODO items. The right indicator bar uses two blue rectangles to show the position of the TODO items, relative to the entire document. Instructor notes: Purpose -- Describe the error indicators in the Java editor. Details -- To hover over an item, place the mouse cursor over an interface element (such as the error indicator in the right ruler.) A tooltip appears displaying the error. Alternatively, open the Problems view to see a list of all errors in the workspace. Additional information -- Transition statement -- Let's explore how the quick fix feature helps you solve errors in the editor.
  • Notes:   Instructor notes: Purpose -- Walk through the steps on using the Quick Fix feature. Details -- Additional information -- The Quick Fix feature appears in views and wizards as well. For example, if you enable the regular expressions feature in the search window, a small quick fix icon appears to the left of the search criteria input field. Clicking on the quick fix icon reveals regular expression templates. Transition statement -- What other help features does the Java editor provide?
  • Notes: Code Assist helps you complete lines of code in the Java editor. The screenshot in the slide is an example of a code assist; the workbench provides a list of suggested method and field names to complete the statement. Content Assist helps you complete a block of code, using a template of code. Using content assist, you can add a for-loop structure and fill in the details. To invoke either the Code Assist or Content Assist feature, press Ctrl+Space in the editor.   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: XDoclet is an open-source project that defines a system for embedding deployment information within the Java source file. The project itself defines a set of Javadoc tags and an XDoclet syntax compiler. Rational Application Developer V7 and later understands the Javadoc annotation tags, but it uses its own incremental builder to compile the tags. Instructor notes: Purpose -- Describe other content assist features available in the Java editor. Details -- Additional information -- The Servlet, Filters and Listeners unit provides a thorough discussion about annotation tags. Leave the discussion about these tags to this unit. Transition statement --
  • Notes:   Instructor notes: Purpose -- Briefly point out the content assist templates feature. Details -- Anonymous inner classes allow you to create a simple Java class for one-time use. public int x = 0; Runnable runnable = new runnable() { public void run () { while ( x < 100 ) { System.out.println ( x += 1 ); } } } There are several interesting points about the code fragment above: The statement creates a new Java class that can only be instantiated at this point. Since runnable is an interface, this statement instantiates a class of type java.lang.Object that implements the Runnable interface. As an inner class, it has access to the fields from the surrounding outer class. The code example is for illustration purposes only. Having a separate thread access a public variable is not a good design. Additional information -- You can add your own custom content assist templates in the Java -> Editor -> Templates section of the workspace preferences. Transition statement -- Let's examine some of the other views that help you use the Java editor.
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: You can also press F2 for Javadoc Help to retrieve the same information as shown in the view. Pressing F2 for Javadoc Help returns a floating tooltip on top of your editor, instead of having to switch to a separate view. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: You can also press F3 to return the same information as shown in the declaration view. Pressing F3 opens a new editor with the declaration for the currently selected class, method, or field. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: The Java Browsing perspective provides a quick way to examine the Java elements that make up your Java application. The components within the Package Explorer view have been split into four separate views: Projects, Packages, Types and Members. Select a source folder within a Java package from the Projects view. With a project selected, the Packages view lists all of the Java packages available from the Java project. Select one package from the list. The Types view lists all of the classes and interfaces that appear in the selected Java package. Select one type from the list. The Members view displays all of the fields, variables, constructors, and methods within the selected type. The Java Editor displays the currently selected type, with the cursor located at the definition for the selected member. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • There are 3 main types of searches: File search looks for text in files or file names (regular expressions can be used). Help Search will find matches in the Rational Application Developer Help. Java Search allows you to quickly find references to and declarations of Java elements. Other search categories will depend on the extra plug-in functionality choices you made during the install of Rational Application Developer. Rational Application Developer for example, whether you choose to install Crystal Reports functionality into Rational Application Developer.
  • Notes: To open the search dialog box, perform one of the following three tasks: Click Search -> Search from the main workbench menu. Use the Ctrl+H hotkey from the workbench. In the Java perspective, press the Search toolbar button. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: The workbench features refactoring tools for reorganizing Java applications. When you refactor a program, you transform your code while preserving its behavior. For example, when you rename an element, the workbench's refactoring support changes both the selected resource's name and all references to it. This feature allows you to make changes to code structures, and to have those changes ripple across the entire project consistently. All the dependencies are analyzed and modified where appropriate. There are several options that allow you to control the process of incorporating the changes. By default, you are prompted to review the changes before committing them. You can choose various other options, such as committing changes if no error occurs. If you need to revert the changes, even after you commit, you can use local history. Pull-up will move the selected method one level up the inheritance tree (to the super class) and ensure that all references are updated appropriately. Self-encapsulation will wrap access to any member fields in getter and setter methods. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement -- [Unconditional]
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: An Extends relationship is also known as an inheritance or is-a relationship. An Implements relationship is also called a has-a relationship. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: The list of properties on this foil describe some of the more commonly used settings for basic Java properties. Other properties, such as Project References and Java JAR Dependencies, affect the operation of Java projects within a J2EE enterprise project. Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes:   Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: To open the Java preferences dialog, select Windows > Preferences . Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes: To open the Java preferences dialog, select Windows > Preferences . Instructor notes: Purpose -- Details -- Additional information -- Transition statement --
  • Notes : Write down your answers here: Instructor notes : Purpose — Details — Additional information — Transition statement —
  • RUP Rational Unified Process, Developer Tab , Designer > Concepts > J2EE to RUP Mapping Rational Unified Process, Developer Tab , Designer > Enterprise JavaBean (EJB) Design > Guideline s > Designing Enterprise JavaBeans (EJBs) Web Resources http://www-130.ibm.com/developerworks/ http://w3.ams1.ibm.com/services/ams/competency/ams/tools_support/rational/learn_about/ams_rational_advanced_learning.html EJB Best Practices: Entity Bean Protection: http://www-106.ibm.com/developerworks/java/library/j-ejb1008.html Literature Enterprise Java Programming with IBM® WebSphere®, Second Edition By Kyle Brown, Gary Craig, Greg Hester, Russell Stinehour, W. David Pitt, Mark Weitzel, Jim Amsden, Peter M. Jakab, Daniel Berg Additional Courses Introduction to Web Services - http://w3-3.ibm.com/education/CourseDescriptionServlet.wss?city=&state=&countrycode=&coursecode=XM371&courseDescrLanguageId=1 WebSphere Training and Technical enablement: http://www-128.ibm.com/developerworks/websphere/education/enablement/curriculum/cur_webtoolside.html Review resources with students and answer questions.
  • Self explanatory
  • 2) java development

    1. 1. Vikas Manoria IT Specialist – IBM Academic Initiative [email_address] Section -2) Java Development
    2. 2. Section 2 - Java Development (24%) <ul><li>Create Java projects, packages, classes, and methods </li></ul><ul><li>Manage the Java Build Path </li></ul><ul><li>Use the Outline view </li></ul><ul><li>Use the refactoring features </li></ul><ul><li>Use the Java editor features such as content assist and code formatting </li></ul><ul><li>Add and organize import declarations </li></ul><ul><li>Use the Java search function </li></ul><ul><li>Use the Task and Problems views </li></ul><ul><li>Use the Hierarchy view </li></ul><ul><li>Use the resource and project property dialogues </li></ul>
    3. 3. The Java Perspective 1 2 3 4 5 6 7 8
    4. 4. Java Perspective Toolbar Commands <ul><li>As an alternative to the New main menu command, you can create Java artifacts using the Java perspective toolbar. </li></ul>1. Create Java Project 2. Create Java Package 3. Create Java Class a. Create Visual class b. Create Java class c. Create Java interface d. Create Java Enum e. Create Annotation f. Create JUnit Test Case 4. Launch New_configuration (for Code Analysis) 5. Debug Java Application 6. Run Java Application 7. Profile Java Application 8. Run External Tools 9. Open Type 10. Open Search Dialog 1 2 3 4 5 6 7 8 9 10 a b c d e f
    5. 5. Overview of Java Projects <ul><li>Java projects contain source code and related files needed to create a Java application. </li></ul><ul><ul><li>The workbench associates Java projects with an incremental builder that compiles Java code as it is edited. </li></ul></ul><ul><li>Java projects also maintain models of their contents. </li></ul><ul><ul><li>The model includes information about the type hierarchy, declarations, and references of Java elements. </li></ul></ul><ul><li>After creating a new Java project, you can import a JAR file into the project. </li></ul>
    6. 6. Create a New Java Project <ul><li>Start the Create Java Project wizard. </li></ul><ul><ul><li>In the Java perspective, select File > New > Project . </li></ul></ul><ul><ul><li>Select Java Project . </li></ul></ul><ul><ul><li>Click Next . </li></ul></ul><ul><li>Provide a name and location for the new Java project. </li></ul><ul><ul><li>Specify a unique project name. </li></ul></ul><ul><ul><li>Set the location of the project within the workspace, or in any directory. </li></ul></ul><ul><ul><li>Decide to use the default JRE, or use a project-specific JRE. </li></ul></ul><ul><ul><li>Decide whether to keep source and class files together or separate. </li></ul></ul><ul><ul><li>Click Finish . </li></ul></ul>
    7. 7. Java Build Path: Source and Projects <ul><li>The Source tab specifies where to store the Java source files and output class files. </li></ul><ul><li>The Projects tab adds other projects from the workspace to the build path. </li></ul><ul><ul><li>Add a project if the current Java application depends on classes in another project in the workspace. </li></ul></ul>
    8. 8. Java Build Path: Libraries <ul><li>The Libraries tab adds JAR files and class folders to the build path. </li></ul><ul><ul><li>Add a JAR file located in the workspace with the Add JARs button. </li></ul></ul><ul><ul><li>Add a JAR file located outside of the workspace with the Add External JARs button. </li></ul></ul><ul><ul><li>Add classpath variables with the Add Variable button. </li></ul></ul><ul><ul><li>Add a library of Java resources using Add Library button. </li></ul></ul><ul><ul><ul><li>Libraries are arbitrarily organized sets of JAR files. </li></ul></ul></ul><ul><ul><li>Click the Add Class Folder button to add a directory with class files residing outside of your workspace. </li></ul></ul>
    9. 9. Java Build Path: Order and Export <ul><li>The Order and Export tab sets the order of JAR files and class folders in the Java build path. </li></ul><ul><ul><li>Use the Up and Down buttons to arrange the order within the Java build path. </li></ul></ul><ul><ul><li>Select the check box next to an entry to make the source files visible to other projects dependent on the current Java project. </li></ul></ul><ul><ul><ul><li>For example, TransferJava has a project reference to AccountJava. </li></ul></ul></ul><ul><ul><ul><li>In the Order and Export tab, the AccountJava project is selected. </li></ul></ul></ul><ul><ul><ul><li>If a third project, CustomerJava, references TransferJava, it has access to the classes in AccountJava as well. </li></ul></ul></ul>
    10. 10. Import Archived Resources into a Java Project <ul><li>Start the Import Archived file wizard. </li></ul><ul><ul><li>In the Java perspective, select File > Import . </li></ul></ul><ul><ul><li>From the Import wizard, select General > Archive file. </li></ul></ul><ul><ul><li>Click Next . </li></ul></ul><ul><li>Select the source JAR, .zip, or TAR file and destination. </li></ul><ul><ul><li>Enter the path filename of the Archive file. </li></ul></ul><ul><ul><li>Select one or more files for importing from the Archived file. </li></ul></ul><ul><ul><li>Import files by extension using the Filter Types feature. </li></ul></ul><ul><ul><li>Use the Into folder to select a </li></ul></ul><ul><ul><li>destination Java project. </li></ul></ul>
    11. 11. Create a New Java Package <ul><li>Start the New Java Package wizard. </li></ul><ul><ul><li>In the Java perspective, select File > New > Package . </li></ul></ul><ul><li>Enter the source folder and name of the new Java package. </li></ul><ul><ul><li>Select a source folder as the root of the Java package structure. </li></ul></ul><ul><ul><ul><li>If you do not have any source folders defined in the Java project, the Java project folder itself is the source folder. </li></ul></ul></ul><ul><ul><li>Enter the full package name for the Java package. </li></ul></ul>
    12. 12. Create a New Java Class <ul><li>Start the New Java Class wizard. </li></ul><ul><ul><li>Select File > New > Class . </li></ul></ul><ul><li>Specify the source folder and package name for the Java class. </li></ul><ul><li>Set the name of the new Java class and class modifiers. </li></ul><ul><li>Specify a single superclass to extend, and zero or more interfaces to implement. </li></ul><ul><li>Set the wizard to generate: </li></ul><ul><ul><li>Main method stub </li></ul></ul><ul><ul><li>Constructors from superclass </li></ul></ul><ul><ul><li>Abstract methods from abstract classes or interfaces </li></ul></ul><ul><li>Click Finish . </li></ul>
    13. 13. The Java Editor <ul><li>Syntax type categorized by color: </li></ul><ul><ul><li>Java comments are green; Javadoc comments are cyan. </li></ul></ul><ul><ul><li>Keywords and built-in types are magenta. </li></ul></ul><ul><ul><li>Strings are navy blue. </li></ul></ul><ul><li>Two indicator bars are placed on each side of the editor. </li></ul><ul><ul><li>The left indicator bar is proportional to each line of code. </li></ul></ul><ul><ul><li>The right indicator bar is proportional to the scale of the entire Java class. </li></ul></ul><ul><li>Changes since your last save are denoted by a light purple bar. </li></ul>
    14. 14. Tasks <ul><li>A task is a user-defined statement that can be either associated or unassociated. </li></ul><ul><ul><li>Associated: Referencing a line in a resource </li></ul></ul><ul><ul><li>Unassociated: not related to any resource </li></ul></ul><ul><li>A task is associated by opening the resource in an editor, right-clicking the left grey border and selecting Task. </li></ul>
    15. 15. Problems <ul><li>If problems are detected, a message is logged </li></ul><ul><li>The message cannot be removed manually. </li></ul><ul><li>There are three types of problems: </li></ul><ul><ul><li>Errors, Warning, and Information </li></ul></ul>1 2 3 4
    16. 16. Filtering the Problem View <ul><li>Use the Filter Tasks wizard to temporarily hide messages in the Problems view. </li></ul><ul><ul><li>You must fix the problem to remove it permanently </li></ul></ul><ul><li>Since problems are reported by validators, disabling a validator in the project's Properties page will remove the messages it reports. </li></ul>
    17. 17. Examine Errors in the Java Code Editor <ul><li>Icons on the left indicator column mark special locations. </li></ul><ul><ul><li>Blue checkmarks indicate a task item. </li></ul></ul><ul><ul><li>Red circles with an ‘x’ indicate a syntax error. </li></ul></ul><ul><ul><li>Light bulb icons indicate that a quick fix is available. </li></ul></ul><ul><li>Rectangles on the right indicator column display the same locations, in scale with the whole document. </li></ul><ul><ul><li>Blue rectangles indicate the relative position of a to-do item. </li></ul></ul><ul><ul><li>Red rectangles indicate the relative position of a syntax error. </li></ul></ul><ul><li>Hovering over errors </li></ul><ul><li>provides you with additional information. </li></ul>
    18. 18. Correct Errors with the Quick Fix Feature <ul><li>The Quick Fix feature suggests solutions to the highlighted error. </li></ul><ul><ul><li>Click the light bulb icon to show a list of suggested fixes. </li></ul></ul><ul><ul><li>Click one of the suggestions to preview the applied fix to your Java class. </li></ul></ul><ul><ul><li>Double-click the suggestions to add the particular fix to your application. </li></ul></ul>1 2 3
    19. 19. Code Assist / Content Assist <ul><li>These features provide suggestions to complete code or script </li></ul><ul><ul><li>Available for Java, HTML, JSP, XML and others </li></ul></ul><ul><ul><li>Type Ctrl+Space to invoke Code or Content Assist </li></ul></ul><ul><ul><li>Automatically triggered when you type a period (.) in a Java code fragment </li></ul></ul><ul><li>Depends on Project container context and file type </li></ul>
    20. 20. Additional Content Assist Features <ul><li>Comment code assist provides a list of: </li></ul><ul><ul><li>XDoclet-style annotation tags </li></ul></ul><ul><ul><li>Javadoc tags </li></ul></ul><ul><li>Variable name assist suggests a name for a variable based on the type name. </li></ul>
    21. 21. Content Assist Templates <ul><li>Templates provide a skeleton of common code constructs: </li></ul><ul><ul><li>Try/Catch blocks for exceptions </li></ul></ul><ul><ul><li>Loop constructs </li></ul></ul><ul><ul><li>Anonymous inner classes </li></ul></ul>
    22. 22. Hierarchy View <ul><li>Displays the relationship between superclasses, subclasses, and implemented interfaces of the current type. </li></ul><ul><ul><li>Show the Type Hierarchy displays all superclasses and subclasses of the current type. </li></ul></ul><ul><ul><li>Show the Supertype Hierarchy lists all supertypes and implemented interfaces. </li></ul></ul><ul><ul><li>Show the Subtype Hierarchy lists all </li></ul></ul><ul><ul><li>subtypes of the selected type. </li></ul></ul><ul><ul><ul><li>If the current type is an interface, the list </li></ul></ul></ul><ul><ul><ul><li>shows all types that implement the interface. </li></ul></ul></ul>
    23. 23. Javadoc View <ul><li>The Javadoc view returns an HTML rendered Javadoc Help for the currently selected resource. </li></ul><ul><ul><li>Previews Javadoc comments in your class in HTML format </li></ul></ul><ul><ul><li>This view also displays the Javadoc for a class or interface from the J2SE API </li></ul></ul>
    24. 24. Declaration View <ul><li>The Declaration view reveals the implementation for the currently selected class, method, or field in the Java editor. </li></ul><ul><ul><li>This view allows you to quickly browse the underlying implementation for a method call or an object definition. </li></ul></ul><ul><ul><li>Bring up the pop-up menu within the Declaration view and select Open to view the referenced class in a new Java editor. </li></ul></ul>
    25. 25. The Java Browsing Perspective 1 2 3 4 5
    26. 26. Search <ul><li>Start a search by selecting Search from the main menu. </li></ul><ul><li>The results of a search can be seen in the Search view. </li></ul><ul><li>Previous search results are stored, and can be retrieved in the Search view or Classic Search view. </li></ul>
    27. 27. Java Search <ul><li>Java Search performs a search of declarations, references, and other Java elements. </li></ul><ul><ul><li>This search type understands the structure of a Java class and a Java interface. </li></ul></ul><ul><ul><li>For example, search for all classes that reference the verifyLogon method within the workspace. </li></ul></ul>
    28. 28. Refactoring Java Code <ul><li>Refactoring code allows you to make application-wide improvements while preserving the behavior of the program. </li></ul><ul><ul><li>Developers often perform refactoring to make an application more manageable. </li></ul></ul><ul><li>Rational Application Developer V7 and later has built-in support for common refactoring tasks. </li></ul><ul><ul><li>The Java development tools will examine your entire application and update any references to your change. </li></ul></ul><ul><ul><li>You can choose to preview any changes from refactoring before committing the operation. </li></ul></ul>
    29. 29. Move Java Class to Another Package <ul><li>Start the Refactor Move wizard. </li></ul><ul><ul><li>In the Java perspective, right-click a Java class and choose Refactor > Move . </li></ul></ul><ul><ul><li>Click Next . </li></ul></ul><ul><li>Specify the new destination for the Java class. </li></ul><ul><ul><li>Select a different package, or use the New button to create a new package. </li></ul></ul><ul><ul><li>Click Preview to examine the </li></ul></ul><ul><ul><li>changes before committing </li></ul></ul><ul><ul><li>the move. </li></ul></ul>
    30. 30. Refactoring Functions (1 of 4) Function Description Shortcut Undo Reverses the last refactoring operation Alt+Shift+Z Redo Performs a refactoring operation that was previously reversed Alt+Shift+Y Rename Changes the name of a Java element, and updates all references to that element Alt+Shift+R Move Moves a Java element from between classes, interfaces, packages, or projects Alt+Shift+V Change Method Signature Changes the name or parameters of a method, and updates all references to the method Alt+Shift+C Convert Anonymous Class to Nested Provides a name for an anonymous class, thus changing the class into a nested class
    31. 31. Refactoring Functions (2 of 4) Function Description Move Member Type into New File Extracts a nested class and saves it as a separate class Push Down Moves a set of methods and fields from a class to its subclasses Pull Up Moves a set of methods and fields from a class to its superclass Extract Interface Creates a new interface based on a class. Optionally, you can make the source class implement the new interface Generalize Type Replaces a type in a variable, parameter, or field or on a method return type with one of its supertypes Use Supertype Where Possible Replaces all occurrences of a type with one of its supertypes
    32. 32. Refactoring Functions (3 of 4) Function Description Shortcut Inline Replace a method invocation with the implementation of the method itself. For static final fields, replace a reference to the field with the actual value Alt+Shift+I Extract Method Takes a section of code within a method and places it in a new method Alt+Shift+M Extract Local Variable Creates a local variable from an expression. Replaces an expression with a reference to the local variable Alt+Shift+L Extract Constant Creates a static final field from an expression. Replaces the expression with a reference to the static final field Introduce Parameter Within a method, extracts an expression and replaces it with a new method parameter
    33. 33. Refactoring Functions (4 of 4) Function Description Shortcut Introduce Factory Replaces a constructor with a factory method that invokes the constructor Convert Local Variable to Field Replaces a local variable with a field. If the local variable is initialized when it is created, this operation moves the initialization code to the method’s constructor. Alt+Shift+F Encapsulate Field Replaces all references to a field with getter and setter methods
    34. 34. Source Functions (1 of 4) Function Description Shortcut Toggle Comment Adds single line comments ( // ) to each line in the selection Ctrl+/ Add Block Comment Adds block comment tags ( /* */ ) around the selection Ctrl+Shift+/ Remove Block Comment Removes block comment tags ( /* */ ) around the selection Ctrl+Shift+ Shift Right Adds a tab character to the start of each line in the selection Tab Shift Left Removes a tab character from the start of each line in the selection Shift+Tab Format Changes the indentation, line spacing, and braces in the entire Java class according to the code formatter settings Ctrl+Shift+F
    35. 35. Source Functions (2 of 4) Function Description Shortcut Format Element Apply code formatting only to the first Java element in the selection Correct Indentation Adjust the indentation to every line in the current selection Ctrl+I Sort Members Arrange the member order according to the Member Sort Order in Java preferences Organize Imports Adds any missing import statements, and removes any unused import statements Ctrl+Shift+O Add Imports Adds an import statement for the currently selected type. Removes the package name for a qualified type, if possible. Ctrl+Shift+M Override/ Implement Methods Creates one or more methods defined in a superclass or interface
    36. 36. Source Functions (3 of 4) Function Description Shortcut Generate Getters and Setters Creates a get Field and set Field method for one or more fields in the current class Generate Delegate Methods For a field in the current class, creates a wrapper around methods from the field’s class Generate Constructor using Fields Creates a new constructor that initializes one or more fields in the class Add Constructor from Superclass Overrides one or more constructors defined in a superclass Add Javadoc Comment Adds a Javadoc comment and appropriate Javadoc tags for the selection Alt+Shift+J
    37. 37. Source Functions (4 of 4) Function Description Shortcut Surround with try/catch Block Adds a try/catch block around the selection to catch exceptions Externalize Strings Takes all static string declarations and saves them into a separate properties file. Also creates a method to retrieve strings in the properties file. Find Strings to Externalize Given a project, source folder, or package, searches for any strings that have not been externalized Convert Line Delimiters To <ul><li>Changes the end-of-line indicator in the current document to one of the three formats: </li></ul><ul><li>Windows (Carriage return , line feed ) </li></ul><ul><li>Unix, MacOS (Line feed ) </li></ul><ul><li>Classic MacOS (Carriage return ) </li></ul>
    38. 38. Preview and Commit the Move Operation <ul><li>Preview the changes before committing the move operation. </li></ul><ul><ul><li>Select one of the items in the Changes to be performed list. </li></ul></ul><ul><ul><li>To override a change made by the move operation, clear the check box next to the change list. </li></ul></ul><ul><ul><li>Examine the difference in the affected Java artifact using the Original Source and Refactored Source windows. </li></ul></ul><ul><ul><li>Click OK to commit all of the selected changes from the move operation. </li></ul></ul>
    39. 39. UML Visualization Overview <ul><li>The Unified Modeling Language (UML) provides a visual representation of the structures and relationships of elements in applications. </li></ul><ul><li>The UML visualization tools in Rational Application Developer V7 and later provides two main functions: </li></ul><ul><ul><li>Code Visualization describes a Java application in a graphical format using UML notation. </li></ul></ul><ul><ul><li>Visual Editing applies changes in the UML diagram to the actual application code. </li></ul></ul><ul><li>To start visualizing your Java application, create a UML diagram and document your application using UML notation. </li></ul>
    40. 40. Create a New Class Diagram File <ul><li>Start the New Class Diagram wizard. </li></ul><ul><ul><li>In the Java perspective, select File > New > Other . </li></ul></ul><ul><ul><li>Expand the Modeling folder and select Class Diagram. </li></ul></ul><ul><ul><li>Click Next . </li></ul></ul><ul><li>Specify the name and location for the new Class Diagram file. </li></ul><ul><ul><li>Specify a location for the class diagram file. </li></ul></ul><ul><ul><li>Choose a name for the class diagram file. </li></ul></ul><ul><ul><li>Click Finish . </li></ul></ul>
    41. 41. Visualize Existing Java Resources <ul><li>Open the new class diagram file. </li></ul><ul><ul><li>Bring up the pop-up menu right-click in the class diagram and select Visualize Existing > Java Type . </li></ul></ul><ul><ul><li>Enter the name of the Java types that you want to visualize in the diagram. </li></ul></ul><ul><li>Explore relationships between different Java types in the diagram. </li></ul><ul><ul><li>Use the incoming and outgoing relationship arrows to create relationships between types. </li></ul></ul><ul><li>Relationships created in the diagram affect Java types in your workspace. </li></ul>
    42. 42. Relationships between Java Types <ul><li>There are four different types of relationships between Java types: </li></ul><ul><ul><li>An Extends relationship exists when a class inherits the behavior of another class. </li></ul></ul><ul><ul><li>An Implements relationship exists when a class realizes the behavior of an interface. </li></ul></ul><ul><ul><li>An Association relationship exists when the objects of one classifier (class or interface) are connected to, and can navigate the objects of another classifier. </li></ul></ul><ul><ul><ul><li>For example, the TransferBean class has a field of type AccountBean. </li></ul></ul></ul><ul><ul><li>A Dependency relationship exists when a change in one class might cause a change in another class. </li></ul></ul><ul><ul><ul><li>For example, the TransferBean class has a method that takes an AccountBean object as a parameter. </li></ul></ul></ul>«use» +1 AccountBean
    43. 43. Java Project Properties <ul><li>The Java project properties define how the workbench maintains files within the project: </li></ul><ul><ul><li>Builders specify which incremental builds should run in the Java project. </li></ul></ul><ul><ul><ul><li>For example, the Java Builder compiles source code into Java applications. </li></ul></ul></ul><ul><ul><li>Java Build Path defines where the compiler should search for classes referenced in the Java application. </li></ul></ul><ul><ul><li>Java Compiler defines how the workbench compiles classes in the project. </li></ul></ul><ul><ul><li>Javadoc Location sets where the workbench should publish Javadoc files. </li></ul></ul><ul><ul><li>Validators automatically check the structure and syntax of certain file types, such as XML files. </li></ul></ul><ul><li>To open the Java project properties, right-click the Java project and select Properties. </li></ul>
    44. 44. Java Build Path Settings <ul><li>You can set Java Build Path settings within the New Java project wizard or the Java project properties. </li></ul><ul><ul><li>The compiler searches the locations listed in the Java Build Path for the classes referenced by your application. </li></ul></ul><ul><ul><li>The Java Build Path properties also allow you to specify the location for the compiled classes and default output . </li></ul></ul>
    45. 45. Workspace Settings in Java Preferences (1 of 2) <ul><li>Modify the Java preferences to change settings for all of the Java resources in the workspace. </li></ul><ul><ul><li>Appearance controls the appearance of Java elements in workbench views. </li></ul></ul><ul><ul><ul><li>Type Filters removes Java packages from the Open Type command, code assist, and quick fix. </li></ul></ul></ul><ul><ul><li>Build Path sets the default class build path for all Java projects. </li></ul></ul><ul><ul><li>Code Style sets conventions for Java element names, spacing, and sort order. </li></ul></ul><ul><ul><li>Compiler sets the JDK compliance level, and the severity of compilation problems. </li></ul></ul><ul><ul><ul><li>Task Tags set task indicators in Java comments, such as the TODO tag. </li></ul></ul></ul>
    46. 46. Workspace Settings in Java Preferences (2 of 2) <ul><ul><li>Editor customizes the appearance and behavior of the Java editor. </li></ul></ul><ul><ul><li>Installed JREs list the Java run times on which you can run your application. </li></ul></ul>
    47. 47. Checkpoint <ul><li>Which view in the Java perspective allows you to see the relationship between a type, its supertypes, and its subtypes? </li></ul><ul><li>What is the advantage of using the Refactor Move feature, as opposed to moving a Java source file manually outside of Rational Application Developer? </li></ul><ul><li>In the Java Editor, what information is shown by the left and right status rulers (bars)? </li></ul><ul><li>Name two features that add the correct import statement in the Java Editor. </li></ul><ul><li>What are the types of problems and the associated icons in the Problems view? </li></ul>
    48. 48. Checkpoint answers <ul><li>The Type Hierarchy view allows you to view the relationship between a type and its super and subtypes. The UML visualization tools can also diagram the relationship between types. </li></ul><ul><li>The Refactor Move command verifies every reference to the resource within the workspace and updates all references. Moving the file outside of the workbench will not update these references. </li></ul><ul><li>In the Java editor, the left indicator bar displays the tasks and errors in the same scale as the lines within the editor. The right indicator bar displays the tasks and errors as well, but in scale with the entire file. </li></ul><ul><li>The Organize Imports command scans the current Java class and suggests an import statement to fix any classes. The Quick Fix feature also suggests an import statement for a class that the compiler cannot resolve. </li></ul><ul><li>Error (red circle, white cross), warning (yellow triangle, exclamation mark), Information (blue exclamation mark) </li></ul>
    49. 49. Lab <ul><li>Create Java Project, package and 2 classes </li></ul><ul><li>Problems & Tasks </li></ul><ul><li>Quick fix & Run </li></ul><ul><li>Other Java views </li></ul><ul><li>Code/content assist </li></ul><ul><li>Java Browsing perspective </li></ul><ul><li>Create Class diagram </li></ul><ul><li>Source and Refactor options </li></ul><ul><li>Java search </li></ul><ul><li>Project properties </li></ul><ul><li>Java preferences </li></ul>
    50. 50. Japanese Hebrew Thank You English Merci French Russian Danke German Grazie Italian Gracias Spanish Obrigado Portuguese Arabic Simplified Chinese Traditional Chinese Thai Korean