Wednesday, December 15, 2010

Swiz 1.0.0, finally!

For you Flex and ActionScript developers out there, Swiz 1.0.0 has finally hit the street! This is by far the easiest Flex related framework to use with the least amount of code necessary to make it work. I've been using it since version 0.6.4 and have been impressed with the many additions that have been added during the long road here. I can remember the (sometimes heated) discussions about it not being a legitimate framework because it was a version less than 1.0. Well, it's legitimate now!
Everything you need, and more, has been provided for you. The release notes, source code in git, ASDocs and a zip of the SWC, docs and source is available.

Should you find yourself needing help, there is also a very active mailing list where you can get answers to any problems very quickly. For a while it seems I lived on that board.

Congratulations to the Swiz team. Here we go!!

Thursday, October 28, 2010

Review of: Flex On Java

Authors: Bernerd Allmon and Jeremy Anderson
Publisher: Manning Publications
ISBN-10: 1-933988-79-7
ISBN-13: 978-1-933988-79-5

$39.99 (Manning publishing) 266 pgs.

Reviewer: John S. Griffin

Adobe Flex has become a prolific toolkit for building RIAs. A primary advantage of Flex for RIA development is that it integrates easily with any back-end technology. By providing native XML, SOAP, and Data Remoting capabilities, Flex enables developers to build rich new UIs on top of existing services. For Java developers this combination is especially compelling because many Java systems have already embraced service-oriented architectures with SOAP Web Services, Spring, or one of numerous other technologies.

The book starts off by introducing the two technologies and building a sample Java application you can play with. After that you continue by building a Flex client for the Java application that ties into some Java web services. Part 1, introductory information, covers the first four chapters.

Part 2, chapters 5 and 6, introduces topics that allow Flex to connect to Java through object remoting, logging, and messaging. In chapters 5 and 6 a deeper dive is taken into backend integration with Java on the server side. Using the Spring Framework for Flex integration is demonstrated.

Part 3, chapters 7-11, covers a hodgepodge of topics, such as security and personalization, building graphs, desktop development with AIR, unit testing, and building a Flex and Grails application.

Maven is the build tool of choice for this book and its configuration is delved into as needed for the examples.

Summary of Contents
Part 1: Getting started
Chapter 1: Some Flex with your Java?
The book begins with a brief history of Java and Flex and continues with a rapid tour of Flex including how to start building a Flex application.

Chapter 2: Beginning with Java
This is a book about Java integration, but a simple Java web application is built. Frameworks were chosen that should ease the Java learning curve necessary to get a sample application up and running fast.

Chapter 3: Getting rich with Flex
A disconnected naked UI Flex client can take advantage of mock data and allow developers to easily prototype a UI without the complexity of external dependencies. This approach is demonstrated in chapter 3 where the beginnings of a rich UI for the FlexBugs sample application are created. This is the running application common to all Manning Publishing books.

Chapter 4: Connecting to web services
This chapter demonstrates connecting to the Java server side and how to leverage the Flex API for connecting to web services. Rather than use the typical approach of current literature, including the Flex online documentation, clean interfaces and views are created and a Flex client that will scale on demand is created.

Part 2: Strengthening the backend
Chapter 5: BlazeDS remoting and logging
This chapter demonstrates further how to connect a Flex client more directly to the server side using the open source BlazeDS framework. BlazeDS provides a mechanism for allowing Flex to call methods on Java objects through binary serialization with the Action Message Format or AMF. This chapter also covers BlazeDS logging in detail.

Chapter 6: Flex messaging
Here is a demonstration of how to develop Flex applications that take advantage of simple polling. We have to wait until chapter 11 for the discussion on how to connect using Java Message Service (JMS).

Part 3: Going above and beyond
Chapter 7: Securing and personalizing your application
This chapter demonstrates building authentication, authorization, and personalization with Spring Security (Acegi) integration.

Chapter 8: Charting with Degrafa
Degrafa is a declarative graphics framework that provides a suite of graphics classes. Degrafa is open source and can be used to build robust charts, tools, and other graph- ical elements with less effort and complexity than other frameworks. How to accomplish that is this chapter's topic.

Chapter 9: Desktop 2.0 with AIR
Comprehensive coverage of all aspects of converting a Flex application to an Air application including how to set up deployment is the topic of this chapter.

Chapter 10: Testing your Flex application
Every good programming book includes a discussion of unit testing. Some discuss Test Driven Design (TDD). This chapter discusses both of these topics.

