1. Trang chủ
  2. » Công Nghệ Thông Tin

professional java user interfaces phần 1 pdf

68 328 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 68
Dung lượng 2,05 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Professional Java User Interfaces... Professional Java user interfaces / Mauro Marinilli.. Brief ContentsAcknowledgements xxi Introduction xxiii Part I User Interface Design Part II Soft

Trang 4

Main Patterns and Design Strategies organized by functional layer

Trang 5

– Iterative GUI development (169)Iterate: GUI design and implementation, profiling, software and usability testing.

Visual refactorings

Other refactorings are discussed in Chapter 5

• Extract explicit panel (195), Extract stand-alone panel (196), and Composable units (292) Extract the code of an existing GUI panel into a separate implementation to enhance modularity and reusability

• Merge panel (197)

Merge different implementations representing the same panel into a common one

• Add parameter to panel (197) and Remove parameter from panel (198)

Add parameters to customize a panel and its opposite refactoring, Remove parameter from panel (198)

• Parameterize panel (199)

Implement two slightly different panels with a unique code base

• Replace parameter with panel (200)

Instead of adding a parameter, separate the implementation of the two panels

• Rename panel (201)

Change the name of a panel

Trang 6

Cheat Sheet

An extremely simplified and by no means exhaustive basic reference to some of the topicsdiscussed in the book

GUI Design

• How do I signal to the user my GUI is busy?

Change mouse pointer to hour glass for any operation that lasts more than two seconds, always use progress indicators, and update progress every five seconds

• How do I validate my GUI?

Involve users in design, use prototyping, software testing, memory profiling

(Chapter 5), questionnaire evaluation (Appendices A and B), and usability testing

• How do I organize the GUI window area?

Use the Area Organization design strategy (120).

• How do I allow the user to select or create information in a GUI?

Use the Chooser design strategy, 126.

• How do I deploy my GUI?

Use Java Web Start when the user population is confident with approving certificates,

as for internal software Use installers in other cases, and for large installation bundles Consider also using applets!

opera-• How do I implement control (reaction to user interaction) in my GUI?

Depending on the number of items to be controlled by control rules, use:

– Scattered control (260) – few items, reactive-only control rules

– Centralized control, the Mediator pattern (263) – many items, any kind of control rule

– Explicit Control State (260) – complex control rules, need for flexibility

• How do I implement undo/redo in a GUI?

Build a queue or stack of edits (587), use the Command pattern (258) for user actions.

• How do I implement role-based authorization/security in my GUI?

Build a dedicated authorization manager class using Adaptation (272)

Trang 7

• How do I implement user customization and user profiles in my GUI?

Build a dedicated profile manager class using Adaptation (272)

• How do I reuse existing panels in my GUI?

Use visual refactorings (194)

• How do I organize implementation for modularity and extensibility in a large or complex GUI?

Define and implement a Composable Unit strategy, 292.

• How do I implement content assembly – adding components to a screen or panel – in

a GUI?

Depending on the features you want use:

– Static assembly (229), for simple layouts, no reusability

– Simple Builders (229), for ease of use, separation of concerns, limited flexibility

– Create and use Domain-specific or Little languages, 466 – good separation, maximum

flexibility

• How do I organize complex event-based interactions among objects in my GUI?Use an Event Arbitrator (245) to:

– Avoid event loops and rationalize chains of observers-observables

– Shield client classes from low-level events

– Forward events to complex data structures based on the Composite pattern

• How do I handle large data collections?

Depending on the context of the problem, use:

– Eager disposal (281) of objects that are no longer needed – simple references, extremely large trees

– Weak or soft references, for cached objects and data that can be created or fetched

on the fly

– Paging (281) for loading a few pages at time, discarding old ones, such as large table models or large collections of expensive objects

• How do I communicate data remotely in a modular way?

Separate screen data state from domain objects using Data Transfer Objects (234)

• How do I handle data represented in widgets?

Define Screen Data State (SDS, 330) and the widgets that will interface SDS to the user For synchronization with domain objects data (if any) use:

– Manual synchronization of SDS and data, for simple, small GUIs

– Data binding support, for medium to large, complex GUIs

Trang 8

Professional Java User Interfaces

