Book review: Developing Flex 4 components

In this blog post I will review the book “Developing Flex 4 components”, written by Mike Jones. I will start off by covering the different chapters this book has and I will end with a final conclusion.The book promises to be “The complete Insider’s Guide to Building State-of-the-Art components with Adobe’s Flex 4 Platform”. That’s quite a promise to live up to, keep reading to find out if it delivers what it promises.

 

The chapters

The book is divided in three parts: “Overview and Installation”, “Developing Components” and “Distribution”, so I’ll split up the coverage of the chapters in the same way.

Part 1: Overview and Installation

This part consists of the following chapters:

  • Getting Started: This chapter provides a thorough introduction in the history of Flash and Flex, explains the difference between them and goes on about how to setup your environment and install Flash Builder.
  • The Flex 4 Components: this chapter explains the difference between the Halo and Spark architectures and covers the different kinds of components that are built on these architectures. It’s a thorough review about all the Flex components that exist today.
  • Anatomy of a Component: This chapter focuses on how a component is built, with special attention for the lifecycle a Flex component goes through. You’ll learn the different methods that get called during the lifecycle and which you should override. Next it covers the different super classes you could use for your custom component. What I especially liked are the parts about creating MXML components that don’t inherit from UIComponent, using the IMXMLObject interface and deferred instantiation with the IDeferredInstance interface.

Overall this part will be a good deal of repetition for seasoned Flex developers, who can skip the first two chapters. The third is a worthwhile read, especially because it provides rare information about IMXMLObject and IDeferredInstance.

Part 2: Developing Components

This is part is all about developing custom components and is the core of this book. It consists of the following chapters:

  • Creating Your First Component: In this chapter you’ll create a very simple component, first using the Halo way and the Graphics API, then in the new way using Spark and FXG. It’s a great introduction in custom component development.
  • Managing States: This chapter first introduces states in Flex 4, outside of the custom component context. Then states in actionscript are covered, which is very valuable information. The chapter goes on about states in custom components, but only in the Halo way.
  • Effects and Transitions: This chapter first introduces effects and transitions outside of the context of custom component development, then it covers transitions in actionscript in a custom Halo component.
  • Working with metadata: The chapter introduces metadata and covers all the common metadata attributes used in Flex. What I found the most valuable in this chapter is the part about creating your own metadata and how to use it in your applications. This is information that I hadn’t seen anywhere else.
  • Events and Event Handling: I didn’t find this chapter very exciting, as most Flex developers already know what events are and how to create custom event objects.
  • Manipulating Data:This chapter covers collections in Flex and how to sort and filter them. The last part of this chapter shows how to create a custom component with a dataProvider property and how to incorporate item renderers.
  • Skinning and Styling: This chapters covers the specifics about creating a custom skinnable Spark component. It covers dynamic skin parts, Skin states and creating skins. I do feel that the coverage of a custom skinnable component could have been better. For example, at one point the author says: “When the component invalidates itself, it calls getCurrentSkinState()”. But he never explains how to invalidate the states (this is done using the invalidateSkinState() method).
  • Creating Flex components with Flash Professional CS5: I must admit that I’ve skipped this chapter, since I know nothing about- and don’t use Flash Professional CS5.

Part 3: Distribution

This part covers all the aspects where other books and tutorials normally stop. Namely what to do with your finished custom component. It consists of the following chapters:

  • The Flex Library Project: This chapter first covers SWC files and what they are made of and how to create them. You may think you know them but you don’t until you read this chapter.
  • Component Integration in Flash Builder 4: This really is a chapter that I haven’t seen anywhere before. It covers the ins and outs of letting your custom component play nicely with Flash Builder and the built in designer. It covers how to integrate in the toolbox, setting default values for the property editors and customizing the main property panel. It then covers how to create design view extensions, which was great, as I didn’t even know this was possible.
  • Documentation: This final chapter covers ASDoc, it should be familiar to most Flex developers, but it still provides a few good to know gotcha’s about putting ASDoc above metadata.

Conclusion

I feel that the author wasn’t really sure about who his audience was. I feel like this because the author clearly states in the beginning that this book is for experienced Flex developers. Yet almost all the chapters begin with an introduction outside of the context of custom component development: States,Transitions, Events and Styling. All stuff that experienced Flex developers should know and I found myself getting bored during the first parts of these chapters.

Luckily, I didn’t put the book away, because then I would have missed all the valuable content that came after the stuff I already know like custom metadata, IDeferredInstance, IMXMLObject and states and transitions in actionscript. The last three chapters are also very valuable, as this is content that I haven’t seen anywhere before. In the end this is a must read for all Flex developers concerned with custom component development. Just take into account that you might find some stuff you already know, but the good greatly outweighs the bad in this book. To make a long story short, this book really is “The complete Insider’s Guide to Building State-of-the-Art components with Adobe’s Flex 4 Platform”.