Presentation is loading. Please wait.

Presentation is loading. Please wait.

05/26/2004www.indyjug.net1 Indy Java User’s Group May 26 2004 Knowledge Services, Inc.

Similar presentations


Presentation on theme: "05/26/2004www.indyjug.net1 Indy Java User’s Group May 26 2004 Knowledge Services, Inc."— Presentation transcript:

1 05/26/2004www.indyjug.net1 Indy Java User’s Group May 26 2004 6:00p.m @ Knowledge Services, Inc.

2 05/26/2004www.indyjug.net2 Agenda Welcome / Pizza6:00-6:15 Announcements6:15-6:30 Design Patterns6:30-7:30 Wrap-up / QA7:30-8:00

3 05/26/2004www.indyjug.net3 Mission Statement Promote the use of the Java language and components across all levels of interest in the greater Indianapolis area, by serving as a resource for knowledge, experience and career opportunities.

4 05/26/2004www.indyjug.net4 Announcements Next Meeting - June 30, 2004 JINI - Scott Ganyo Discussion Forum http://groups.yahoo.com/group/indyjug Website www.indyjug.net

5 05/26/2004www.indyjug.net5 Tonight’s Objective De-Mystify Design Patterns Introduce Gang of Four Design Pattern Demonstrate Decorator and Strategy Offer invitation for application

6 05/26/2004www.indyjug.net6 Design Patterns Goals of design patterns Published design patterns (GofF) Elements of a design pattern Categories of the GofF design patterns

7 05/26/2004www.indyjug.net7 Design Patterns (Goal) “Capture solutions that have developed and evolved over time in a succinct and easily applied form.” “Systematically name, explain and evaluate an important and recurring design in object-oriented systems”

8 05/26/2004www.indyjug.net8 Design Patterns (Published) Gang of Four Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides Book Design Patterns: Elements of Reusable Object-Oriented Software ISBN 0-201-63361-2 Copyright 1995 by Addison Wesley, Inc.

9 05/26/2004www.indyjug.net9 Design Patterns (Elements-1) Pattern Name (handle) Higher level of abstraction Vocabulary Problem (context) Conditions that must be met before the pattern can be applied Describe class or object structures

10 05/26/2004www.indyjug.net10 Design Patterns (Elements-2) Solution (elements) Relationships Responsibilities Collaborations Consequences (trade-off) Flexibility Extensibility Portability

11 05/26/2004www.indyjug.net11 Design Patterns (Categories) Creational Patterns Factory Method, Singleton Structural Patterns Adapter, Decorator Behavioral Patterns Command, Iterator

12 05/26/2004www.indyjug.net12 Design Patterns (Creational) Creational design patterns abstract the instantiation process. They help make a system independent of how its objects are created, composed, and represented (Factory, Singleton)

13 05/26/2004www.indyjug.net13 Design Patterns (Structural) Structural design patterns are concerned with how classes and objects are composed to form larger structures. (i.e. Inheritance) (Adapter, Decorator)

14 05/26/2004www.indyjug.net14 Design Patterns (Behavioral) Behavioral design patterns are concerned with algorithms and the assignment of responsibilities between objects including the communication between them. (Command, Iterator)

15 05/26/2004www.indyjug.net15 Design Patterns (Example) Need to create a table model to view and modify system data information. Options Implement TableModel interface Utilize the AbstractTableModel class Utilize the DefaultTableModel class

16 05/26/2004www.indyjug.net16 Design Patterns (cont’d) Implement the TableModel interface Must declare all 9 methods including Management of listeners Column name resolution Class type for a given column Value at a given x,y coordinate Editable state for x,y coordinate Row and column counts

17 05/26/2004www.indyjug.net17 Design Patterns (cont’d) Utilize the AbstractTableModel class Must implement 3 methods Value at a given x,y coordinate Row counts Column counts All other values are handled or defaulted.

18 05/26/2004www.indyjug.net18 Design Patterns (cont’d) Utilize the DefaultTableModel class No methods to implement Additional API Ability to add a column Ability to insert and move rows Support for custom events

19 05/26/2004www.indyjug.net19 Design Patterns (Strategy) Defines a family of algorithms, encapsulate each one, and make them interchangeable. Allows the algorithm to vary independently from clients that use it. Interface implementation

20 05/26/2004www.indyjug.net20 Design Patterns (Utilization) Utilize by inheritance. Public class MyTableModel extends AbstractTableModel Utilization by decoration. Public class MyTableModel implements TableModel

21 05/26/2004www.indyjug.net21 Design Patterns (Decorator) Attach additional responsibilities to an object dynamically. Flexible alternative to subclassing by attaching responsibility at runtime. Also called Wrapper GofF example: Border and ViewText

22 05/26/2004www.indyjug.net22 Design Patterns (References) Decorator: www.javaworld.com/javaworld/jw-04-2004/jw-0412-decorator_p.html Strategy: www.javaworld.com/javaworld/jw-04-2002/jw-0426- designpatterns_p.html Java Design Patterns Articles: http://www.javaworld.com/channel_content/jw-patterns-index.shtml “Why Extends is Evil”: http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html

23 05/26/2004www.indyjug.net23 Design Patterns (Homework) The client has several legacy applications that are all stand-alone. They want a single point user interface to allow the user to navigate between the various apps. What design pattern could you use that would allow you to not have to give knowledge to each legacy app about the client and not have to hard code all the legacy systems into the client code?

24 05/26/2004www.indyjug.net24 Indy Java User’s Group Questions

25 05/26/2004www.indyjug.net25 Indy Java User’s Group www.indyjug.net

26 05/26/2004www.indyjug.net26 Indy Java User’s Group


Download ppt "05/26/2004www.indyjug.net1 Indy Java User’s Group May 26 2004 Knowledge Services, Inc."

Similar presentations


Ads by Google