Trang 10

Professional Java User Interfaces

Mauro Marinilli

Trang 11

Copyright © 2006 John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester,

West Sussex PO19 8SQ, England Telephone (+44) 1243 779777 Email (for orders and customer service enquiries): cs-books@wiley.co.uk Visit our Home Page on www.wiley.com

All Rights Reserved No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP, UK, without the permission in writing of the Publisher Requests to the Publisher should be addressed to the Permissions Department, John Wiley & Sons Ltd,

The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ, England, or emailed to permreq@wiley.co.uk, or faxed

to (+44) 1243 770620.

Designations used by companies to distinguish their products are often claimed as trademarks All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners The Publisher is not associated with any product or vendor mentioned in this book.

This publication is designed to provide accurate and authoritative information in regard to the subject matter covered It is sold on the understanding that the Publisher is not engaged in rendering professional services If professional advice or other expert assistance is required, the services of a competent professional should be sought.

Other Wiley Editorial Offices

John Wiley & Sons Inc., 111 River Street, Hoboken, NJ 07030, USA Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA Wiley-VCH Verlag GmbH, Boschstr 12, D-69469 Weinheim, Germany John Wiley & Sons Australia Ltd, 33 Park Road, Milton, Queensland 4064, Australia John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809 John Wiley & Sons Canada Ltd, 22 Worcester Road, Etobicoke, Ontario, Canada M9W 1L1 Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books.

Library of Congress Cataloging-in-Publication Data

Marinilli, Mauro.

Professional Java user interfaces / Mauro Marinilli.

p cm.

Includes bibliographical references and index.

ISBN 0-471-48696-5 (pbk : alk paper)

1 Java (Computer program language) 2 User interfaces (Computer systems) I Title.

QA76.73.J38M34954 2006 005.13'3 dc22

2006004498

British Library Cataloguing in Publication Data

A catalogue record for this book is available from the British Library ISBN 13: 978-0-471-48696-5

ISBN 10: 0-471-48696-5 Typeset in 10/13.5pt Palatino by Laserwords Private Limited, Chennai, India Printed and bound in Great Britain by Bell & Bain, Glasgow

This book is printed on acid-free paper responsibly manufactured from sustainable forestry in which at least two trees are planted for each one used for paper production.

Trang 12

To the person who keeps alive in his daily work the Spirit of Wonder of the early days.

Trang 14

Brief Contents

Acknowledgements xxi Introduction xxiii

Part I User Interface Design

Part II Software Design

Part III Examples

Brief Contents

Trang 15

16 An Example Ad-Hoc Component 567

A A Questionnaire for Evaluating Java User Interfaces 607

B A Questionnaire for Evaluating J2ME Applications 613 References 621

Trang 16

Acknowledgements xxi Introduction xxiii

William, a first year student in a Master in CS course xxxii

1 Putting GUI Development into Context 1

Trang 17

1.7 Lifecycle models, processes and approaches 14

Part IV User Interface Design

2 Introduction to User Interface Design 31

A model of interactive systems – seven stages

Trang 18

3 Java GUI Design 77

Ad-hoc versus custom – the difference between ‘run’ and ‘ride’ 81

An example – applying the guidelines for designing dialogs 114

4 Recurring User Interface Designs 119

Trang 19

Part V Software Design

5 Iterative GUI Development with Java 169

Trang 20

5.4 GUI builders 184

The principle of Single Functional Responsibility 227

Trang 21

SWT events 243

Alternatives to event-based communication mechanisms 250

Model-View-Controller 252

Representing user actions with the Command pattern 257

Trang 22

7.5 The service layer 314

Trang 23

9.4 From Web applications to rich clients 371

Trang 24

11.8 GUI builders 422

Part VI Examples

The workbench – the building blocks of ERCP GUIs 479

Trang 25

13.5 Choosing the best RCP for your needs 483

Trang 26

14.10 An alternative, cost-driven implementation 530

Trang 27

16.5 User interaction 582

A A Questionnaire for Evaluating Java User Interfaces 607

B A Questionnaire for Evaluating J2ME Applications 613

References 621

Trang 28

I have been working on this book for more than five years, in one way or another

It is by no means the result of a single person (the author) A very large number