Chapter 11: Flex on Grails
This chapter assumes that you are at least somewhat familiar with both Groovy and Grails, but if you have never seen or done any development using either, you should still be able to follow along. Idiomatic Groovy code is shown but not much detail about what the code does is given as that is apparently beyond the scope of this chapter. A simplified contact management application called Flex Contacts is built. Included are the details of exposing a Grails service to Flex and integrating Flex with JMS.

To begin with, readers of this book should be familiar with software development in general, specifically Flex and Java. Although the book was written to teach integration techniques for Flex and Java, not language fundamentals, it was done in a manner making it easy for even Flex or Java beginners to get rolling quickly with both.

This book is absolutely loaded with example code and every (that's right, every) configuration file change is delved into step-by-step.

Chapter 5 is the bomb! To paraphrase a fellow reviewer, this chapter alone is easily worth the price of the book! The simplifications presented here utilizing Spring will easily save both Java and Flex developers a ton of time in development. The how to of Java/Flex messaging implementation leaves chapter 6 not far behind.

More and more of the upper class of technical books are dedicating at least some time to discussion of application testing. Flex on Java takes this a little further with coverage of Test Driven Development (TDD). It contains a very welcome and much needed canvas of continuous integration with Hudson.

When this reviewer first examined this book, Chapter 11 seemed to be kind of a redheaded stepchild chapter until the realization that co-author Jeremy Anderson is quite involved in the Groovy scene. This chapter's strengths are two-fold. It demos Rapid Prototype Development (RPD) by taking leave of the running application and presenting a new pared down application. Secondly, it shows the implementation of JMS and ActiveMQ but since this is done in a Groovy environment it is of questionable value to Java/Flex developers. Groovy developers should appreciate it, however.

If you are a Java and/or a Flex developer that must interface between one and the other of these technologies then this book's plentiful examples and timesaving techniques are for you. You can't go wrong.

Monday, October 4, 2010

Here's another review. This one is of Manning Publication's Flex 4 in Action.

Review of: Flex 4 in Action

Author: Tariq Ahmed et al

Publisher: Manning Publications
ISBN-10: 1935182420
ISBN-13: 978-1935182429
Available: 28 Oct 2010

$33.74 ( 600 pgs.

Flex 4 in Action is a rewrite and update of the original Flex 3 in Action published in February of 2009. The book retains its overall topic flow so it will feel like an old warm blanket for those that learned Flex 3 from the previous edition or used it as a reference. New readers will feel just as welcome as it is an easy-to-read, thorough tutorial of what you need to know to come up to speed with the new Flex 4. There are also a couple of additions to the book that take it a step above the others.
The authors are acknowledged experts in their respective fields and have converted organizations to utilizing Flex for enterprise class applications.

Summary of Contents
Part One: Application Basics
Chapter One: Making the case
The book starts by talking about challenges that a web developer faces and how to solve them using Flex by Adobe. It also dives into the mechanics of a Flex application and discusses the Flex ecosystem as a whole.

Chapter Two: Getting Started
The authors show you how to take advantage of open source tools. They spend a good part of this chapter discussing Flash Builder and how to begin producing Flex applications.

Chapter Three: Working with ActionScript
Chapter 2 introduced ActionScript and this chapter is dedicated to it. The authors admit that entire books could be and are written about it. This chapter focuses on ActionScript?s core concepts of variable types, operators, loops, conditions, arrays and functions.

Chapter Four: Layout and Containers
In this chapter Flex?s visual building blocks and types of containers are discussed. These components can be anything from buttons, tables and graphics to other containers.

Chapter Five: Displaying forms and capturing user input
Creating forms in Flex is the topic here using input components (controls) and capturing user input.

Chapter Six: Validating user input
In this chapter how Flex handles validation and the different types of validators?such as those which verify the proper formatting of phone numbers and the structure of email addresses is covered. They are put to use, employing several different approaches.

Chapter Seven: Formatting Data
Formatting raw data with Flex?s built-in formatters is the subject of this chapter. This includes types of formatters, real-time formatting, scripted formatting and finally dealing with formatting errors.

Chapter Eight: MX DataGrids, lists, and trees
The authors cover everything you ever wanted to know about using list-based components from the MX library. Topics include list-based components displaying flat data, displaying hierarchical data, handling user interactions and retrieving selected items from List-based components.

Chapter Nine: Using the Spark List controls
In this chapter, you learn about the list-based features and functionality that ship with the Spark library, which is new to Flex 4. The discussion starts with the Spark list-based component architecture, and continues with how to leverage the new list-based Spark functionality in your Flex 4 applications.

Chapter Ten: List customization
This builds on chapter 9 by demonstrating how to customize the list-based components. Topics covered include the labelField property, label functions, overriding itemToLabel, item renderers and editors, advanced item renderers and filter functions.

Part Two: Application flow and structure
Chapter Eleven: Events
The event system is introduced along with its all-important role in a Flex application. Integrating native and custom events in an application while gaining an understanding of event nuances is also covered.

Chapter Twelve: Application Navigation
This chapter looks at the following components that you?ll use to add standard navigational features to your application: Menu, MenuBar, ViewStack, ButtonBar, TabNavigator and Accordion.

Chapter Thirteen: Introduction to pop-ups
The different ways of creating and managing pop-ups as well as simple ways to style them are here along with how to utilize the pop-up manager to help you create, delete, position, close, and destroy windows.

Chapter Fourteen: Implementing View States
This chapter starts by introducing the concept of view states in general. It then continues by covering everything you need to know about them.

Chapter Fifteen: Working with data services
This comprehensive chapter is all about data-centric development with Flash Builder. Starting with connecting to web services it continues with using the HTTPService and WebService components and understanding the Action Message Format (AMF). Communication with JavaEE using BlazeDS, ColdFusion Communication and communicating with PHP via Zend_AMF rounds out the discussion.

Chapter Sixteen: Objects and classes
Exploration of a fundamental feature of Flex, objects and classes, is the core of this chapter along with some OO theory. Covered topics include OO concepts, implementing OO concepts, using ActionScript classes, how to create, invoke and destroy them, and extend those that already exist.

Chapter Seventeen: Custom components
This chapter covers the basics of creating and utilizing custom components and tackles ways of getting your components to communicate with each other. Starting off by taking a look at how components are handled in Flex 4 and the Spark architecture, the discussion continues on with types of components and the difference between simple and composite objects.

Chapter Eighteen: Creating Reusable Components
Code reuse is the topic of this chapter. The example used in this chapter takes a look at a scenario where a component that reveals content must be created, but in many different ways, yet without having to write a separate component for each implementation.

Chapter Nineteen: Architectural Design Patterns
A deep look into Flex-driven design patterns and the thought process behind the core Flex architecture is taken. Then, rolling your own Flex application architecture is discussed without getting over-complicated. This chapter covers the Model-View-Controller pattern, how to roll your own architecture and mentions the frameworks Mate, Cairngorm, Parsley, and Swiz along with a deeper discourse into the Robotlegs framework.

Part Three: The Finishing Touches
Chapter Twenty: Customizing the Experience
This chapter focuses on the user experience and how you can leverage user experience design techniques in Flex to enhance your applications. The VIBE Model, themes and skins, CSS in Flex 4 and best practices are discussed.

Chapter Twenty-One: Working with Effects
This chapter first explains what effects are and how to use them and then the types of out-of-the-box effects are discussed.

Chapter Twenty-Two: Drag-and-Drop
D&D is considered from a usability point of view rather than just because you can use it or because of the coolness factor. The authors discuss how a mindset change is needed to accomplish this.

Chapter Twenty-Three: Exploring Flex-Charting Chapter
In this chapter, exploration of what makes up a chart, the charts that come with Flex, and how to customize them is covered.

Twenty-Four: Debugging and Testing
Debugging applications using the Flex debugger, using the Flash Builder Profiler and Unit and Functional testing of your applications is discussed.

Chapter Twenty-Five: Wrapping up a project
Tying up loose ends and getting the project out the door by customizing the HTML wrapper and deploying it to a production server is this chapter?s topic.

Chapter Twenty-Six: Working with XML
In this final chapter, Flex's robust XML support, from its ability to use XML as a source of data, to how you can use Flex to directly manipulate XML code is presented.

This new edition contains a thorough coverage of the new Spark components of Flex 4. It contains all you need to know to write applications with the new API.

The authors know from experience what you, as a developer, need to succeed and they make an admirable attempt at conveying it. This is nowhere more prevalent than their discussion in chapter 22 where they attempt to make you understand that just because something is 'cool' is not the reason to implement it in an application. When a feature will get the job done is the time to put it to use. You just need to change the way you look at things.

The book features two new chapters one of which was sorely missing from the previous edition. Chapter 19, Architectural Design Patterns, is a long overdue and very welcome addition. This chapter is a critically needed discussion of software architecture and assistive frameworks for Flex. Most books get atrociously overcomplicated, stay solely with theory and fail to bring those concepts to reality. They need to actually go through the process of designing architectures for actual enterprise applications. This chapter gives you the basics of how to go about it. This reviewer believes that a little two much time is spent with RobotLegs in this chapter at the expense of the others mentioned (one of the authors, Joel Hooks, plays a large part in the development and support of RobotLegs so that explains that). There aren?t even simple examples of the other second-generation frameworks Mate (pronounced ma-tay) and, this reviewer?s personal favorite, Swiz.

Chapter 9, Using the Spark List Controls, is the other new addition. This includes a thorough discussion of the Spark List Controls' class hierarchy and customization.

In chapter 24, Debugging, the authors could have spent a little more time on the Network Monitor and Profiler that comes with Flash Builder. There is a little more discussion of the Profiler but both of these topics are cursory at best. Also, this chapter provides sample code for unit testing Flex with the FlexUnit library. This is an absolutely essential addition.

Taken as a whole this new edition gives you good thorough coverage of the new Flex 4 and provides some sweet additions at the same time.

Those of you reading this who decided to pass on buying one of the other Flex 4 books before Flex 4 in Action made its appearance on shelves will be well served. It was worth the wait.

Tuesday, September 28, 2010

Well, after a year layoff I'm back in the saddle again. I've been doing a lot of reading lately so I thought I'd make my comeback with a review of Manning Publication's iText in Action.

Review of: iText in Action 2nd edition

Author: Bruno Lowagie
Publisher: Manning Publications
ISBN-10: 1935182617
ISBN-13: 9781935182610

$37.79 ( 700 pgs.
Reviewer: John S. Griffin

iText makes it possible to enhance applications with dynamic PDF solutions. It is one of the world's leading F/OSS (Free/Open Source Software) PDF libraries and is released under the Affero General Public License (AGPL). iText is available in two versions: the original Java version, and the C# port, iTextSharp. The iText web site is located at

Both editions were written by the man who created the API. In the first edition of "iText in Action", readers learned why things work the way they do in iText, complemented with simple examples. This second edition takes readers further with more real-life examples and presenting comprehensive code samples that you can use to solve everyday problems.

The book utilizes a movie database, created for a (fictional) film festival as the running application for the examples as is usual for any Manning book. It is accessed from a series of simple programs and PDF files are created and manipulated in different ways that could be useful for the visitors of the imaginary film festival.

Summary of Contents
Part 1: Creating PDF documents from scratch
This section demonstrates how to create a document from scratch. Concepts such as iText's basic building blocks and direct content are introduced. Adding columns and tables to a document are discussed in great detail. Part one concludes by explaining how to add the finishing touch to your document using page events for headers, footers, page numbers and watermarks.

Chapter 1: Introduction
Creating a series of PDF documents from scratch begins the book. SQL statements are used to query a movie database, loop over the ResultSet, and add the data from each record to a PDF document using high-level objects such as Chunks, Phrases, Paragraphs, and so on. The creation of PDF documents without having to know anything about the PDF specification is the goal here.

Chapter 2: Composing a document using iText's Basic Building Blocks
Lines, shapes, and text are demonstrated to create a time table visualizing movie screenings, using a different color for every film festival category. To achieve this, low-level operations that demand a sound understanding of how PDFs work are utilized.

Chapter 3: Adding content at absolute positions
This chapter covers the basics of adding content to a page using methods that are referred to as low-level operations because they write PDF syntax directly to the content stream of the page. The ColumnText object is covered and reusing content with the PdfTemplate object is also discussed.

Chapter 4: Organizing content in tables
In one of the most important chapters of the first part, documents containing tabular data are created from the database. Almost everything there is to know about the PdfPTable and PdfPCell objects is presented.

Chapter 5: Completing your layout using table, cell, and page events
Knowledge about tables and cells will be completed by learning how to add custom behavior to a table and its cells using events. Also page events are discussed. The finishing touch to documents in the form of headers, footers, page numbers and a watermark is presented.

Part 2: Manipulating existing PDF documents
Part two deals with existing PDF files; be it documents created with iText as discussed in part one, or PDFs created with Adobe Acrobat, Open Office, or any other PDF producer. Different ways to copy, stamp, split and merge documents re examined. Actions and JavaScript are discussed along with everything on the subject of filling out interactive forms.

Chapter 6: Working with existing PDFs
PdfReader is used to access an existing PDF file, and one or more of these document manipulation classes is chosen for further changes depending on particular circumstances:
  • PdfWriter in combination with PdfImportedPage objects - taking "photocopies" of specific pages
  • PdfStamper - adding content to one existing PDF document
  • PdfCopy, PdfSmartCopy, or PdfCopyFields - combining a selection of pages from different, existing documents into a new PDF document

Chapter 7: Making documents interactive
A closer look at the PdfStamper class is taken. It is used to annotate a single document.

Chapter 8: Filling out interactive forms
A special type of annotation in PDFs are interactive form fields. They are used in forms by implementing AcroForm technology. Another type of PDF form is based on the XML Forms Architecture (XFA). Both types of interactive forms are discussed in chapter 8.

Part 3: Essential iText Skills
Parts one and two showed how to build a standalone application that is able to create and/or manipulate a PDF document in black and white, using standard fonts, and so on. Part three tells you how to integrate it into a web application, how to create images and colors, how to choose and use different fonts, and finally how to protect your document.

Chapter 9: Integrate iText in your web applications
For the sake of simplicity, most of the examples in this book are standalone applications, but a majority of projects use iText as a PDF engine in server-side web applications. You'll certainly benefit from chapter 9 if you want to avoid the pitfalls you might encounter while integrating your iText application into a Java Servlet.
Once your proof of concept is online, you'll probably be confronted with many extra user requirements some of which are covered in the next three chapters.

Chapter 10: Brighten up your PDF with color and images
There are eleven different color spaces available in PDF. Color spaces are expressed as PDF dictionaries. A reference to these dictionaries can be found in the resources entry of a PDF stream. This is explained in great detail in the PDF reference. How iText hides this complex theory by providing color classes is discussed.

Chapter 11: Choose the right font
How does one choose a particular font? Which font files can be used with iText? How about special writing systems? In some languages, you have to write from right to left, and from top to bottom. This chapter demonstrates that iText contains convenience classes that make it easier to select a font.

Chapter 12: Protect your PDF
Several important topics are presented in this chapter:

  • Providing metadata - information about the owner of this data and how to add and access it
  • Compressing and decompressing PDFs - the content of a document is compressed by default. iText can decompress content streams to read the PDF syntax that makes up a page or a form XObject.
  • Encrypting documents - PDF protection via passwords and encryption
  • Adding digital signatures - public and private keys

Part 4: Under the hood
An overview of the history of PDF is presented in chapter 13. It takes a look at the inner workings of a PDF document. It explains the different parts of a PDF file: the header, the body, the cross-reference table, and the trailer. Since the body of a PDF file consists of a series of objects, an examination of the different types of objects in the Carousel Object System is presented. The three final chapters focus on stream objects.

Chapter 13: PDF files inside-out
One of Adobe's important goals, was that every new version of the PDF specification had to be backward compatible. This was possible thanks to the well designed architecture of a PDF file, a.k.a. the Carousel Object System. By studying the different objects that make up a PDF document, you'll learn how iText creates a PDF file.

Chapter 14: The imaging model
The streams holding the content of a page in a PDF document is the focus of this chapter. All the methods to draw lines and shapes (graphics state), and to write letters and words (text state) are listed.

Chapter 15: Page content and structure
Making content optional is discussed, and also structure in the content stream of a page is introduced. A fair attempt to parse content streams of existing PDF pages is made and a closer look is taken at the other streams that can be found in a PDF document: images, fonts, file attachments, and rich media.

Chapter 16: PDF streams
In this final chapter, streams that contain images, fonts, file attachments, and rich media are covered.

This book is a rewrite of the first edition. When this reviewer first started the book and read what the author had done with it compared to the first edition he was a little worried that interested readers might have to buy both books in order to completely understand the iText library and API. After reading deeper into it you can rest assured that this is not the case. iText beginners will have no problem understanding the API.

The chapters concerning basic building blocks (to get you started), fonts, tables, colors, web applications and all the others are still there and with better examples and explanations. Speaking of examples, there are a hugh number of them in this book which is an improvement over the first edition. Many of them can be used right out of the book to solve problems that the author is sure you will run into. They have also been updated from Java4 to Java5.

New topics include PDF security which covers public/private keys, encryption, compression, passwords and the like, manipulating existing PDFs (what you can and cannot do) and a deep dive into the imaging model and the actual inner workings of the page among other topics.

In this reviewer's previous work experience there were many copies of the first edition on the desks of report developers. This is one of the most important niches for iText. Yes, there are more pieces of PDF generation software out there today than you can count but their problem is that they are very difficult to automate for on demand, detailed, ad hoc reports. That is a very large workspace for iText. This reviewer expects to see many more copies of the new edition out there than there were original ones.

All in all, the book is well written and the examples are vastly improved over the first book. If you are creating a system for generating ad hoc reports, programmatically generating PDFs on the fly for web or other applications, modifying existing PDFs without their original documentation or doing just about anything else with PDFs, this is the book you need. Highly recommended.

It won't be another year before I write again. I'm going to put another review here soon on a book I'm extremely impressed with, Manning's DSLs in Action.