Passing of parameter

primitive types: passing by value
Object : passing by reference, but by the value of reference, not by itsself.
: passing an object reference by value.”

a reference is an int variable whose value is linked to the pointer of an object. When an object is created with new , it is assigned an area in heap, which is represented by the first positon - pointer - of the area. Then the pointer is linked to the object reference. All this means that an object can be linked to many references , but a reference would link to nothing. For example:
Object
o1=null /* which means a reference of Object is defined and name o1, it has value which is not necessarily known by programmer, and o1 is linked to nothing*/
, o2=null
, o3=null
;//end object
o1 =new Object;// an object of Object is created , whose pointer is not necessarily known by programmer, but is linked to the reference 01. */
o2=o1;

Thinking Java Content

Over view
passing-of-parameter


Content


Ref: http://www.faqs.org/docs/think_java/TIJ3_c.htm

Think Java

What you’ll see are the definitions of the objects that represent concepts in your problem space (rather than the issues of the computer representation) and messages sent to those objects to represent the activities in that space. One of the delights of object-oriented programming is that, with a well-designed program, it’s easy to understand the code by reading it. Usually, there’s a lot less code as well, because many of your problems will be solved by reusing existing library code.

At this point, it can look like a program is just a bunch of objects with methods that take other objects as arguments and send messages to those other objects.

ApplicationWizard

Java Application Wizard is an application framework that creates complete, working Java applications. It is intended to alleviate much of the repetitive work involved in creating such applications, while providing a means of quality assurance that the applications created will be of consistent quality
more details

Pattern

Pattern Course
UML Tutorial
Design Pattern

Design Patterns are mid-level abstractions that
generally focus on the interaction among various
components or objects


Architectural Patterns are abstracted another level up
from design patterns, and often focus on integration
of component tiers


  1. Design Patterns
    1. Creational Patterns
      1. AbstractFactory
        Example
      2. Builder
        Example
      3. factory
        Example
      4. Prototype
        Example
      5. Singleton
        Example
      6. Composite
        Example

    2. Patterns for Organization of Work
      1. observer
      2. Chain of Responsibility
        Example
      3. Mediator
        Example

    3. Access Control Patterns
      1. Proxy
        Example

      2. facade

      3. Iterator

    4. Service Variation Patterns
      1. Bridge
        Example
      2. State
        Example
      3. Strategy
      4. Template


    5. Service Extension Patterns
      1. Decorator
        Example
      2. visitor
        Example

    6. Object Management Patterns
      1. Command
      2. memento
        Example

      3. flyweight

        Example
      4. Interperter
        Example


    7. Adaptation Patterns
      1. Adapter
        Example

    8. Communication Patterns
      1. Forwarder-Receiver
      2. Client-Dispatcher-Server


  2. Architectural Patterns
    1. Structural Patterns
      1. Layers
      2. Pipes and Filters
      3. Blackboard Architecture

    2. Patterns for Distribution
      1. Broker
      2. Message Queues

    3. Patterns for Interactive Systems
      1. Model-
        View-Architecture (borderline)

        Example

      2. Presentation-Abstraction-Control

    4. Adaptable Systems
      1. Microkernel
        and Reflection
      2. Reflection

    5. Frameworks and Patterns
      1. Idea of frameworks
      2. Patterns for flexibility
      3. Achieving benefits of frameworks
      4. Failures of frameworks

    6. Analysis Patterns
      1. Reuse of models
      2. Achieving generality


JDBM Tutorial - 2

Equipped with JDBM, we have a simple persistent layer for ToDoTasks without a large footprint; the entire JDBM library, jdbm.jar is an 88K jar file and you can find it on the JDBM site.

Table Presentation Matters
People have come to expect applications with table components to make their table views sortable by clicking on the header columns of the table. It takes some by surprise to find that the Swing toolkit has no built in functionality to support this easily. The oddest part of this is that Sun actually give people table sorting in plain sight. The Sun JavaDocs point to the extensive Sun Java tutorials online. If you follow the JTable links you get to a tutorial which eventually mentions, amongst lots of [Pending] comments in the text, the TableSorter

class which you can find at http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/TableSorter.java.
Now the TableSorter is a decorator model which can wrap an existing TableModel and add all the sorting functionality without changing the underlying TableModel. It doesn't store the contents of the table; it just does the bare minimum to work out how to sort the contents and map calls through to the wrapped model. In ToDoTasks, we have the TasksModel which is a simple view on the Tasks class with no sorting. In the TasksFrame class, once we have created the GUI, we call the Controller to get the TasksModel and then set that as the JTable model.

TasksModel tasksModel;
...
tasksModel=controller.getTasksModel();
tasksTable.setModel(tasksModel);

To incorporate the TableSorter, we first need to wrap the the TaskModel in a TableSorter and then set the sorter as the JTable model like so:

TasksModel tasksModel;
TableSorter sorter;
...
tasksModel=controller.getTasksModel();
sorter=new TableSorter(tasksModel);
tasksTable.setModel(sorter);

We keep a handle on the sorter as there's one thing more to do, hand the sorter the JTable's table header so it can step through it and add in mouse event listeners to make the headings trigger sorting behaviour:

sorter.setTableHeader(tasksTable.getTableHeader());

And that's it. You now have a JTable which supports clicking on a heading to toggle between no sorting, ascending order and descending order. It also supports a secondary column for sorting by pressing control and clicking on the headings. Yes, it was that simple, and leaves you wondering why TableSorter isn't an official part of Swing.

We'll wrap up this article with a tip for more rapid prototyping. You can find yourself burning time handling enumerations when presenting them in a table, translating from an enum value to a string and vice versa. In ToDoTasks, the task priority is represented as a Java 5.0 enum in Priority.java, like so:

enum Priority {
NONE(0),LOW(1),MEDIUM(2),HIGH(3),CRITICAL(4);
Priority(int priority) { this.priority=priority; }
final int priority;
}

Now, to quickly make that appear in the table, with names, you could write a custom cell renderer for the table which translated the enum value. Because enums are proper objects now, we can tell the JTable to use its defaults to render the value, and what is displayed is not the numerical value, but the name of the enum value.

To allow for editing of the value, again, we could write a custom CellEditor to do the work. But it's the matter of 3 lines of code to make the editor a drop down with all the enum values. To get all the values of an enum, you can call its values method. This returns an array in the order the enum values were declared. Once we've created our JTable in TasksFrame, we can create a DefaultCellEditor with a JComboBox.

DefaultCellEditor priorityEditor=new DefaultCellEditor(
new JComboBox(Priority.values()));

We initialise the JComboBox with the array from Priority's values. For usability's sake, we set the CellEditor to need two clicks to start editing the cell:

priorityEditor.setClickCountToStart(2);

If we had left it at one click, it would very hard to select a row using that cell because it will immediately show a combobox menu to change it. The last step is to tell the table that whenever it sees a Priority value in a cell to use our new editor:

tasksTable.setDefaultEditor(Priority.class,priorityEditor);

We now have a combobox editor which shows the enum's names as they appear in the code; a useful timesaver when you are prototyping.


tutorial-jdbm-1/2