of people shaped it, so many that it will be impossible to name them all

I should first thank Sally Tickner and the management at John Wiley and Sons, forallowing me to deliver the manuscript after such a huge delay, which was mostlycaused – only a partial excuse – by my never-ceasing joy of working on andtaming new and complex adventures, rather than lack of interest in the subject.It’s easy to remember Steve Rickaby of WordMongers, whose expert hand madethis book readable and sometimes even enjoyable If it wasn’t for his help thisgigantic work would have been very different

A special thanks too to my students, who kept the fire of honest enthusiasm andthe Spirit of Wonder high, and who were extremely patient with my shamefulschedule I hope I gave them back at least a small portion of what they gave to me

I wish also to thank the reviewers for their careful work, the many clients andcolleagues for the countless lessons that I tried to put together in the book, and allthe people who spent precious time out of their lives putting into written formtheir hard-won experience, often without any economic return

Last but not least, my biggest thanks go to my family, my Bella, and my closestfriends Without their presence, patience, and constant support, this bookwouldn’t have been possible

Acknowledgements

Trang 30

This introduction is structured as follows:

The interactivity thrill talks about the magic of the first time and other things The organization of the book discusses the book’s contents and organization Book readers and personas provides a more user-centered approach to the contents

of the book

The interactivity thrill

Current software technology allows developers to build graphical user interfaces(GUIs) for only the cost of the labor, and with greater simplicity than ever before.Despite that, GUIs, and Java GUIs among them, are often totally frustrating anddisappointing In the words of Alan C Kay1:

“A twentieth century problem is that technology has become too ‘easy.’When it was hard to do anything, whether good or bad, enough time wastaken so that the result was usually good Now we can make thingsalmost trivially, especially in software, but most of the designs are trivial

as well This is inverse vandalism: the making of things because you can.

Couple this to even less sophisticated buyers and you have generated anexploitation marketplace similar to that set up for teenagers A counter tothis is to generate enormous dissatisfaction with one’s designs using theentire history of human art as a standard and goal Then the trick is todecouple the dissatisfaction from self worth – otherwise it is either toodepressing or one stops too soon with trivial results.”

Basically, inverse vandals don’t care about their work and its impact on the lives ofusers and the many others affected by their work, which is a pity Software has asort of magic in itself, and interactive software provides a concrete, vivid example

of such a magic Whether you are a teenager playing a video game or an old guyfiddling with an early computer in your garage, there was probably a moment inyour life when you were totally amazed by a piece of software – otherwise youwould probably have chosen another career

1 The Early History of Smalltalk,

http://gagne.homedns.org/~tgagne/contrib/EarlyHistoryST.html

Introduction

Trang 31

Such a feeling alone, and perhaps a rather selfish and self-gratifying one, is notenough to provide reliable, professional results There is a need to study andapply a wide array of subjects in depth, filtering user’s needs through experienceand the relentless application of ambitious but sensible designs and solutions,both on the GUI side and in its implementation Despite all this hard work – orpossibly because of it – the fun still remains, and I hope you can see it between thelines of this book Finally, some words about my professional background, thatcould help in providing a better understanding and a more critical view of thebook’s contents.

My long experience is mostly on internal projects, that is, building software forcustomers, and also spans a few products building shrink-wrapped software Asfar as Java is concerned, I started working with Java GUIs in 1998, trying to focus

on client-side aspects whenever possible I worked on a couple of large andcomplex GUIs, and on other projects that ranged from the weather forecastingsystem for the Italian air force to large multinational corporate ERPs, various Websites, a large GUI framework for advanced enterprise clients – on various aspectsstill unmatched on the market – and more recently have been hopping on and offplanes throughout Europe and US as a consultant while trying to find the time for

a number of EU and academic research projects

Usable GUIs and usable books

Writing a book like this is in many ways similar to GUI development1 Theauthor has a target audience, at least in his mind (end users), and many littledaily hindrances He needs to work to earn his keep, trying to maintain aprivate life and struggle with mundane things like mastery of the Englishlanguage (GUI design guidelines), the wrong dpi settings in scanned pictures(API inconsistencies), ever-newer technologies, and all the rest Luckily he isnot alone He is the less-experienced part of a great team of professionals (thedevelopment team), good-willed reviewers (user representatives), and wonderfulprivate-life supporters Nevertheless, new ideas and existing content thatshould be better addressed seem never-ending (feature creep), and the manu-script keeps growing (deadlines shifting) The author is constrained by

deadlines and wants to deliver something useful (at least within his definition

of usefulness) There are different kinds of GUI development There are wrapped products, where there is competition and users can easily opt for yourproduct or a competing one, as in the case of a shareware music player, andvarious forms of internal projects where users have no choice but to read the

shrink-1 The term development is meant to indicate the general process of building a GUI, including

GUI design and implementation

Trang 32

book/use the application A documentation manual fits the latter category1:unfortunately for me, this book falls into the first category

All the above has a common denominator: the end user The ultimate objective is

to write a book that you would like to read, in which the message comes across as smoothly and as richly as possible and as you expect, saving you time and effort, while possibly providing you with a pleasant experience This book – and the next application you are going to create – will be effective and useful as long as its very

inception, its design and writing, focuses on end users

The organization of the book

The book is organized in three parts The first part introduces HCI and GUIdesign, starting from general concepts and concluding with recurring GUIdesigns The second part, from Chapter 5 to Chapter 12, discusses general imple-mentation advice The third part, from Chapter 13 to Chapter 16, discusses someexamples applications, from analysis and GUI design to the software architectureand the implementation – something rather rare to find in literature Finally, twoappendices provide evaluation questionnaires specifically targeted at Java GUIs.The following gives a brief description of the book’s contents

1 In real-world situations users have another popular choice: skip reading the manualaltogether

Part Chapter Title Description

1 Putting GUI Development

into Context

Framing GUI development in the wider context

of software development, introducing a general reference functional model for GUIs, and UML diagrams

3 Java GUI Design Practical GUI design for the Java platform with

some practical examples, introducing the Java Look and Feel design guidelines

4 Recurring User Interface

Designs

Recurring design solutions in desktop tions, with reusable code

Trang 33

Intro-6 Iterative GUI Development

with Java

Introduction to software design strategies and OOP design patterns for GUIs

7 Code Organization Main software architectures for GUI

applica-tions and some reusable utility classes

8 Form-Based Rich Clients An example iterative, test-driven GUI

development

9 Web-Based User Interfaces Web GUI design basics and related Java

technologies

10 J2ME User Interfaces An introduction to J2ME GUI technologies and

GUI design for wireless devices, with some example code for MIDP

11 Java Tools and Technologies A review of the main tools and technologies

available for Java application development, with particular focus on open source software

12 Advanced Issues Some topics of interest for complex GUIs:

building custom frameworks, usability applied

to API design, memory management, legacy GUI code, and domain-specific languages for GUIs

Part Chapter Title Description

Trang 34

Three levels of advice

Building a usable, cost-effective, professional-quality GUI is a complex and disciplinary process that involves mastery of many different skills In this book wewill cover three different perspectives: the design of the user interface, the soft-ware architecture behind it, and the tactics related to the source code, as shown inthe figure below

multi-The three level of advice in the book

Professional GUIs are carefully designed and implemented pieces of software Forthis reason special attention is given in this book to implementation details, espe-cially at the design and architectural level – in my experience the only way toabsorb reliably the sort of complexity-by-accretion that real world GUIs exhibit.Source code listings and code-level tactics are mentioned only briefly, to savespace and reduce the danger of sending my copy-editor to sleep

13 Rich Client Platforms Introduction to Rich Client Platforms (RCP)

and Eclipse RCP GUI design guidelines, with

an example service-oriented GUI for the Eclipse RCP

14 The Personal Portfolio

Application

Design and development of an example cation using use cases An alternative design using JDNC is also discussed

Interface

Using the OOUI approach to design and ment an example application, compared with the use of the Naked Objects framework

Component

An example ad-hoc component and its

comparison with the JHotDraw framework.

A A Questionnaire for

Evalu-ating Java User Interfaces

B A Questionnaire for

Evalu-ating J2ME Applications

Part Chapter Title Description

Ngày đăng: 12/08/2014, 23:22

TỪ KHÓA LIÊN QUAN